diff --git a/apiresources/Reservations.php b/apiresources/Reservations.php index 2635a58..2138ff4 100644 --- a/apiresources/Reservations.php +++ b/apiresources/Reservations.php @@ -27,12 +27,4 @@ class Reservations extends ApiController ]; protected $requiredAbilities = ['reservations:*']; - - public function restExtendQuery($query) - { - if (($token = $this->getToken()) && $token->isForCustomer()) - $query->where('customer_id', $token->tokenable_id); - - return $query; - } } diff --git a/classes/AbstractRepository.php b/classes/AbstractRepository.php index 50831d5..12028ed 100644 --- a/classes/AbstractRepository.php +++ b/classes/AbstractRepository.php @@ -228,9 +228,9 @@ protected function prepareQuery($model) $this->applyScopes($query); - $this->applyLocationAwareScopes($query); + $this->applyLocationAwareScope($query); - $this->applyCustomerAwareScopes($query); + $this->applyCustomerAwareScope($query); $this->extendQuery($query); @@ -267,7 +267,7 @@ protected function setModelAttributes($model, $saveData) } } - protected function applyLocationAwareScope($query, array $config) + protected function applyLocationAwareScope($query) { if (!is_array($config = static::$locationAwareConfig)) return; @@ -287,7 +287,7 @@ protected function applyLocationAwareScope($query, array $config) : $query->whereHasLocation($ids); } - protected function applyCustomerAwareScope($query, array $config) + protected function applyCustomerAwareScope($query) { if (!is_array($config = static::$customerAwareConfig)) return;