21 lines
478 B
PHP
21 lines
478 B
PHP
<?php
|
|
|
|
namespace App\Nova\Resources\Order\Loan\Concerns;
|
|
|
|
use App\Models\Branch\Branch;
|
|
use Closure;
|
|
|
|
class LoanOrderNovaRepo
|
|
{
|
|
public function fillUniqueId(): Closure
|
|
{
|
|
return function ($request, $model, $attribute, $requestAttribute) {
|
|
$model->{$attribute} = mb_strtoupper(sprintf(
|
|
'%s-%s',
|
|
Branch::find($request->branch_id)->unique_code,
|
|
$request->id
|
|
)) ?? uniqid();
|
|
};
|
|
}
|
|
}
|