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)
    {
        $this->validate($request,[
            'name' => 'required|min:3|max:50|unique:categories',
            'status' => 'required',
     ]);
     Category::create([
        'name' => $request->name,
        'slug' => slugify($request->name),
        'status' => $request->status,
     ]);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|min:3|max:50|unique:categories' , 'status' => 'required' , ] ) ; Category :: create ( [ 'name' => $ request -> name , 'slug' => slugify ( $ request -> name ) , 'status' => $ request -> status , ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//Check Validation //Insert database