Answers for "how get data if has relation in laravel"

PHP
4

laravel relation has one

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

// User controller
$phone = User::find(1)->phone;
Posted by: Guest on May-11-2021
0

how get data if has relation in laravel

Doctor::has('DoctorMessage')->with('DoctorMessage')->get()
Posted by: Guest on August-28-2021

Code answers related to "how get data if has relation in laravel"

Browse Popular Code Answers by Language