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

deleting function inside boot function isn't called when using LaratrustUserTrait #35

Closed
nikocraft opened this issue Sep 26, 2016 · 18 comments

Comments

@nikocraft
Copy link

nikocraft commented Sep 26, 2016

Inside my User model I have this

public static function boot()
{
        parent::boot();
        static::deleting(function ($model) {
                echo "deleting user <br>";
        });
}

deleting function isn't call if I use LaratrustUserTrait, is there way to make sure it gets called as I need to do some stuff inside that function.

@santigarcor
Copy link
Owner

@nermion There's a problem, because Laratrust uses that deleting function in the soft deleting case.

@nikocraft
Copy link
Author

@santigarcor Laratrust also uses deleted function but in my user model static:deleted gets called. What is the difference?

@santigarcor
Copy link
Owner

santigarcor commented Sep 26, 2016

@nermion The only difference i can spot is the return true in that method. But not sure if that's making a difference

@nikocraft
Copy link
Author

I could test commenting out 'return true' and see if that works. Does return true need to be there, anything that depends on it?

@santigarcor
Copy link
Owner

santigarcor commented Sep 26, 2016

The return true is not the problem, because if you se the $flushCache function above also returns true.

@santigarcor
Copy link
Owner

@nermion Did you test it?

@nikocraft
Copy link
Author

Not yet, on my way home will test it in 5 minutes

On Monday, September 26, 2016, Santiago García notifications@github.com
wrote:

@nermion https://github.com/nermion Did you test it?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAbCyNJdTWvVgZrcKhPA3R_Uy1HNfZw9ks5qt95ygaJpZM4KGkpS
.

@nikocraft
Copy link
Author

commenting out 'return true' makes it work. Perhaps you can remove it from that function so that I don't have to edit it my self.

@santigarcor
Copy link
Owner

@nermion does it affects the behavior or something like that?

@nikocraft
Copy link
Author

It doesn't seem to cause any problems for me.

@santigarcor
Copy link
Owner

@nermion I just tested that out, i'm making the changes now

@nikocraft
Copy link
Author

great :)

santigarcor added a commit that referenced this issue Sep 26, 2016
Removed `return` from eloquent's `deleting` event
@santigarcor
Copy link
Owner

santigarcor commented Sep 26, 2016

57b94fb solves it.

Tagged v3.0.6

@nikocraft
Copy link
Author

Hi Santigarcor how do I get this latest update, my composer file says "santigarcor/laratrust": "3.0.*", when do you release this so that my project has the latest version?

@santigarcor
Copy link
Owner

@nermion well i tagged the version 3.0.6. So you just have to run composer update

@nikocraft
Copy link
Author

I did run composer update but it did not download the 3.0.6 for me

@nikocraft
Copy link
Author

actually it maight be my fault :) I'll sort it out

@santigarcor
Copy link
Owner

@nermion ok.

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

No branches or pull requests

2 participants