Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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')
]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #updateorcreate #laravel
ADD COMMENT
Topic
Name
3+8 =