/Laravel-PostgreSQL-pgbouncer-Fix

This is fix for Laravel when pgbouncer enabled with parameter 'PDO::ATTR_EMULATE_PREPARES => true'

Primary LanguagePHP

Laravel Fix For PostgreSQL 'pgbouncer'

This is a small fix for boolean values in Laravel, when PostgreSQL connection set-up with parameter:

PDO::ATTR_EMULATE_PREPARES => true

Instruction:

  • Copy PostgresConnection.php in App\Database folder
  • Connect PostgresConnection class in AppServiceProvider.php file like in example
  • Add casts in you models for all boolean values

Alternative

Same logic but with composer installation