app/Http/Controllers/CommentController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $rules = array(
            'message' => 'required|string|min:2|max:200',
    );        
        $this->validate($request, $rules);
        Comment::create([
            'message' => $request->message,
            'recipe_id'=> $request->recipe_id,
            'user_id'=> Auth::User()->id,
        ]);
        return redirect()->action('RecipeController@show', $request->recipe_id);
    }
public function store ( Request $ request ) { $ rules = array ( 'message' => 'required|string|min:2|max:200' , ) ; $ this -> validate ( $ request , $ rules ) ; Comment :: create ( [ 'message' => $ request -> message , 'recipe_id' => $ request -> recipe_id , 'user_id' => Auth :: User ( ) -> id , ] ) ; return redirect ( ) -> action ( 'RecipeController@show' , $ request -> recipe_id ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .