Skip to content

Commit

Permalink
Code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed May 18, 2024
1 parent 3052f46 commit 50d4e1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CartConditions/Delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public function getActions()

public function getValue()
{
return $this->calculatedValue > 0 ? $this->calculatedValue : lang('main::lang.text_free');
return $this->calculatedValue > 0 ? $this->calculatedValue : lang('igniter::main.text_free');
}
}
2 changes: 1 addition & 1 deletion src/Classes/CoveredAreaCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(array $condition = [])

public function getLabel()
{
$condition['amount'] = lang('main::lang.text_free');
$condition['amount'] = lang('igniter::main.text_free');
if ($this->amount < 0) {
$condition['amount'] = lang('igniter.local::default.text_delivery_not_available');
} elseif ($this->amount > 0) {
Expand Down
10 changes: 10 additions & 0 deletions src/Http/Middleware/CheckLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public function handle(Request $request, Closure $next)
$request->route()->setParameter('location', $location->permalink_slug);
}

if ($request->route()->parameter('location') !== Location::current()->permalink_slug) {

Check failure on line 32 in src/Http/Middleware/CheckLocation.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - Static Analysis

Cannot call method parameter() on object|string.

Check failure on line 32 in src/Http/Middleware/CheckLocation.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - Static Analysis

Ignored error pattern #^Call to an undefined static method Igniter\\Local\\Facades\\Location\:\:current\(\)\.$# in path /home/runner/work/ti-ext-local/ti-ext-local/src/Http/Middleware/CheckLocation.php is expected to occur 1 time, but occurred 2 times.
return redirect()->to(page_url('home'));
}

if ((!$location?->isEnabled() && !AdminAuth::getUser()?->hasPermission('Admin.Locations'))) {

Check failure on line 36 in src/Http/Middleware/CheckLocation.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - Static Analysis

Call to an undefined static method Igniter\User\Facades\AdminAuth::getUser().
flash()->error(lang('igniter.local::default.alert_location_required'));

return redirect()->to(page_url('home'));
}

return $next($request);
}

Expand Down

0 comments on commit 50d4e1c

Please sign in to comment.