This commit is contained in:
2025-04-23 11:43:04 +05:00
parent 204b302768
commit 2a22ad31bb
2 changed files with 15 additions and 3 deletions

View File

@@ -17,6 +17,15 @@ class CheckOnlinePaymentStatus extends Action
{
use InteractsWithQueue, Queueable;
/**
* @property string $paymantable_type Payment Related Class
*/
public function __construct(
protected string $paymantable_type,
) {
// ...
}
/**
* Perform the action on the given models.
*
@@ -26,11 +35,10 @@ class CheckOnlinePaymentStatus extends Action
*/
public function handle(ActionFields $fields, Collection $models)
{
/** @var \App\Models\Order\Card\CardOrder $item */
$item = $models->first();
$onlinePaymentResource = OnlinePaymentHistory::query()
->where('online_paymantable_type', 'App\Models\Order\Card\CardOrder')
->where('online_paymantable_type', $this->paymantable_type)
->where('online_paymantable_id', $item->id)
->first();

View File

@@ -26,6 +26,7 @@ use App\Rules\OnlyLetters;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Gate;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\Hidden;
use Laravel\Nova\Fields\ID;
@@ -192,6 +193,9 @@ class CardOrder extends Resource
->default(auth()->id())
->hideWhenUpdating(),
Boolean::make(__('Paid'), 'paid')
->canSeeWhen('isSuperAdmin', $this),
Select::make(__('Status'), 'status')
->displayUsingLabels()
->searchable()
@@ -384,7 +388,7 @@ class CardOrder extends Resource
->canSee(fn () => true)
->icon('credit-card'),
(new CheckOnlinePaymentStatus())
(new CheckOnlinePaymentStatus('App\Models\Order\Card\CardOrder'))
->sole()
->withoutConfirmation()
->icon('server'),