Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel relation one to one

// User model
public function phone()
{
  return $this->hasOne(Phone::class);
}

// User controller
$phone = User::find(1)->phone;
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #relation
ADD COMMENT
Topic
Name
7+3 =