PHP code example of amestsantim / laravel-seeder-with-data-generator

1. Go to this page and download the library: Download amestsantim/laravel-seeder-with-data-generator 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/ */

    

amestsantim / laravel-seeder-with-data-generator example snippets


php artisan make:seeder-with-data permissions "[['guard_name' => 'web', 'name' => 'Make Seeders'], ['guard_name' => 'web', 'name' => 'Run Seeders']]"



use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class GenericModel extends Model
{
    public $timestamps = false;
}

class PermissionsTableSeeder extends Seeder
{
    public function run()
    {
        $rowArray = [['guard_name' => 'web', 'name' => 'Make Seeders'], ['guard_name' => 'web', 'name' => 'Run Seeders']];
        $model = new GenericModel();
        $model->setTable('permissions');
        foreach ($rowArray as $row) {
            $model->create($row);
        }
    }
}


php artisan make:seeder-with-data permissions "[['guard_name' => 'web', 'name' => 'Make Seeders'], ['guard_name' => 'web', 'name' => 'Run Seeders']]" --path="/storage/app/seeders"

php artisan make:seeder-with-data permissions "[['guard_name' => 'web', 'name' => 'Make Seeders'], ['guard_name' => 'web', 'name' => 'Run Seeders']]" --timestamps