app/Http/Controllers/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, $id = 0)
    {
        $data = [
            'title' => $request->title,
            'description' => $request->description,
            'slug' => 'slug_name'
        ];
        $createOrUpdate = Category::updateOrCreate(['id' => $id], $data);
        return redirect('category');
    }
public function store ( Request $ request , $ id = 0 ) { $ data = [ 'title' => $ request -> title , 'description' => $ request -> description , 'slug' => 'slug_name' ] ; $ createOrUpdate = Category :: updateOrCreate ( [ 'id' => $ id ] , $ data ) ; return redirect ( 'category' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .