I faced issue in Laravel 5.7
Error as follows
Method Illuminate\Database\Query\Builder::routeNotificationFor does not exist.
My code as follows
$users = User::find(1);
Notification::send($users, new UserActivity());
Users return value as follows
{"id":1, "name":"First Name", "email":"[email protected]","mobile":"9999999999","reset_password":0,"avatar":null,"created_at":"2019-04-11 10:39:08","updated_at":"2019-04-11 10:39:08","deleted_at":null}
This is working fine with Auth user as follows
Notification::send(Auth()->user(), new UserActivity());
If anyone faced the same issue ?
$users
returns? Before you send notification try dumping the$users
like this:dd($users);
And make sure that it returns aApp\User
instance . – nakovUser::find(1)
is that what you get by usingdd
or you print the result by returning the userreturn $users
? – nakov