PHP code example of cornelisonc / famous-user-seeder

1. Go to this page and download the library: Download cornelisonc/famous-user-seeder 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/ */

    

cornelisonc / famous-user-seeder example snippets


namespace Database\Seeders;

use Cornelisonc\FamousUserSeeder\NicCage;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $nicCage = new NicCage();

        Db::table('users')->insert(
            $nicCage->get(
                50,
                [
                    'fullName',
                    'email',
                    'password'
                ]
            )
        );
    }
}

$fields = array[
    'fullName',
    'firstName',
    'lastName',
    'email',
    'password'
];

$nicCage->get(1, array(
    'name'              => 'fullName'
    'first'             => 'firstName',
    'last'              => 'lastName',
    'favorite_color'    => 'favorite_color'
));

// will return:

array([
    'name'              => 'Yuri Orlov',
    'first'             => 'Yuri',
    'last'              => 'Orlov',
    'favorite_color'    => '7d8fff9aq2' // 10 char random string
]);