Answers for "insert update in laravel"

PHP
10

laravel update from query

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

update or create laravel

$user = User::updateOrCreate(['name' => request()->name], [ 
    'foo' => request()->foo
]);
Posted by: Guest on April-03-2020
0

create or update laravel

$user = User::updateOrCreate(['name' => request()->name], [ 
    'foo' => request()->foo
]);
Posted by: Guest on January-01-1970

Browse Popular Code Answers by Language