laravel save() returns error Call to undefined method stdClass::save()

Why does save() returns an error "Call to undefined method stdClass::save()" below :

public function update($category,$route)
{
$category = DB::table('categories')->where('id', $category)->first();
$category->field = 'changed';
$category->save();
...

and works fine here :

public function store()
{
...
$category = new Category(request(array_column($table->fields, 'name')));
$category->save();

What do I miss?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iXyIZH
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

BlueHost Web Hosting Review: Secrets Revealed for Shared Hosting

How to Create Treeview with Bootstrap and jQuery

Submit Form using jQuery AJAX and PHP without Page Refresh