Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create abilities from tinker? #591

Open
pintend opened this issue May 23, 2022 · 3 comments
Open

How to create abilities from tinker? #591

pintend opened this issue May 23, 2022 · 3 comments

Comments

@pintend
Copy link

pintend commented May 23, 2022

running Bouncer::allow('admin')->to('ban-users'); in tinker returns Silber\Bouncer\Conductors\Lazy\ConductsAbilities
and never saves in the database

how do i save a lazy ability?

is it related to this? laravel/tinker#30

@JosephSilber
Copy link
Owner

Yeah. That's a problem. It's actually a problem with any lazy object. Laravel is full of those.

I've been thinking of maybe adding a save method, which would allow you to manually commit it. It would also have to save that state on the object, so that it doesn't run again when destructuring.

It's bad either way. I guess that's the tradeoff for using lazy objects.

@krismanning
Copy link

I've just come across this, which is weird because its been working for ages, then suddeny I cant add abilities from Tinker.
Was there any update on this or a workaround?

many thanks.

@pintend
Copy link
Author

pintend commented Oct 25, 2023

You can call ->__destruct() manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants