Back

please explain to me how this update code works


intsik posted 1 week ago

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')); }

Tobias van Beek replied 6 days ago

What do you understand and what not?

You can take a look in the documentation like:


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us