app/Http/Controllers/CategoriesController.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)	
    {	
        if(auth()->user()->isAdmin()){	
            $this->validate($request,[	
                'categ_name'=>'required'	
            ]);	
            $category = Category::find($id);	
            if($category === null) abort(404);	
            $category->name = $request->input('categ_name');	
            $category->save();	
            return redirect('/');	
        }	
        else abort(404);
    }
public function update ( Request $ request , $ id ) { if ( auth ( ) -> user ( ) -> isAdmin ( ) ) { $ this -> validate ( $ request , [ 'categ_name' => 'required' ] ) ; $ category = Category :: find ( $ id ) ; if ( $ category === null ) abort ( 404 ) ; $ category -> name = $ request -> input ( 'categ_name' ) ; $ category -> save ( ) ; return redirect ( '/' ) ; } else abort ( 404 ) ; }
Update the specified resource in storage.
Update the specified resource in storage .