Why my update code is not working?

Posted 3 weeks ago by mohammadbasir

Here is my code. Why not working?

public function editCategory(Request $request,$id = null){

    if($request->isMethod('post')){
        $data = $request->all();
        Category::where(['id'=>$id])->update(['name'=>$data['category_name'],
            'description'=>$data['description'],'url'=>$data['url']]);
        return redirect('/admin/view-categories')->with('flash_message_success','Category Updated Successfully');
    }

    $categoryDetails = Category::where(['id'=>$id])->first(); 
return view('admin.categories.edit_category')->with(compact('categoryDetails')); }

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.