1. Go to this page and download the library: Download codingphase/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/ */
use CodingPhase\Seeder\ModelSeeder;
class UsersTableSeeder extends ModelSeeder
{
...
}
/**
* Run the database seeds.
*
* @return void
*/
public function run
{
//Example
$users = $this->seedModel(\App\User::class, function ($user) {
$user->save();
});
}
$this->setAmount(30)->seedModel(\App\User::class, function ($user) {
$user->save();
});
$this->setHeader("Awesome Users")->seedModel(\App\User::class, function ($user) {
$user->save();
});
$this->setAmount(30)->seedModel(\App\User::class, function ($user) {
$user->save();
});