Answers for "eloquent update model"

PHP
1

laravel model update table

$post = Post::find(3);
$post->title = "Updated title";
$post->save();


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

laravel model update table

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

laravel find query

foreach (Flight::where('foo', 'bar')->cursor() as $flight) {
    //
}
Posted by: Guest on October-08-2020

Browse Popular Code Answers by Language