app/Http/Controllers/CategoriesController.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, [
            'name' => 'required'
        ]);
        $category = new Category;
        $category->name = $request->name;
        $category->save();
        Session::flash('success', 'You successfully created the category');
        return redirect()->route('categories');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required' ] ) ; $ category = new Category ; $ category -> name = $ request -> name ; $ category -> save ( ) ; Session :: flash ( 'success' , 'You successfully created the category' ) ; return redirect ( ) -> route ( 'categories' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .