app/Http/Controllers/Admin/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 $request)
    {
        $request->validate([
            'title'=>'required',
            'content'=>'required',
        ]);
        $post = new Post();
        $post->title =  $request->title;
        $post->content =  $request->content;
        $post->save();
        return redirect()->route('post')->with('success','Đăng bài thành công!');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'title' => 'required' , 'content' => 'required' , ] ) ; $ post = new Post ( ) ; $ post -> title = $ request -> title ; $ post -> content = $ request -> content ; $ post -> save ( ) ; return redirect ( ) -> route ( 'post' ) -> with ( 'success' , 'Đăng bài thành công!'); }
Store a newly created resource in storage.
Store a newly created resource in storage .