Hi,
I'm trying to generate an event to execute some code when a user login, when I execute "php artisan event:generate" an error is thrown. My $listen variable at EventServiceProvider.php is declared as:
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
'Illuminate\Auth\Events\Login' => [
'App\Listeners\LogSuccessfulLogin',
],
],
];
Error:
$ php artisan event:generate
ErrorException : trim() expects parameter 1 to be string, array given
at ...\vendor\laravel\framework\src\Illuminate\Console\GeneratorCommand.php:215
212| */
213| protected function getNameInput()
214| {
> 215| return trim($this->argument('name'));
216| }
217|
218| /**
219| * Get the root namespace for the class.
Exception trace:
1 trim()
..\vendor\laravel\framework\src\Illuminate\Console\GeneratorCommand.php:215
2 Illuminate\Console\GeneratorCommand::getNameInput()
..\vendor\laravel\framework\src\Illuminate\Console\GeneratorCommand.php:53
Please use the argument -v to see more details.
I add dd(gettype($this->argument('name')), $this->argument('name')); to debug the problem and output is:
"string"
"Illuminate\Auth\Events\Registered"
Laravel version 5.8.2
Laravel Installer 2.0.1
Probably I'm doing something wrong, I can't tell what.
Thanks!