public function scopeCountNotesIndexPage() {
$obj = Note::where('status', 'active');
$req = [
'kup_dom' => [
'obj' => $obj,
'what' => 'дом',
'deal' => 'куп'
],
'snat_dom' => [
'obj' => $obj,
'what' => 'дом',
'deal' => 'сниму'
],
'prodat_dom' => [
'obj' => $obj,
'what' => 'дом',
'deal' => 'пр'
]
];
foreach ($req as $r) {
$data[] = $this->sss($r['obj'],$r['what'],$r['deal']) ;
}
return $data;
}
private function sss($obj,$what,$deal) {
var_dump($obj->count());
return $data=$obj->where('what',$what)->where('deal',$deal)->count();
}