Answers for "laravel update a record on a model"

PHP
19

laravel update from query

$affected = DB::table('users')
              ->where('id', 1)
              ->update(['votes' => 1]);
Posted by: Guest on May-07-2020
1

laravel model update table

Post::where('id',3)->update(['title'=>'Updated title']);
Posted by: Guest on October-01-2021

Browse Popular Code Answers by Language