Update Module Debitur
penambahan default cif 0x10 dan di buat mandatory update field npwp input harus minimal 15 dan maksimal 16 digit penambahan rules
This commit is contained in:
25
app/Rules/UniqueCifExceptZero.php
Normal file
25
app/Rules/UniqueCifExceptZero.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
|
||||
class UniqueCifExceptZero implements ValidationRule
|
||||
{
|
||||
public function __construct($id = null)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function validate($attribute, $value, $fail): void
|
||||
{
|
||||
if (Debiture::where($attribute, $value)
|
||||
->where('id', '!=', $this->id)
|
||||
->where($attribute, '!=', '000000')
|
||||
->exists()) {
|
||||
$fail('The :attribute field must be uniquse.'.$this->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user