app/Http/Controllers/Admin/CategoryController.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)
    {
        $user = auth()->user();
        $new_category = new PostsCategory();
        $new_category->title = $request->title;
        $new_category->alias = $request->alias;
        $new_category->parent_id = $request->parent_id ?? 0;
        $new_category->user_id = $user->id;
        $new_category->short_description = $request->short_description;
        $new_category->save();
        return redirect()->back()->withSuccess('Категория была успешно добавлена');
    }
public function store ( Request $ request ) { $ user = auth ( ) -> user ( ) ; $ new_category = new PostsCategory ( ) ; $ new_category -> title = $ request -> title ; $ new_category -> alias = $ request -> alias ; $ new_category -> parent_id = $ request -> parent_id ?? 0 ; $ new_category -> user_id = $ user -> id ; $ new_category -> short_description = $ request -> short_description ; $ new_category -> save ( ) ; return redirect ( ) -> back ( ) -> withSuccess ( 'Категория была успешно добавлена'); }
Store a newly created resource in storage.
Store a newly created resource in storage .