app/Http/Controllers/Admin/TagController.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)
    {
        $request->validate([
            'title' => 'required|max:50|unique:tags,title',
        ]);
        $data = new Tag;
        $data->title = $request->title;
        $data->slug = str_slug($request->title, '-');
        $data->status = 1;
        $data->created_by = Auth::user()->id;
        $data->save();
        Toastr::success($this->title.' Created Successfully!', 'success');
        return redirect()->back();
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'title' => 'required|max:50|unique:tags,title' , ] ) ; $ data = new Tag ; $ data -> title = $ request -> title ; $ data -> slug = str_slug ( $ request -> title , '-' ) ; $ data -> status = 1 ; $ data -> created_by = Auth :: user ( ) -> id ; $ data -> save ( ) ; Toastr :: success ( $ this -> title . ' Created Successfully!' , 'success' ) ; return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Field Validation // Insert Data