예제 #1
0
 public function assign_stream(Requests\AssignStreamRequest $request)
 {
     $stream = Stream::find($request->stream_id);
     $year = date('Y');
     if ($stream) {
         $status = 1;
         //update the student table to reflect that the student has been attached to class
         $student = Student::find($request->learner_id);
         $student->status = $status;
         $student->save();
         $student->streams()->attach($request->stream_id, array('year' => $year));
         //inserts the tables
         return Redirect::back()->with('message', 'Learner assigned succesfully');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $stm = Stream::find($id);
         $stm->delete();
         \Session::flash('sucess_message', 'Stream sucessfully DELETED');
     } catch (\Exception $e) {
         \Session::flash('error_message', 'Stream could not DELETED');
     }
     return redirect('myAdmin/streams');
 }