21 lines
500 B
PHP
Executable File
21 lines
500 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
trait NotificationTrait
|
|
{
|
|
public function handleValidationFailure(Validator $validator): void
|
|
{
|
|
notify()->warning('Silakan periksa data yang Anda masukkan', 'Peringatan');
|
|
$response = redirect()
|
|
->back()
|
|
->withInput()
|
|
->withErrors($validator);
|
|
|
|
throw new ValidationException($validator, $response);
|
|
}
|
|
}
|