app/Http/Controllers/PagesController.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)
    {
        $validator = Validator::make( $request->all(), [
            'name'=>'required',
            'email'=>'required|email',
        ]);
        if ($validator->fails() ){
            return back()
                ->withErrors( $validator )
                ->withInput();
        }
        DB::table('messages')
            ->insert( $request->except('_token') );
        return redirect()->back()
            ->with('message','Success!');
    }
public function store ( Request $ request ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'name' => 'required' , 'email' => 'required|email' , ] ) ; if ( $ validator -> fails ( ) ) { return back ( ) -> withErrors ( $ validator ) -> withInput ( ) ; } DB :: table ( 'messages' ) -> insert ( $ request -> except ( '_token' ) ) ; return redirect ( ) -> back ( ) -> with ( 'message' , 'Success!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// dd( \Request::all() ); //        dd( $request->all() ); // dd( \Request::input('message') ); // dd( \Request::exists('email') );