Answers for "laravel 8 if create or update"

C#
9

create or update in laaravel

//if there is id => 1 for user role , update this and if there is not 
//id => 1 create it and insert some data for it
 $data = $request->all();
   UserRule::updateOrCreate(
            ['id' => 1],
            $data
        );
Posted by: Guest on March-17-2021
1

laravel update if exists or create

$flight = AppFlight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99]
);
Posted by: Guest on June-20-2021

Code answers related to "laravel 8 if create or update"

C# Answers by Framework

Browse Popular Code Answers by Language