You can use laravel included package called "seed"
I've tried to use it but it does not work this is DatabaseSeeder.php file
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use DB;
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call('AdminSeeder');
}
}
and this is AdminSeeder.php
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use DB;
class AdminSeeder extends Seeder {
public function run(){
Model::unguard();
$user = ['name' => 'name','email' => '[email protected]','password' => bcrypt('123456')];
$db = DB::table('users')->insert($user);
}
}
when I type
php artisan db:seed
it returns nothing
there is a problem with my path in sublime and terminal I fixed it and it's solved :D
You should try to use the factory method of 5.1 or testdummies package in 5.0 to create multiple fake users (which in turns use fakery package)
*Caveat: I couldnt get 5.1 to run factory method properly
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community