Exemplo n.º 1
0
 /**
  * @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);
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
 public function byId($id)
 {
     return User::find($id);
 }