PHP code example of lukam / smart-seeder
1. Go to this page and download the library: Download lukam/smart-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/ */
lukam / smart-seeder example snippets
'seeds' => 'seed_table_name',
use App\User;
use Illuminate\Database\Seeder;
class SeedUsers extends Seeder
{
/**
* Run the seeds.
*
* @return void
*/
public function run()
{
// Create a new user
User::create([
'name' => 'John Doe',
'email' => '[email protected]',
'password' => bcrypt('secret')
]);
}
/**
* Revert the seeds.
*
* @return void
*/
public function revert()
{
// Delete the user
User::whereEmail('[email protected]')->delete();
}
}