Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(AssayRequest $request)
 {
     $input = $request->all();
     $assay = new Assay($input);
     // If the new Assay is to be the default one
     if ($assay->default == 1) {
         // Set all others existing as not being default in database
         $assays = Assay::all();
         foreach ($assays as $ass) {
             $ass->default = 0;
             $ass->update();
         }
     }
     $assay->save();
     return redirect('assay/create');
 }