app/Http/Controllers/PostController.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()->validate([
            'title' => 'required',
            'content' => 'required'
        ]);
        Post::create([
            'title' => request('title'),
            'content' => request('content')
        ]);
        return redirect('/posts');
    }
public function store ( ) { request ( ) -> validate ( [ 'title' => 'required' , 'content' => 'required' ] ) ; Post :: create ( [ 'title' => request ( 'title' ) , 'content' => request ( 'content' ) ] ) ; return redirect ( '/posts' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//Validate - required fields  //Creates new post //then redirect to posts page