/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('users')->delete(); User::create(['name' => 'Burim Shala', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'admin' => true]); User::create(['name' => 'Kushtrim Morina', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'admin' => true]); User::create(['name' => 'Drila', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'admin' => true]); Model::reguard(); }
/** * @param $id * @param Request $request * @return array */ private function guardCollaboratorsWithLists($id, Request $request) { $collaborator = $this->user->find($request->get('collaborator')); $list = $this->list->find($id); if (!$collaborator || !$list) { abort(403, 'Collaborator or List does not exits'); } if (Gate::denies('manage-lists', $list)) { abort(403, 'You dont have permissions!!'); } return array($collaborator, $list); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('lists')->delete(); DB::table('todos')->delete(); $burimi = User::find(1); $kiqa = User::find(2); $drila = User::find(3); //new list $list = ListModel::create(['name' => 'Shopping List']); $list->collaborators()->attach($burimi); $list->collaborators()->attach($kiqa); $list->collaborators()->attach($drila); //new list $list = ListModel::create(['name' => 'Lessons']); //new list $list->collaborators()->attach($burimi); $list->collaborators()->attach($kiqa); $list->todos()->create(['name' => 'Upgrade server']); $list->todos()->create(['name' => 'Install patches', 'user_id' => $kiqa->id, 'deadline' => Carbon::now()]); $list->todos()->create(['name' => 'Remove old data', 'finished' => 1]); ListModel::create(['name' => 'Mix']); Model::reguard(); }
public function delete(User $user) { return $user->delete(); }