This commit is contained in:
2025-09-25 03:03:31 +05:00
commit ae480cf2f6
2768 changed files with 1485826 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Repositories\Ecommerce\Order;
use Closure;
class NovaOrderRepository
{
/**
* Mask value
*
* @param string $attribute
*/
public static function mask($resource, $attribute): Closure
{
return fn () => $resource->{$attribute} ? mask_phone($resource->{$attribute}) : '';
}
/**
* Fill form with masking value mask
*/
public static function fillUnmasked(): Closure
{
return function ($request, $model, $attribute, $requestAttribute) {
$model->{$attribute} = unmask_phone($request->input($attribute));
};
}
/**
* Depends on
*/
public static function dependsOnWhere(string $attribute, string $model): Closure
{
return function ($field, $request, $formData) use ($attribute, $model) {
if ($formData->{$attribute}) {
$field->options($model::where('region', $formData->{$attribute})->pluck('name', 'id'));
}
};
}
}