Answers for "update in model laravel"

PHP
10

laravel updateOrCreate

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
Posted by: Guest on April-15-2020
5

laravel create model and migration

# If you would like to generate a database migration when you 
# generate the model, you may use the --migration or -m option:

php artisan make:model Flight --migration
php artisan make:model Flight -m
Posted by: Guest on April-22-2020
0

laravel model update table

ModelName::whereId($id)->update($request->all());
Posted by: Guest on August-02-2021
0

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