This commit is contained in:
nurmuhammet committed 2024-05-30 00:02:05 +05:00
1 parent 12e6c0ca9d
commit 6be7c614c1
5 files changed
+50 -2

No files matched your search

@@ -13,6 +13,7 @@
use App\Repos\Order\Card\CardOrderRepo;
use App\Repos\Order\Card\CardTypeRepo;
use App\Repos\Order\OrderRepo;
use App\Repos\Payment\OnlinePaymentRepo;
use App\Repos\System\Nova\NovaRepo;
use App\Repos\System\Settings\Legal\PassportRepo;
use App\Repos\System\Settings\Location\RegionRepo;
@@ -31,6 +32,7 @@
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Panel;
use Laravel\Nova\URL;
use Nurmuhammet\NovaInputmask\NovaInputmask;
class CardRequisite extends Resource
@@ -156,6 +158,20 @@ public static function afterCreate(NovaRequest $request, Model $model): void
$model->update(['unique_id' => CardOrderRepo::fillUniqueId($model)]);
}
/**
* Return the location to redirect the user after creation.
*
* @param \Laravel\Nova\Resource $resource
*/
public static function redirectAfterCreate(NovaRequest $request, $resource): URL|string
{
$payment = (new OnlinePaymentRepo())->payCardOrder($resource);
return $payment['status'] === 'success'
? URL::remote($payment['url'])
: sprintf('resources/%s/%s', static::uriKey(), $resource->getKey());
}
/**
* Get the fields for index.
*/