app/Http/Controllers/CategoryController.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)
    {
        $this->validate($request,[
            'name'       =>'required'
        ],[
            'name.required' =>'Category name required'
        ]);
        $cat = Category::find($id);
        $cat->name = $request->input('name');
        $cat->parent = trim($request->input('parent'));
        $cat->description = $request->input('description');
        $cat->user_id = Auth::user()->id;
        $cat->save();
        return redirect()->back();
    }
public function update ( Request $ request , $ id ) { $ this -> validate ( $ request , [ 'name' => 'required' ] , [ 'name.required' => 'Category name required' ] ) ; $ cat = Category :: find ( $ id ) ; $ cat -> name = $ request -> input ( 'name' ) ; $ cat -> parent = trim ( $ request -> input ( 'parent' ) ) ; $ cat -> description = $ request -> input ( 'description' ) ; $ cat -> user_id = Auth :: user ( ) -> id ; $ cat -> save ( ) ; return redirect ( ) -> back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .