/** * Run the database seeds. * * @return void */ public function run() { App\User::truncate(); App\User::create(['name' => 'John Doe', 'email' => '*****@*****.**', 'password' => Hash::make('password')]); App\User::create(['name' => 'Appkr', 'email' => '*****@*****.**', 'password' => Hash::make('password')]); factory('App\\User', 8)->create(); }
public function run() { App\User::truncate(); $data = array(array('name' => 'Admin', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('admin'), 'profesi' => 'Admin')); DB::table('users')->insert($data); factory(App\User::class, 20)->create(); }
/** * Run the database seeds. * * @return void */ public function run() { App\User::truncate(); App\User::create(['name' => 'safeer', 'email' => '*****@*****.**', 'gravatar' => 'label label-info']); App\User::create(['name' => 'gopinath', 'email' => '*****@*****.**', 'gravatar' => 'label label-success']); App\User::create(['name' => 'nishanth', 'email' => '*****@*****.**', 'gravatar' => 'label label-warning']); App\User::create(['name' => 'narayanan', 'email' => '*****@*****.**', 'gravatar' => 'label label-danger']); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); App\User::truncate(); App\Post::truncate(); App\Phone::truncate(); $this->call(UserTableSeeder::class); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { /** * Attenction! * It could be deleted records existed. */ App\User::truncate(); factory('App\\User', 50)->create(); }
public function run() { App\User::truncate(); App\User::create(['role' => 'developer', 'name' => 'shxfee', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]); App\User::create(['role' => 'developer', 'name' => 'haris', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]); App\User::create(['role' => 'developer', 'name' => 'inad', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]); App\User::create(['client_id' => 1, 'role' => 'client', 'name' => 'Visitmaldives', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'remember_token' => str_random(10)]); factory(App\User::class, 20)->create(); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); App\User::truncate(); $this->call(UserTableSeeder::class); App\Carcompany::truncate(); $this->call(CarcompanyTableSeeder::class); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { // $this->call(UserTableSeeder::class); Model::unguard(); App\User::truncate(); App\Post::truncate(); // Comment::truncate(); factory(App\Post::class, 10)->create(); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); App\User::truncate(); $users = array(['name' => 'Ryan Chenkie', 'email' => '*****@*****.**', 'password' => Hash::make('secret')], ['name' => 'Chris Sevilleja', 'email' => '*****@*****.**', 'password' => Hash::make('secret')], ['name' => 'Holly Lloyd', 'email' => '*****@*****.**', 'password' => Hash::make('secret')], ['name' => 'Adnan Kukic', 'email' => '*****@*****.**', 'password' => Hash::make('secret')]); // Loop through each user above and create the record for them in the database foreach ($users as $user) { App\User::create($user); } // $this->call(UserTableSeeder::class); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); App\User::truncate(); App\Cart::truncate(); App\Product::truncate(); factory(App\Product::class, 10)->create(); factory(App\User::class, 10)->create()->each(function ($user) { $user->cart()->saveMany(factory(App\Cart::class, 2)->make()); }); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { //Truncate App\User::truncate(); //User生成 $user = new App\User(); $user->name = "user1"; $user->email = "*****@*****.**"; $user->password = Hash::make($user->name); $user->tel = "0312345678"; $user->address = "東京都港区六本木1-1-1"; $user->gender = 1; $user->status = 1; //Save $user->save(); }
public function run() { App\User::truncate(); factory(App\User::class, 20)->create(); }
public function run() { App\User::truncate(); $data = array(array('name' => 'Admin', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('admin'), 'profesi' => 'Admin'), array('name' => 'Pembudidaya', 'username' => 'pembudidaya', 'email' => '*****@*****.**', 'password' => bcrypt('pembudidaya'), 'profesi' => 'Admin'), array('name' => 'Nelayan', 'username' => 'nelayan', 'email' => '*****@*****.**', 'password' => bcrypt('nelayan'), 'profesi' => 'Admin'), array('name' => 'Pengolah', 'username' => 'pengolah', 'email' => '*****@*****.**', 'password' => bcrypt('pengolah'), 'profesi' => 'Admin'), array('name' => 'Pesisir', 'username' => 'pesisir', 'email' => '*****@*****.**', 'password' => bcrypt('pesisir'), 'profesi' => 'Admin'), array('name' => 'Blog', 'username' => 'blog', 'email' => '*****@*****.**', 'password' => bcrypt('blog'), 'profesi' => 'Admin')); DB::table('users')->insert($data); }
/** * Run the database seeds. * * @return void */ public function run() { /* * Prepare seeding */ $faker = Faker::create(); if (config('database.default') != 'sqlite') { DB::statement('SET FOREIGN_KEY_CHECKS=0'); } Model::unguard(); /* * Seeding users table */ App\User::truncate(); factory(App\User::class)->create(['name' => 'John Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password')]); factory(App\User::class, 9)->create(); $this->command->info('users table seeded'); /** * Seeding roles table */ Bican\Roles\Models\Role::truncate(); DB::table('role_user')->truncate(); $adminRole = Bican\Roles\Models\Role::create(['name' => 'Admin', 'slug' => 'admin']); $memberRole = Bican\Roles\Models\Role::create(['name' => 'Member', 'slug' => 'member']); App\User::where('email', '!=', '*****@*****.**')->get()->map(function ($user) use($memberRole) { $user->attachRole($memberRole); }); App\User::whereEmail('*****@*****.**')->get()->map(function ($user) use($adminRole) { $user->attachRole($adminRole); }); $this->command->info('roles table seeded'); /* * Seeding articles table */ App\Article::truncate(); $users = App\User::all(); $users->each(function ($user) use($faker) { $user->articles()->save(factory(App\Article::class)->make()); $user->articles()->save(factory(App\Article::class)->make()); }); $this->command->info('articles table seeded'); /** * Seeding comments table */ App\Comment::truncate(); $articles = App\Article::all(); $articles->each(function ($article) use($faker, $users) { $article->comments()->save(factory(App\Comment::class)->make(['author_id' => $faker->randomElement($users->lists('id')->toArray())])); }); $this->command->info('comments table seeded'); /* * Seeding tags table */ App\Tag::truncate(); DB::table('article_tag')->truncate(); $rawTags = ['General', 'Laravel', 'Lumen', 'Eloquent', 'Servers', 'Tips', 'Lesson Feedback']; foreach ($rawTags as $tag) { App\Tag::create(['name' => $tag, 'slug' => str_slug($tag)]); } $tags = App\Tag::all(); foreach ($articles as $article) { $article->tags()->attach($faker->randomElements($tags->lists('id')->toArray(), $faker->randomElement([1, 2, 3]))); } $this->command->info('tags table seeded'); /* * Seeding attachments table */ App\Attachment::truncate(); if (!File::isDirectory(attachment_path())) { File::deleteDirectory(attachment_path(), true); } $articles->each(function ($article) use($faker) { $article->attachments()->save(factory(App\Attachment::class)->make()); }); $files = App\Attachment::lists('name'); if (!File::isDirectory(attachment_path())) { File::makeDirectory(attachment_path(), 777, true); } foreach ($files as $file) { File::put(attachment_path($file), ''); } $this->command->info('attachments table seeded'); /** * Close seeding */ Model::reguard(); if (config('database.default') != 'sqlite') { DB::statement('SET FOREIGN_KEY_CHECKS=1'); } }
public function run() { App\User::truncate(); App\User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('password')]); App\User::create(['name' => 'guest', 'email' => '*****@*****.**', 'password' => bcrypt('guest')]); }