Skip to content

Instantly share code, notes, and snippets.

@mtigdemir
Created November 27, 2014 13:43
Show Gist options
  • Save mtigdemir/b79f1db9354c6ab341e1 to your computer and use it in GitHub Desktop.
Save mtigdemir/b79f1db9354c6ab341e1 to your computer and use it in GitHub Desktop.
Laravel One to One Create
$user = User::find(10);
$profile = $user->UserProfile ?: new UserProfile;
$profile->name = 'Steven';
$user->UserProfile()->save($profile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment