Skip to content

Instantly share code, notes, and snippets.

@raank
Created October 18, 2016 07:25
Show Gist options
  • Save raank/559ff0a64e6596bf8c88a66eab9d1a21 to your computer and use it in GitHub Desktop.
Save raank/559ff0a64e6596bf8c88a66eab9d1a21 to your computer and use it in GitHub Desktop.
<?php
class DadosAnuncios {
public function index()
{
$confirmeds = Anuncios::where('confirmed', true)->get();
foreach($confirmeds as $items) {
if( $items['genero'] == 'masc') {
$masc[] = $items;
} else {
$fem[] = $items;
}
}
return [
'confirmeds' => $confirmeds->count(),
'masc' => (isset($masc) ? count($masc) : 0),
'fem' => (isset($fem) ? count($fem) : 0)
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment