EventServiceProvider.php 656 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Base\Providers;
  3. use Illuminate\Database\Events\StatementPrepared;
  4. use Illuminate\Support\Facades\Event;
  5. use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
  6. class EventServiceProvider extends ServiceProvider
  7. {
  8. /**
  9. * The event listener mappings for the application.
  10. *
  11. * @var array
  12. */
  13. protected $listen = [
  14. 'App\Events\SomeEvent' => [
  15. 'App\Listeners\EventListener',
  16. ],
  17. ];
  18. public function boot()
  19. {
  20. Event::listen(StatementPrepared::class, function ($event) {
  21. $event->statement->setFetchMode(\PDO::FETCH_ASSOC);
  22. });
  23. }
  24. }