Skip to content
Advertisement

Tag: eloquent

Problems specifying Laravel Eloquent database at runtime

Laravel 5.8. I am trying to save an Eloquent model, choosing the database connection at runtime: My config/database.php file: My problem is that each time I run this code, the cat is created in the mysql (default) database, rather than the staging database, even when USE_STAGING is true. Answer The problem is the static call of the create() method. By

Advertisement