app/Http/Controllers/Blog/Admin/CategoryController.php
/**
     * Store a newly created resource in storage.
     *
     * @param BlogCategoryCreateRequest $request
     * @return Response
     */
Store a newly created resource in storage.
@param BlogCategoryCreateRequest $request
@return Response
Store a newly created resource in storage . @param BlogCategoryCreateRequest $request @return Response
public function store(BlogCategoryCreateRequest $request)
    {
        $data = $request->input();
        $item = (new BlogCategory())->create($data);
        if($item){
            return redirect()
                ->route('blog.admin.categories.edit', [$item->id])
                ->with(['success' => 'saved']);
        }else{
            return back()
                ->withErrors(['msg' => 'Save error'])
                ->withInput();
        }
    }
public function store ( BlogCategoryCreateRequest $ request ) { $ data = $ request -> input ( ) ; $ item = ( new BlogCategory ( ) ) -> create ( $ data ) ; if ( $ item ) { return redirect ( ) -> route ( 'blog.admin.categories.edit' , [ $ item -> id ] ) -> with ( [ 'success' => 'saved' ] ) ; } else { return back ( ) -> withErrors ( [ 'msg' => 'Save error' ] ) -> withInput ( ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
//        if (($data['slug']) == null){ //           $data['slug'] = Str::slug($data['title']); //            dd("Ты не туда залез"); //        } //        $item = new BlogCategory($data); //        $item->save();