public function testShowNotMine()
 {
     $employee = \plunner\Employee::findOrFail(1);
     $calendar = \plunner\Calendar::where('employee_id', '<>', $employee->id)->firstOrFail();
     $response = $this->actingAs($employee)->json('GET', '/employees/calendars/' . $calendar->id);
     $response->seeStatusCode(403);
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $calendar = Calendar::findOrFail($id);
     $this->authorize($calendar);
     $calendar->delete();
     return $calendar;
 }
Esempio n. 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $calendarId
  * @param  int $timeslotId
  * @return \Illuminate\Http\Response
  */
 public function destroy($calendarId, $timeslotId)
 {
     //
     $calendar = Calendar::findOrFail($calendarId);
     $this->authorize($calendar);
     $timeslot = Timeslot::findOrFail($timeslotId);
     $this->authorize($timeslot);
     $timeslot->delete();
     return $timeslot;
 }