DemoListener.php 616 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Listeners;
  3. use App\Events\Event;
  4. use Illuminate\Queue\InteractsWithQueue;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use App\Events\DemoEvent;
  7. class DemoListener
  8. {
  9. /**
  10. * Create the event listener.
  11. *
  12. * @return void
  13. */
  14. public function __construct(DemoEvent $event)
  15. {
  16. //
  17. }
  18. /**
  19. * Handle the event.
  20. *
  21. * @param Event $event
  22. * @return void
  23. */
  24. public function handle(DemoEvent $event)
  25. {
  26. $demo=$event->demo;
  27. // dd($demo);
  28. $demo->number=$demo->number+1;
  29. $demo->save;
  30. //
  31. }
  32. }