wip
This commit is contained in:
40
app/Repositories/Ecommerce/Order/NovaOrderRepository.php
Normal file
40
app/Repositories/Ecommerce/Order/NovaOrderRepository.php
Normal 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'));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user