/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); User::truncate(); Project::truncate(); \Portfolio\Media::truncate(); $this->call('projects_seeder'); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { $repo = new \Portfolio\Repositories\MediaRepository(); $projects = json_decode(file_get_contents(base_path() . '/json-data/projects.json')); $user = User::where('email', '*****@*****.**')->first(); foreach ($projects as $project) { $tags = implode(',', $project->cat); $proj = Project::create(["name" => $project->name, "url" => $project->link, "author" => 0, "tags" => $tags]); $image = $repo->upload(['file_url' => 'https://www.joelpodrebarac.me/img/logos/' . $project->image, 'scope' => 'project', 'scope_id' => $proj->id], null); } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }