25 lines
495 B
PHP
25 lines
495 B
PHP
<?php
|
|
|
|
namespace App\Rules\Bpa;
|
|
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class CaraterAtendimentoExists implements Rule
|
|
{
|
|
public function passes($attribute, $value)
|
|
{
|
|
return self::isValid($value);
|
|
}
|
|
|
|
public static function isValid($value)
|
|
{
|
|
return DB::table('bpa_carater_atendimento')->where('id', $value)->exists();
|
|
}
|
|
|
|
public function message()
|
|
{
|
|
return 'Caráter de atendimento inválido.';
|
|
}
|
|
}
|