/**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $parent_rules = parent::rules();
     $estadio = Estadio::findOrFail($this->route->getParameter('estadios'));
     $my_rules = array('nombre' => ['required', 'min:3', 'unique:estadios,nombre,' . $estadio->id]);
     $rules = array_merge($parent_rules, $my_rules);
     return $rules;
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $estadio = Estadio::findOrFail($id);
     $result["result"] = "Error";
     if ($estadio->delete()) {
         $result["result"] = "Ok";
         $result["response"] = ["id" => $id];
         return response()->json($result);
     }
     Session::flash('message', 'Se elimino el estadio ' . $estadio->full_name);
     return Response::json($result, 500);
     // Status code here
 }