Created
March 30, 2015 14:58
-
-
Save juniorb2ss/d404371db58bfa29f573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = $users->where('id', Sentry::getUser()->id) | |
->whereHas('clientes', function($q){ | |
$q->where('cnpj', \Input::get('destinatario')); | |
$q->whereHas('configuracoes', function($q){ | |
# Apenas clientes que tenham certificado configurado | |
$q->whereNotNull('ambiente'); | |
$q->limit(1); | |
}); | |
$q->limit(1); | |
})->limit(1)->get(); | |
foreach ($user as $key) { | |
echo $key->id . PHP_EOL; | |
foreach ($key->clientes as $key) { | |
echo $key->nome; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment