samedi 20 octobre 2018

Laravel Eloquent find and where return two different types?

When I use:

$myModel::find(1);

I'm completely fine using accessors, for example - that's because it returns an instance of the model?

And if I use

$myModel::where('foo', 'bar');

I can no longer access any accessors or model function, or even relationships on myModel Is that expected behavior and if it is - how should I execute a where query so I can keep using the model's relations?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire