wip
This commit is contained in:
@@ -17,6 +17,15 @@ class CheckOnlinePaymentStatus extends Action
|
|||||||
{
|
{
|
||||||
use InteractsWithQueue, Queueable;
|
use InteractsWithQueue, Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property string $paymantable_type Payment Related Class
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
protected string $paymantable_type,
|
||||||
|
) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the action on the given models.
|
* Perform the action on the given models.
|
||||||
*
|
*
|
||||||
@@ -26,11 +35,10 @@ class CheckOnlinePaymentStatus extends Action
|
|||||||
*/
|
*/
|
||||||
public function handle(ActionFields $fields, Collection $models)
|
public function handle(ActionFields $fields, Collection $models)
|
||||||
{
|
{
|
||||||
/** @var \App\Models\Order\Card\CardOrder $item */
|
|
||||||
$item = $models->first();
|
$item = $models->first();
|
||||||
|
|
||||||
$onlinePaymentResource = OnlinePaymentHistory::query()
|
$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)
|
->where('online_paymantable_id', $item->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ use App\Rules\OnlyLetters;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Laravel\Nova\Fields\Boolean;
|
||||||
use Laravel\Nova\Fields\Date;
|
use Laravel\Nova\Fields\Date;
|
||||||
use Laravel\Nova\Fields\Hidden;
|
use Laravel\Nova\Fields\Hidden;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
@@ -192,6 +193,9 @@ class CardOrder extends Resource
|
|||||||
->default(auth()->id())
|
->default(auth()->id())
|
||||||
->hideWhenUpdating(),
|
->hideWhenUpdating(),
|
||||||
|
|
||||||
|
Boolean::make(__('Paid'), 'paid')
|
||||||
|
->canSeeWhen('isSuperAdmin', $this),
|
||||||
|
|
||||||
Select::make(__('Status'), 'status')
|
Select::make(__('Status'), 'status')
|
||||||
->displayUsingLabels()
|
->displayUsingLabels()
|
||||||
->searchable()
|
->searchable()
|
||||||
@@ -384,7 +388,7 @@ class CardOrder extends Resource
|
|||||||
->canSee(fn () => true)
|
->canSee(fn () => true)
|
||||||
->icon('credit-card'),
|
->icon('credit-card'),
|
||||||
|
|
||||||
(new CheckOnlinePaymentStatus())
|
(new CheckOnlinePaymentStatus('App\Models\Order\Card\CardOrder'))
|
||||||
->sole()
|
->sole()
|
||||||
->withoutConfirmation()
|
->withoutConfirmation()
|
||||||
->icon('server'),
|
->icon('server'),
|
||||||
|
|||||||
Reference in New Issue
Block a user