Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel relation has 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
9+4 =