Database Eloquent ORM Updating

use App\Models\Post;

/*
|--------------------------------------------------------------------------
| ELOQUENT ORM (Object Relational Model)
|--------------------------------------------------------------------------
*/

Route::get('/update', function(){
    Post::where('id',2)->where('is_admin',0)->update(['title'=>'NEW PHP TITLE','content'=>'More content']);
});

Second way of updating. First way uses same method as inserting.

Leave a Reply

Your email address will not be published. Required fields are marked *