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->input('name');
    $category->save();
    return back()->with('success', 'Kategorija dodana');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required' , ] ) ; $ category = new Category ; $ category -> name = $ request -> input ( 'name' ) ; $ category -> save ( ) ; return back ( ) -> with ( 'success' , 'Kategorija dodana' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .