Exemplo n.º 1
0
 public function update(Request $request, $id)
 {
     $assessment = Assessment::find($id);
     if (is_null($assessment)) {
         return redirect()->back()->with('status', 'Missing Reference');
     }
     $inquiry_id = $assessment->inquiry_id;
     $chks = array('eie', 'dss');
     foreach ($chks as $chk) {
         $assessment->setAttribute($chk, Input::has($chk) ? true : false);
     }
     //$assessment->fname = $request->input('fname');
     //$assessment->lname = $request->input('lname');
     //$assessment->sfname = $sfname;
     //$assessment->slname = $slname;
     //$assessment->datedoc = $datedoc;
     //$assessment->staff_id = $staff_id;
     $assessment->result = $request->input('result');
     //=== this section checks for ids ====
     //      $inquiry_id = $request->input('inquiry_id');
     //      $client_id = $request->input('client_id');
     //      $episode_id = $request->input('episode_id');
     //
     //          $looper = 0;
     //        $vals = array($inquiry_id,$client_id,$episode_id);
     //      $flds = array('inquiry_id','client_id','episode_id');
     //    foreach ($flds as $fld) {
     //      $assessment->setAttribute($fld, (Input::has($fld)) ? $vals[$looper] : '0');
     //          $looper++;
     //    }
     //=======================
     //    $morechks = array('eie','dss');
     //      foreach ($morechks as $morechk) {
     //          $assessment->setAttribute($morechk, (Input::has($morechk)) ? true : false);
     //      }
     $assessment->save();
     return redirect()->route('inquiryview', $inquiry_id);
 }
Exemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $assessment = Assessment::find($id);
     if (Gate::denies('delete-assessment', $assessment)) {
         abort(403);
     }
     $exec = $assessment->delete();
     if ($exec) {
         return response()->json(["status" => "success"]);
     }
 }