/** * Run the database seeds. * * @return void */ public function run() { $skills = Skill::lists('id'); $last = count($skills) - 1; $faker = new Faker\Generator(); for ($i = 0; $i < 1; $i++) { $certificate = Certificate::create(['title' => 'PHP Master', 'length' => '300 hours', 'certified_by' => 'My Friend']); if (count($skills)) { $certificate->skills()->attach($skills[rand(0, $last)]); } } }
/** * Run the database seeds. * * @return void */ public function run() { $skills = Skill::lists('id'); $last = count($skills) - 1; $resume = Resume::first(); for ($i = 0; $i < 1; $i++) { $certificate = $resume->certificates()->create(['title' => 'PHP Master', 'length' => '300 hours', 'certified_by' => 'My Friend']); if (count($skills)) { $certificate->skills()->attach($skills[rand(0, $last)]); } } }
/** * @param CertificateService $certificateService * @param Skill $skill */ public function __construct(CertificateService $certificateService, Skill $skill) { $this->skills_list = $skill->lists('name', 'id'); $this->certificateService = $certificateService; $this->certificates = Auth::user()->resume->certificates(); }