Page::$reportValidationErrorUsing dispatchBrowserEvent

Is it possible to do something like this?
Page::$reportValidationErrorUsing = function (ValidationException $exception) {
session()->flash('errors_exception', 'Oeps, het ingevulde formulier bevat één of meerdere problemen.');
session()->flash('errors', $exception->validator->errors());

// Not working because it isn't a static method
Page::dispatchBrowserEvent('scroll-to', [
'query' => "#alert-errors",
'offset' => 120,
]);
};
Page::$reportValidationErrorUsing = function (ValidationException $exception) {
session()->flash('errors_exception', 'Oeps, het ingevulde formulier bevat één of meerdere problemen.');
session()->flash('errors', $exception->validator->errors());

// Not working because it isn't a static method
Page::dispatchBrowserEvent('scroll-to', [
'query' => "#alert-errors",
'offset' => 120,
]);
};
2 Replies
wyChoong
wyChoong2y ago
$this->dispatchBrowserEvent?
Arjen
ArjenOP2y ago
Can't use $this in that context, this is placed in the boot() method of the AppServiceProvider.
Want results from more Discord servers?
Add your server