“Laravel tem muitos profundos” Respostas de código

Laravel tem muitos profundos

class User extends Model {
    use \Staudenmeir\EloquentHasManyDeep\HasRelationships;

    public function cards() {
        return $this->hasManyDeep(Card::class, [Subject::class, Deck::class]);
    }
}
Thoughtful Tortoise

Laravel tem muitos profundos

$user->cards()->get();
Thoughtful Tortoise

Laravel tem muitos profundos

//App\User;

public function cards()
{
    Card::whereHas('decks', function($q){
         return $q->whereHas('subjects', function($q){
            return $q->where('user_id', $this->id);
        });
    });
}
Thoughtful Tortoise

Respostas semelhantes a “Laravel tem muitos profundos”

Perguntas semelhantes a “Laravel tem muitos profundos”

Mais respostas relacionadas para “Laravel tem muitos profundos” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código