File tree Expand file tree Collapse file tree 6 files changed +20
-15
lines changed Expand file tree Collapse file tree 6 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 77
88class UpdateWhatsappTemplatesCommand extends Command
99{
10- protected $ signature = 'botmaker:update-whatsap -templates ' ;
10+ protected $ signature = 'botmaker:update-whatsapp -templates ' ;
1111
1212 protected $ description = 'Update the states of WhatsApp templates by fetching changes from the API ' ;
1313
@@ -19,4 +19,4 @@ public function handle()
1919
2020 return Command::SUCCESS ;
2121 }
22- }
22+ }
Original file line number Diff line number Diff line change 11<?php
22
3- namespace App \Events \WhatsappTemplate ;
3+ namespace Iutrace \ Botmaker \Events \WhatsappTemplate ;
44
55use Iutrace \Botmaker \Models \WhatsappTemplate ;
66use Illuminate \Foundation \Events \Dispatchable ;
7+ use Illuminate \Queue \SerializesModels ;
78
89class Created
910{
10- use Dispatchable;
11+ use Dispatchable, SerializesModels ;
1112
1213 public $ whatsappTemplate ;
1314
Original file line number Diff line number Diff line change 11<?php
22
3- namespace App \Events \WhatsappTemplate ;
3+ namespace Iutrace \ Botmaker \Events \WhatsappTemplate ;
44
55use Iutrace \Botmaker \Models \WhatsappTemplate ;
66use Illuminate \Foundation \Events \Dispatchable ;
7+ use Illuminate \Queue \SerializesModels ;
78
89class Deleted
910{
10- use Dispatchable;
11+ use Dispatchable, SerializesModels ;
1112
1213 public $ whatsappTemplate ;
1314
Original file line number Diff line number Diff line change 11<?php
22
3- namespace App \Events \WhatsappTemplate ;
3+ namespace Iutrace \ Botmaker \Events \WhatsappTemplate ;
44
5- use Iutrace \Botmaker \Models \WhatsappTemplate ;
65use Illuminate \Foundation \Events \Dispatchable ;
6+ use Illuminate \Queue \SerializesModels ;
7+ use Iutrace \Botmaker \Models \WhatsappTemplate ;
78
89class Updated
910{
10- use Dispatchable;
11+ use Dispatchable, SerializesModels ;
1112
1213 public $ whatsappTemplate ;
1314
Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ class UpdateWhatsappTemplatesJob implements ShouldQueue
1717
1818 public function handle ()
1919 {
20- $ pendingTemplates = WhatsappTemplate::where ('state ' , WhatsappTemplateState::ACCOUNT_PENDING )->get ();
20+ $ pendingTemplates = WhatsappTemplate::where ('state ' , WhatsappTemplateState::BOTMAKER_PENDING )->get ();
2121
2222 foreach ($ pendingTemplates as $ template ) {
2323 try {
2424
2525 $ botmakerTemplate = Botmaker::getWhatsappTemplate ($ template ->name );
2626
27- if ($ botmakerTemplate ->state != WhatsappTemplateState::ACCOUNT_PENDING ){
27+ if ($ botmakerTemplate ->state != WhatsappTemplateState::BOTMAKER_PENDING ){
2828
2929 $ template ->state = WhatsappTemplateState::getState ($ botmakerTemplate ->state );
3030 $ template ->save ();
Original file line number Diff line number Diff line change 44
55use Illuminate \Database \Eloquent \Model ;
66use Illuminate \Support \Facades \Event ;
7+ use Iutrace \Botmaker \Events \WhatsappTemplate \Updated ;
8+ use Iutrace \Botmaker \Events \WhatsappTemplate \Created ;
9+ use Iutrace \Botmaker \Events \WhatsappTemplate \Deleted ;
710
811class WhatsappTemplate extends Model
912{
@@ -39,16 +42,15 @@ protected static function boot()
3942 parent ::boot ();
4043
4144 static ::created (function ($ whatsappTemplate ) {
42- Event::dispatch (new \ App \ Events \ WhatsappTemplate \ Created ($ whatsappTemplate ));
45+ Event::dispatch (new Created ($ whatsappTemplate ));
4346 });
4447
4548 static ::updated (function ($ whatsappTemplate ) {
46- Event::dispatch (new \ App \ Events \ WhatsappTemplate \ Updated ($ whatsappTemplate ));
49+ Event::dispatch (new Updated ($ whatsappTemplate ));
4750 });
4851
4952 static ::deleted (function ($ whatsappTemplate ) {
50- Event::dispatch (new \ App \ Events \ WhatsappTemplate \ Deleted ($ whatsappTemplate ));
53+ Event::dispatch (new Deleted ($ whatsappTemplate ));
5154 });
52-
5355 }
5456}
You can’t perform that action at this time.
0 commit comments