entity = $entity; } /** * @param string $host * @return IResourceServer */ public function getByHost($host) { if(!is_array($host)) $host = [$host]; return $this->entity->whereIn('host', $host)->first(); } /** * @param string $ip * @return IResourceServer */ public function getByIp($ip) { return $this->entity->where('ips', 'like', '%' . $ip . '%')->first(); } /** * @param array $audience * @param string $ip * @return IResourceServer */ public function getByAudienceAndIpAndActive(array $audience, $ip){ return $this->entity->where('ips','like', '%'.$ip.'%') ->where('active', '=', true) ->whereIn('host', $audience)->first(); } /** * @param string $name * @return IResourceServer */ public function getByFriendlyName($name) { return $this->entity->where('friendly_name', '=', $name)->first(); } }