PHP code example of orangehill / iseed

1. Go to this page and download the library: Download orangehill/iseed 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/ */

    

orangehill / iseed example snippets


// ...
Orangehill\Iseed\IseedServiceProvider::class,



// File: /database/seeds/UsersTableSeeder.php

class UsersTableSeeder extends Seeder {

    /**
     * Auto generated seed file
     *
     * @return void
        */
    public function run()
    {
        \DB::table('users')->truncate();
        \DB::table('users')->insert(array (
            0 =>
            array (
                'id' => '1',
                'email' => '[email protected]',
                'password' => '$2y$10$tUGCkQf/0NY3w1l9sobGsudt6UngnoVXx/lUoh9ElcSOD0ERRkK9C',
                'permissions' => NULL,
                'activated' => '1',
                'activation_code' => NULL,
                'activated_at' => NULL,
                'last_login' => NULL,
                'persist_code' => NULL,
                'reset_password_code' => NULL,
                'first_name' => NULL,
                'last_name' => NULL,
                'created_at' => '2013-06-11 07:47:40',
                'updated_at' => '2013-06-11 07:47:40',
            ),
            1 =>
            array (
                'id' => '2',
                'email' => '[email protected]',
                'password' => '$2y$10$ImNvsMzK/BOgNSYgpjs/3OjMKMHeA9BH/hjl43EiuBuLkZGPMuZ2W',
                'permissions' => NULL,
                'activated' => '1',
                'activation_code' => NULL,
                'activated_at' => NULL,
                'last_login' => '2013-06-11 07:54:57',
                'persist_code' => '$2y$10$C0la8WuyqC6AU2TpUwj0I.E3Mrva8A3tuVFWxXN5u7jswRKzsYYHK',
                'reset_password_code' => NULL,
                'first_name' => NULL,
                'last_name' => NULL,
                'created_at' => '2013-06-11 07:47:40',
                'updated_at' => '2013-06-11 07:54:57',
            ),
        ));
    }

}



// File: /database/seeds/DatabaseSeeder.php
class DatabaseSeeder extends Seeder {

    /**
     * Run the database seeds.
     *
     * @return void
        */
    public function run()
    {
        Eloquent::unguard();

        if(App::environment() == "local")
        {
            throw new \Exception('Only run this from production');
        }

        #iseed_start

        // here all the calls for newly generated seeds will be stored.

        #iseed_end
    }

}

php artisan iseed users --force

php artisan iseed users --dumpauto=false

php artisan iseed users --clean

php artisan iseed users --database=mysql2

php artisan iseed users --max=10

php artisan iseed users --chunksize=100

php artisan iseed users --exclude=id
php artisan iseed users --exclude=id,created_at,updated_at

php artisan iseed users --prerun=someEvent

php artisan iseed users,groups --prerun=someUserEvent,someGroupEvent

php artisan iseed users,groups --prerun=,someGroupEvent

php artisan iseed users --postrun=someEvent

php artisan iseed users,groups --postrun=someUserEvent,someGroupEvent

php artisan iseed users,groups --postrun=,someGroupEvent

php artisan iseed users --noindex