public static function apiQuery() { $query = self::query(); if (Auth::user()->isPublisherAdmin() || Auth::user()->isPublisher()) { $query->where('company_id', "=", Auth::user()["company_id"]); } if (Auth::user()->isPayee()) { $query->where(Deal::table() . ".payee_code", '=', Auth::user()["code"]); } return $query; }