Initial Commit

This commit is contained in:
2025-05-06 15:05:09 +07:00
commit 7b885d7d45
695 changed files with 119779 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Lpj\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Modules\Lpj\Models\Debiture;
class UniqueCifExceptZero implements ValidationRule
{
protected $id;
public function __construct($id = null)
{
$this->id = $id;
}
/**
* Run the validation rule.
*/
public function validate(string $attribute, mixed $value, Closure $fail)
: void {
if ($value !== '0000000000' && $value !== null && Debiture::query()->where($attribute, $value)->when(
$this->id,
function ($query) {
$query->where('id', '!=', $this->id);
},
)->exists()) {
$fail('The :attribute field must be unique.');
}
}
}