My projects works fine on my local machine. I have no idea what might be wrong.
I have a clients table, but not sure where this query is coming from.
Just to be clear, the deployment fails.
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO) (SQL: select * from `clients` where `clients`.`deleted_at` is null order by `name` asc)
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
The error suggests that Laravel can't access your database (and also that it is trying to access it without a password). I'm guessing you don't have your .env configured properly in the database section.
@JoshMountain
When I do composer install from the command line I get this
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forge.clients' doesn't exist (SQL: select * from `clients` where `clients`.`deleted_at` is null order by `name` asc)
Why is sql running on composer install?
Shouldn't the ENV file come after installing the repository?
Hmm that definitely isn't normal, the .env should be generated automatically yes. Try restarting the server through Forge, maybe the .env never loaded properly into the environment.
This might be something migration related then. If you delete all the tables in your local machine database and run php artisan migrate on an empty database do all the migrations run successfully?
@JoshMountain No. They don't run unless I comment out the code in the AppServiceProvider.
Maybe this is a natural behavior, but I didn't see it mentioned in the docs.
Ah okay now I understand! The issue is because these service providers are loaded on boot, so they load when an artisan command runs. In that sense yes this is normal. You can use $this->app->runningInConsole() to determine if Laravel is running in the console, during migrations and the like, (thanks @martinbean - Link to his original post) and skip your view composers.