Esempio n. 1
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;
 }
 public function testShowNotMine()
 {
     $employee = \plunner\Employee::findOrFail(1);
     $calendar = $employee->Calendars()->firstOrFail();
     $timeslot = \plunner\Timeslot::whereNotIn('calendar_id', $employee->calendars()->get()->pluck('id'))->firstOrFail();
     $response = $this->actingAs($employee)->json('GET', '/employees/calendars/' . $calendar->id . '/timeslots/' . $timeslot->id);
     $response->seeStatusCode(403);
 }