Skip to content

Commit

Permalink
Minor fix for location aware resources
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Aug 28, 2022
1 parent 174f927 commit 29c60f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions apiresources/Reservations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 4 additions & 4 deletions classes/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 29c60f0

Please sign in to comment.