Привет. У меня есть такой метод в модели юзера. Который проверяет или это простой юзер. Я могу как-то в query вставить это метод? Типа получить все заказы юзера где simpleUser() ? Может через map?
типа
public function scopeSystemUser($query){ return $query->whereIn('role', [])->where('(select count(*) from users as childs where childs.parent_id = users.id)') }
public function scopeSystemUser($query){ return $query->whereIn('role', [])->where('(select count(*) from users as childs where childs.parent_id = users.id)') }
ну вот первый косяк public function scopeSystemUser($query){ return $query->whereIn('role', [])->where('(select count(*) from users as childs where childs.parent_id = users.id) =0') }