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)
    {
        $request->validate([
            'video_id' => 'required',
            'name' => 'required|max:250',
            'email' => 'required|max:250',
            'comment' => 'required',
        ]);
        $data = new Comment;
        $data->video_id = $request->video_id;
        $data->name = $request->name;
        $data->email = $request->email;
        $data->comment = $request->comment;
        $data->status = 1;
        $data->save();
        Toastr::success('Comment Posted!', 'success');
        return redirect()->back();
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'video_id' => 'required' , 'name' => 'required|max:250' , 'email' => 'required|max:250' , 'comment' => 'required' , ] ) ; $ data = new Comment ; $ data -> video_id = $ request -> video_id ; $ data -> name = $ request -> name ; $ data -> email = $ request -> email ; $ data -> comment = $ request -> comment ; $ data -> status = 1 ; $ data -> save ( ) ; Toastr :: success ( 'Comment Posted!' , 'success' ) ; return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Field Validation // Insert Data