app/Http/Controllers/Admin/TagController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $request->validate([
            'title' => 'required|max:50|unique:tags,title,'.$id,
        ]);
        $data = Tag::find($id);
        $data->title = $request->title;
        $data->slug = str_slug($request->title, '-');
        $data->status = $request->status;
        $data->updated_by = Auth::user()->id;
        $data->save();
        Toastr::success($this->title.' Updated Successfully!', 'success');
        return redirect()->back();
    }
public function update ( Request $ request , $ id ) { $ request -> validate ( [ 'title' => 'required|max:50|unique:tags,title,' . $ id , ] ) ; $ data = Tag :: find ( $ id ) ; $ data -> title = $ request -> title ; $ data -> slug = str_slug ( $ request -> title , '-' ) ; $ data -> status = $ request -> status ; $ data -> updated_by = Auth :: user ( ) -> id ; $ data -> save ( ) ; Toastr :: success ( $ this -> title . ' Updated Successfully!' , 'success' ) ; return redirect ( ) -> back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// Field Validation // Update Data