示例#1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cr = Classroom::find(8);
     /*  DB::table('classroom_matter_teacher')->insert([
                'classroom_id'=> 8,
                 'matter_id' => 12,
                 'teacher_id' => 3
     
             ]);
             foreach($cr->teachers as $mat)
             {
                 dd($mat->nom_teacher);
             }*/
     return view('educators.index');
 }
 public function destroy($id)
 {
     $classrooms = Classroom::find($id);
     $classrooms->delete();
     return response()->json(['id' => $id]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Request $request, $id)
 {
     $item = Classroom::find($id);
     if ($request->ajax()) {
         $list = Input::get('id');
         return $this->edit_ajax($list, $item);
     }
     if ($item == null) {
         return Redirect::to(URL::to('datatables', ['salones', 'see']))->with('error', 'id-nn');
     }
     $item->location = explode(' - ', $item->location)[1];
     return view('classroom.createdit', compact('item'));
 }