PHP code example of fishingboy / codeigniter-seeder
1. Go to this page and download the library: Download fishingboy/codeigniter-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/ */
fishingboy / codeigniter-seeder example snippets
use fishingboy\ci_seeder\CI_Seeder_Controller;
class Seeder extends CI_Seeder_Controller { }
use fishingboy\ci_seeder\CI_Seeder_base;
class Sample_seeder extends CI_Seeder_base
{
/**
* 執行順序 (大的排前面)
* @var integer
*/
public $priority = 100;
/**
* 塞資料
* @return integer 新增資料筆數
*/
public function run()
{
$this->CI->db->insert("users", [
'name' => fishingboy,
]);
return 1;
}
}
shell
seeder
php index.php seeder -- help
php index.php seeder run -- execute seeder
php index.php seeder run {seeder_name} -- execute One Seeder
php index.php seeder ls -- check seeder status
--
php index.php seeder run Sample_seeder (priority: 100)