Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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 = AppFlight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
Comment

updateorcreate laravel

$newUser = AppUserInfo::updateOrCreate([
    //Add unique field combo to match here
    //For example, perhaps you only want one entry per user:
    'user_id'   => Auth::user()->id,
],[
    'about'     => $request->get('about'),
    'sec_email' => $request->get('sec_email'),
    'gender'    => $request->get("gender"),
    'country'   => $request->get('country'),
    'dob'       => $request->get('dob'),
    'address'   => $request->get('address'),
    'mobile'    => $request->get('cell_no')
]);
Comment

laravel documentation updateOrCreate

Flight::upsert([
    ['departure' => 'Oakland', 'destination' => 'San Diego', 'price' => 99],
    ['departure' => 'Chicago', 'destination' => 'New York', 'price' => 150]
], ['departure', 'destination'], ['price']);
Comment

PREVIOUS NEXT
Code Example
:: php slice array by key 
::  
::  
::  
::  
::  
::  
Php ::  
::  
::  
Javascript ::  
::  
::  
::  
::  
::  
::  
::  
Javascript ::  
::  
Javascript ::  
::  
::  
::  
::  
::  
::  
::  
Javascript ::  
::  
ADD CONTENT
Topic
Content
Source link
Name
8+9 =