File tree Expand file tree Collapse file tree 5 files changed +86
-1
lines changed Expand file tree Collapse file tree 5 files changed +86
-1
lines changed Original file line number Diff line number Diff line change 1111 "illuminate/database" : " ^8.83" ,
1212 "illuminate/console" : " ^8.83" ,
1313 "illuminate/bus" : " ^8.83" ,
14- "illuminate/queue" : " ^8.83"
14+ "illuminate/queue" : " ^8.83" ,
15+ "laravel/framework" : " ^8.83"
1516 },
1617 "autoload" : {
1718 "psr-4" : {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Events \WhatsappTemplate ;
4+
5+ use Iutrace \Botmaker \Models \WhatsappTemplate ;
6+ use Illuminate \Foundation \Events \Dispatchable ;
7+
8+ class Created
9+ {
10+ use Dispatchable;
11+
12+ public $ whatsappTemplate ;
13+
14+ /**
15+ * Crea una nueva instancia del evento.
16+ *
17+ * @param WhatsappTemplate $whatsappTemplate
18+ * @return void
19+ */
20+ public function __construct (WhatsappTemplate $ whatsappTemplate )
21+ {
22+ $ this ->whatsappTemplate = $ whatsappTemplate ;
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Events \WhatsappTemplate ;
4+
5+ use Iutrace \Botmaker \Models \WhatsappTemplate ;
6+ use Illuminate \Foundation \Events \Dispatchable ;
7+
8+ class Deleted
9+ {
10+ use Dispatchable;
11+
12+ public $ whatsappTemplate ;
13+
14+ public function __construct (WhatsappTemplate $ whatsappTemplate )
15+ {
16+ $ this ->whatsappTemplate = $ whatsappTemplate ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Events \WhatsappTemplate ;
4+
5+ use Iutrace \Botmaker \Models \WhatsappTemplate ;
6+ use Illuminate \Foundation \Events \Dispatchable ;
7+
8+ class Updated
9+ {
10+ use Dispatchable;
11+
12+ public $ whatsappTemplate ;
13+
14+ public function __construct (WhatsappTemplate $ whatsappTemplate )
15+ {
16+ $ this ->whatsappTemplate = $ whatsappTemplate ;
17+ }
18+ }
Original file line number Diff line number Diff line change 33namespace Iutrace \Botmaker \Models ;
44
55use Illuminate \Database \Eloquent \Model ;
6+ use Illuminate \Support \Facades \Event ;
67
78class WhatsappTemplate extends Model
89{
@@ -27,4 +28,27 @@ public function model()
2728 {
2829 return $ this ->morphTo ();
2930 }
31+
32+ /**
33+ * The "boot" method of the model.
34+ *
35+ * @return void
36+ */
37+ protected static function boot ()
38+ {
39+ parent ::boot ();
40+
41+ static ::created (function ($ whatsappTemplate ) {
42+ Event::dispatch (new \App \Events \WhatsappTemplate \Created ($ whatsappTemplate ));
43+ });
44+
45+ static ::updated (function ($ whatsappTemplate ) {
46+ Event::dispatch (new \App \Events \WhatsappTemplate \Updated ($ whatsappTemplate ));
47+ });
48+
49+ static ::deleted (function ($ whatsappTemplate ) {
50+ Event::dispatch (new \App \Events \WhatsappTemplate \Deleted ($ whatsappTemplate ));
51+ });
52+
53+ }
3054}
You can’t perform that action at this time.
0 commit comments