$models * @return mixed */ public function handle(ActionFields $fields, Collection $models) { /** @var \App\Models\Order\Card\CardOrder */ $item = $models->first(); $onlinePaymentResource = OnlinePaymentHistory::query() ->where('online_paymantable_type', $this->paymantable_type) ->where('online_paymantable_id', $item->id) ->latest() ->first(); if (! $onlinePaymentResource) { return Action::modal('modal-response', [ 'title' => 'Onlaýn töleg taryhy ýok', 'body' => 'Onlaýn töleg taryhy ýok', ]); } if (! $item->branch) { return Action::modal('modal-response', [ 'title' => 'Şahamça bilen birikdirilmedik', 'body' => 'Şahamça bilen birikdirilmedik', ]); } $username = $item->branch->billing_username; $password = $item->branch->billing_password; if (is_null($username) || is_null($password)) { return Action::modal('modal-response', [ 'title' => 'HALKBANK API', 'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi', ]); } if ($username == '' || $password == '') { return Action::modal('modal-response', [ 'title' => 'HALKBANK API', 'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi', ]); } $response = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatusExtended.do', [ 'language' => 'ru', 'orderId' => $onlinePaymentResource->orderId, 'userName' => $username, 'password' => $password, ]); return Action::modal('modal-response', [ 'title' => 'HALKBANK API', 'html' => CheckOnlinePayment::resultHTML($response), ]); } /** * Get the fields available on the action. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request): array { return []; } }