app/Http/Controllers/PostsController.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)
    {
        $this->validate($request,[
            'title' => 'required',
            'body' => 'required'
        ]);
        $post = new Post;
        $post->title = $request->input('title');
        $post->body = $request->input('body');
        $post->save();
        return redirect('/post')->with('success', 'Account Created');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'title' => 'required' , 'body' => 'required' ] ) ; $ post = new Post ; $ post -> title = $ request -> input ( 'title' ) ; $ post -> body = $ request -> input ( 'body' ) ; $ post -> save ( ) ; return redirect ( '/post' ) -> with ( 'success' , 'Account Created' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//CREATE POST