46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Rules\PaymentRules;
|
|
|
|
use App\Http\Controllers\InformationController;
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
|
|
class NorujukanContractNotExceed12Month implements Rule
|
|
{
|
|
public $pembiayaan;
|
|
/**
|
|
* Create a new rule instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($pembiayaan)
|
|
{
|
|
$this->pembiayaan = $pembiayaan;
|
|
}
|
|
|
|
/**
|
|
* Determine if the validation rule passes.
|
|
*
|
|
* @param string $attribute
|
|
* @param mixed $value
|
|
* @return bool
|
|
*/
|
|
public function passes($attribute, $value)
|
|
{
|
|
$gadaiContractExceed12Month = array_filter($this->pembiayaan, fn($x) => $x['tempoh'] >= 12);
|
|
|
|
return sizeof($gadaiContractExceed12Month) == 0;
|
|
|
|
}
|
|
|
|
/**
|
|
* Get the validation error message.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function message()
|
|
{
|
|
return 'SAG Yang Dipilih Akan/Telah Tamat Kontrak 12 Bulan. Sila Hadir Ke Kaunter Cawangan Untuk Pembayaran/Penebusan.';
|
|
}
|
|
}
|