wip
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user