PHP code example of makeabledk / laravel-production-seeding

1. Go to this page and download the library: Download makeabledk/laravel-production-seeding library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

makeabledk / laravel-production-seeding example snippets


class ConfigSeeder extends Seeder
{
    use \Makeable\ProductionSeeding\SyncStrategy;
    
    public $rows = [
        [
            'key' => 'some_service_id',
            'value' => '123456' 
        ],
        [
            'key' => 'some_service_public_key',
        ],
        [
            'key' => 'some_service_private_key',
        ],
    ];
    
    public function run()
    {
        $this->apply($this->rows, Config::class, 'key');
    }
}


class LanguageSeeder extends Seeder
{
    use \Makeable\ProductionSeeding\SyncStrategy,
        \Makeable\ProductionSeeding\AppendsSortOrder;
    
    protected $sortKey = 'order'; // default if omitted
    
    public $rows = [
        [
            'code' => 'en_GB',
            'name' => 'English (GB)',
        ],
        [
            'code' => 'en_US',
            'name' => 'English (US)',
        ],
        [
            'code' => 'da_DK',
            'name' => 'Danish',
        ],
    ];
    
    public function run()
    {
        $this->apply($this->rows, LanguagesModel::class, 'code');
    }
}


class ConfigSeeder extends Seeder
{
    use \Makeable\ProductionSeeding\AppendStrategy;
    
    public $rows = [
        [
            'key' => 'some_service_id',
            'value' => '123456' 
        ],
        [
            'key' => 'some_service_public_key',
        ],
        [
            'key' => 'some_service_private_key',
        ],
    ];
    
    public function run()
    {
        $this->apply($this->rows, Config::class, 'key');
    }
}