Closed epic-kaso closed 8 years ago
if not done like this then when a user overrides the boot method in there own model, this done doesnt get called. doing it like this ensures that the boot method is called regardless of whether the user overrides the boot method or not in there eloquent model
@kasoprecede47 what makes it the laravel way though?
The reason why it's boot is intentional - to ensure default behaviour. If users want to overload boot, then they should also include any other methods they would like to include.
Laravel won't automatically boot the method you're suggesting, as far as I'm aware, and even if it did, users still need to include parent::boot anyway.
@kirkbushell Laravel automatically boots it. see http://www.archybold.com/blog/post/booting-eloquent-model-traits
I tried to use the lib as it currently is and because I also have a boot override on my model, It wasnt calling the boot method in the trait. I called parent::boot
The easiest way to get around that for now, is to simply alias the trait's boot method to something else, write your own boot method and then include the code required in UUIDmodel.
I can't merge this in just yet, as the change really should be without the boot() call in the new method you've highlighted. If you can make that change then I can merge in. I won't release until probably 1.5 along with some other changes, as it's also an API change and is separtae from the other traits, so I'll need to look at resolving those, as well.
Thanks for the heads up :)
@kasoprecede47
@kirkbushell yeah what's up?
@kasoprecede47 never got a response from you regarding previous comment.
@kirkbushell About that, I really didn't understand that. Did you mean i should remove the "parent::boot()" call ?
@kasoprecede47 calling the boot method isn't necessary within the changes you've made.
@kirkbushell Okay I understand now. I will make the changes and push asap
@kasoprecede47 are you still looking at updating this?
@kirkbushell I've made the update, I really don't know what else I should do
@kasoprecede47 ah, thanks. I'll check it out today and merge. Thanks! :)
Merged in, thanks for this - I like it.
@kirkbushell you are welcome, I'm glad you like it.
Hi!
Could you elaborate as to why this is the "laravel way"?