enable card order

This commit is contained in:
nurmuhammet committed 2024-03-25 14:32:31 +05:00
1 parent 05377c63d2
commit 22ccedba92
3 files changed
+18 -8

No files matched your search

-2
View File
@@ -17,7 +17,6 @@ class ProductType extends Filter
/** /**
* Apply the filter to the given query. * Apply the filter to the given query.
* *
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value * @param mixed $value
* @return \Illuminate\Database\Eloquent\Builder * @return \Illuminate\Database\Eloquent\Builder
@@ -30,7 +29,6 @@ public function apply(NovaRequest $request, $query, $value)
/** /**
* Get the filter's available options. * Get the filter's available options.
* *
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array * @return array
*/ */
public function options(NovaRequest $request) public function options(NovaRequest $request)
+18 -4
View File
@@ -138,6 +138,20 @@ public static function afterCreate(NovaRequest $request, Model $model): void
CardOrderRepo::created()($model); CardOrderRepo::created()($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());
}
/** /**
* Return the location to redirect the user after update. * Return the location to redirect the user after update.
* *
@@ -145,11 +159,11 @@ public static function afterCreate(NovaRequest $request, Model $model): void
*/ */
// public static function redirectAfterUpdate(NovaRequest $request, $resource): URL|string // public static function redirectAfterUpdate(NovaRequest $request, $resource): URL|string
// { // {
// $payment = (new OnlinePaymentRepo())->payCardOrder($resource); // $payment = (new OnlinePaymentRepo())->payCardOrder($resource);
// return $payment['status'] === 'success' // return $payment['status'] === 'success'
// ? URL::remote($payment['url']) // ? URL::remote($payment['url'])
// : sprintf('resources/%s/%s', static::uriKey(), $resource->getKey()); // : sprintf('resources/%s/%s', static::uriKey(), $resource->getKey());
// } // }
/** /**
-2
View File
@@ -26,8 +26,6 @@ class OnlinePaymentRepo
/** /**
* Pay card order * Pay card order
*
* @param [type] $resource
*/ */
public function payCardOrder($resource): array public function payCardOrder($resource): array
{ {