/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $faker = Faker\Factory::create(); $departments = Department::all(); foreach (range(1, 40) as $index) { $title = $faker->name(); $slug = (new Slugify())->slugify($title); Employee::create(['title' => $title, 'slug' => $slug, 'position' => $faker->sentence(2), 'email' => $faker->email, 'telephone' => $faker->phoneNumber, 'description' => $faker->paragraph(5), 'department_id' => $departments->random(1)->id]); } Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $faker = Faker\Factory::create(); $slugify = new Slugify(); Department::create(['title' => 'Digital Services', 'slug' => $slugify->slugify('Digital Services'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Creative Services', 'slug' => $slugify->slugify('Creative Services'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Account Management', 'slug' => $slugify->slugify('Account Management'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Business Development and Consultancy', 'slug' => $slugify->slugify('Business Development and Consultancy'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Finance', 'slug' => $slugify->slugify('Finance'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Management', 'slug' => $slugify->slugify('Finance'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); Department::create(['title' => 'Mystery Shopping', 'slug' => $slugify->slugify('Mystery Shopping'), 'description' => $faker->text, 'image' => $faker->imageUrl($width = 360, $height = 360)]); }
/** * @return mixed */ private function getDepartmentList() { $departments = Department::orderBy('title')->lists('title', 'id'); return $departments; }