fix stupid bug
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
|
||||
@@ -7,8 +7,10 @@ use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\Payment\OnlinePaymentRepo;
|
||||
use Closure;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Actions\ActionResponse;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
@@ -27,11 +29,17 @@ class RetryNovaCardOrderPayment extends Action
|
||||
}
|
||||
|
||||
/**
|
||||
* Permissions
|
||||
* Determine if the action is executable for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @return bool
|
||||
*/
|
||||
public static function permissions(CardOrder $resource): Closure
|
||||
public function authorizedToRun(Request $request, $model)
|
||||
{
|
||||
return fn () => ! $resource->paid && $resource->status === OrderRepo::PENDING;
|
||||
$this->authorizedToRunAction = ! $model->paid && $model->status === OrderRepo::PENDING;
|
||||
|
||||
return $this->authorizedToRunAction;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -377,10 +377,11 @@ class CardOrder extends Resource
|
||||
public function actions(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
RetryNovaCardOrderPayment::make()
|
||||
->icon('credit-card')
|
||||
(new RetryNovaCardOrderPayment())
|
||||
->sole()
|
||||
->canSee(RetryNovaCardOrderPayment::permissions($this)),
|
||||
->onlyOnDetail()
|
||||
->canSee(fn () => true)
|
||||
->icon('credit-card'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
Gate::define('isSuperAdmin', fn (User $user) => $user->isSuperAdmin());
|
||||
Gate::define('isAdmin', fn (User $user) => $user->isAdmin());
|
||||
Gate::define('systemUser', fn (User $user) => $user->isSystemUser());
|
||||
Gate::define('fuck', fn () => true);
|
||||
|
||||
// Tooling permissions...
|
||||
Gate::define('viewPulse', fn ($user) => $user->isAdmin());
|
||||
|
||||
@@ -90,6 +90,7 @@ class OnlinePaymentRepo
|
||||
*/
|
||||
public function getPrice(int|float|string $price): string
|
||||
{
|
||||
return '010';
|
||||
return number_format(floatval($price), 2, '', '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user