core
core copied to clipboard
Notifications don't work after installing waterhole
Bug description
We implemented waterhole on an existing Laravel project and after that the notification system broke.
Steps to reproduce
You can create a notification by extending the Laravel Notification class or the Waterhole Notification abstract class, when you send the notification it will throw an error because of the NotificationRecieved event.
Logs
TypeError: Waterhole\Events\NotificationReceived::__construct(): Argument #1 ($notification) must be of type Waterhole\Models\Notification, Illuminate\Notifications\DatabaseNotification given, called in C:\laragon\www\keyss\vendor\waterhole\core\src\Notifications\DatabaseChannel.php on line 16 and defined in C:\laragon\www\keyss\vendor\waterhole\core\src\Events\NotificationReceived.php:15
Stack trace:
#0 C:\laragon\www\keyss\vendor\waterhole\core\src\Notifications\DatabaseChannel.php(16): Waterhole\Events\NotificationReceived->__construct(Object(Illuminate\Notifications\DatabaseNotification))
#1 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Notifications\NotificationSender.php(148): Waterhole\Notifications\DatabaseChannel->send(Object(App\Models\User), Object(App\Notifications\JobCreated))
#2 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Notifications\NotificationSender.php(106): Illuminate\Notifications\NotificationSender->sendToNotifiable(Object(App\Models\User), '16d9853d-db4e-4...', Object(App\Notifications\JobCreated), 'database')
#3 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Support\Traits\Localizable.php(19): Illuminate\Notifications\NotificationSender->Illuminate\Notifications\{closure}()
#4 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Notifications\NotificationSender.php(101): Illuminate\Notifications\NotificationSender->withLocale(NULL, Object(Closure))
#5 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Notifications\ChannelManager.php(54): Illuminate\Notifications\NotificationSender->sendNow(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\JobCreated), Array)
#6 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Notifications\SendQueuedNotifications.php(119): Illuminate\Notifications\ChannelManager->sendNow(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\JobCreated), Array)
#7 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Illuminate\Notifications\SendQueuedNotifications->handle(Object(Illuminate\Notifications\ChannelManager))
#8 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#9 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#10 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#11 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\Container.php(662): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#12 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#13 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(144): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#14 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#15 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#16 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(123): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Notifications\SendQueuedNotifications), false)
#17 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(144): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#18 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#19 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#20 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Notifications\SendQueuedNotifications))
#21 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(102): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#22 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(439): Illuminate\Queue\Jobs\Job->fire()
#23 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(389): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#24 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(176): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#25 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(137): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#26 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(120): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#27 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#28 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#29 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#30 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#31 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Container\Container.php(662): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#32 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Console\Command.php(211): Illuminate\Container\Container->call(Array)
#33 C:\laragon\www\keyss\vendor\symfony\console\Command\Command.php(326): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#34 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Console\Command.php(180): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#35 C:\laragon\www\keyss\vendor\symfony\console\Application.php(1096): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 C:\laragon\www\keyss\vendor\symfony\console\Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 C:\laragon\www\keyss\vendor\symfony\console\Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 C:\laragon\www\keyss\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(201): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 C:\laragon\www\keyss\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 {main}
Environment
"php": "^8.1",
"laravel/framework": "^10.10",
"waterhole/core": "^0.4.9"