mardi 5 janvier 2016

Laravel: detect if nested relations are loaded

In Laravel we can load model with nested relations

User::with('posts.comments.likes')

But how in other place we can detect if nested relations are loaded? Is there a method?

Model::relationLoaded() detect only direct relation.

public function relationLoaded($key)
{
    return array_key_exists($key, $this->relations);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire