On/off toggle based on relationship? (Spatie/Laravel Permission)
I have this toggle to on/off certain permissions on the Edit User resource. How do I make that work with permissions stored in another table using Laravel Permission by Spatie?
Toggle::make('testPermission')->label('Test');
Toggle::make('testPermission')->label('Test');
Basically a name in the permissions table could be
'view this'
'view this'
with
id = 9
id = 9
for example. I need t check if it exists for this userID and turn the toggle on/off based on that.
If exists and I turn off the toggle it should delete and vice versa.