DeleteWareaListener.php 638 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Listeners;
  3. use App\Events\DeleteWarea;
  4. use App\Models\WarZone;
  5. use Illuminate\Queue\InteractsWithQueue;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. class DeleteWareaListener
  8. {
  9. /**
  10. * Create the event listener.
  11. *
  12. * @return void
  13. */
  14. public function __construct()
  15. {
  16. //
  17. }
  18. /**
  19. * Handle the event.
  20. *
  21. * @param DeleteWarea $event
  22. * @return void
  23. */
  24. public function handle(DeleteWarea $event)
  25. {
  26. $warea=$event->warea;
  27. $war_name= explode('战区',$warea->name)[0];
  28. WarZone::where('war_name',$war_name)->delete();
  29. }
  30. }