app\models\Contact::user PHP Method

user() public method

public user ( ) : mixed
return mixed
    public function user()
    {
        return $this->belongsTo('App\\Models\\User')->withTrashed();
    }

Usage Example

コード例 #1
0
ファイル: ContactService.php プロジェクト: kdh4242/timegrid
 /**
  * Associate Contact with User.
  *
  * @param Contact $contact
  * @param User    $user
  *
  * @return App\Models\Contact
  */
 public function linkToUser(Contact $contact, User $user)
 {
     $contact->user()->associate($user->id);
     $contact->save();
     return $contact->fresh();
 }