enable card order
This commit is contained in:
@@ -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 @@ class ProductType extends Filter
|
|||||||
/**
|
/**
|
||||||
* 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)
|
||||||
|
|||||||
@@ -138,6 +138,20 @@ class CardOrder extends Resource
|
|||||||
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 @@ class CardOrder extends Resource
|
|||||||
*/
|
*/
|
||||||
// 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());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user