vendredi 29 septembre 2017

Testing Laravel Eloquent Relationship

I'd like to know what's the best approach to ensure that my Activity model belongs to a User.

Activity.php

...

public function user()
{
   return $this->belongsTo(User::class);
}

How can I write a test that ensure that the Activity model has that relationship?

Aucun commentaire:

Enregistrer un commentaire