I have this code `
User::first()->attachPermission($permission);
which select first user in table user, but I want to select all user from user table. I create
User::get()->all()->attachPermission($permission);
but this not working
I have this code `
User::first()->attachPermission($permission);
which select first user in table user, but I want to select all user from user table. I create
User::get()->all()->attachPermission($permission);
but this not working
2
Answers
Just simply use
OR
To attach permissions, you just need to add them to the iteration using either
all()
orget()
as shown by @aynber and @Telexx: