Comments on: Custom model events with Laravel 5.4 https://www.leewillis.co.uk/custom-model-events-laravel/ Thu, 09 Nov 2017 06:40:19 +0000 hourly 1 https://wordpress.org/?v=6.7.1 By: ffff https://www.leewillis.co.uk/custom-model-events-laravel/#comment-932875 Thu, 09 Nov 2017 06:40:19 +0000 https://www.leewillis.co.uk/?p=936#comment-932875 I created something similar for pivot tables :
https://github.com/fico7489/laravel-pivot

]]>
By: Andrew https://www.leewillis.co.uk/custom-model-events-laravel/#comment-932867 Mon, 17 Jul 2017 11:20:53 +0000 https://www.leewillis.co.uk/?p=936#comment-932867 In reply to Theodore R. Smith.

There’s always one…

In @Theodore’s one sweeping comment, he’s making a lot of assumptions about the scale of the project and the dev team’s competence (if there even is a team). I know a more widely adopted law that this tutorial does follow – KISS.

]]>
By: Theodore R. Smith https://www.leewillis.co.uk/custom-model-events-laravel/#comment-932865 Thu, 18 May 2017 09:28:18 +0000 https://www.leewillis.co.uk/?p=936#comment-932865 This is actually pretty dangerous code. The last thing you want to do is allow events to be fired via public functions. This breaks the Law of Demeter and opens your model up to all sorts of abuses by less than savvy devs.

]]>
By: Teliov https://www.leewillis.co.uk/custom-model-events-laravel/#comment-932863 Thu, 09 Mar 2017 11:03:10 +0000 https://www.leewillis.co.uk/?p=936#comment-932863 Nice!
Came here from your comment on a Laracast topic related to this. I pretty much did the same thing, I just added support for passing additional parameters instead of just the model firing the events via a trait method.

]]>