User::where('roleNo', 1)->firstOrFail()->notify(new Role1);
Sep 5, 2021
3
Level 1
Laravel find method
I am trying to find the users based on their roles and trying to send notifications to the respective role. But if I use the find method it works only works for "id" since id is a primarykey. $User = user::find(1); User::find(1)->notify(new role1);
If I use the following code I am getting an error "syntax error, unexpected 'User' (T_STRING)" $User = user::where('roleNo', 1); User::where('roleNo', 1)->notify(new role1);
Can anyone please suggest to me a solution to this problem? Is there any other way to find the nonprimary integer value?
Please or to participate in this conversation.