/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Request $request, $id) { $data = $request->all(); $teacherWhitPeriod = \App\RegistryTeacher::findOrFail($data['id']); $teacherWhitPeriod->delete(); if ($request->ajax()) { return response()->json(['status' => true, 'data' => 'Was removed successful']); } }
public function getRegistryPeriods() { //dd(); $periods = \App\RegistryTeacher::Join('periods', 'periods.id', '=', 'registry_teachers.id_period')->select('registry_teachers.id as id_registry_teacher', 'periods.id', 'periods.name', 'periods.start', 'periods.end')->Where('id_teacher', $this->user->id)->orderBy('periods.end', 'desc')->get(); return $periods; }