Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel find or create new

$user = User::firstOrCreate(
    ['email' =>  request('email')],
    ['name' => request('name')]
);
 
// No call to $user->save() needed
Source by laravel-news.com #
 
PREVIOUS NEXT
Tagged: #laravel #find #create
ADD COMMENT
Topic
Name
2+9 =