Skip to content

Instantly share code, notes, and snippets.

@juniorb2ss
Created March 30, 2015 14:58
Show Gist options
  • Save juniorb2ss/d404371db58bfa29f573 to your computer and use it in GitHub Desktop.
Save juniorb2ss/d404371db58bfa29f573 to your computer and use it in GitHub Desktop.
$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