Laravel uses composer to load classes and configures the autoloader as a PSR-4 autoloader. The PSR-4 spec states that
- All class names MUST be referenced in a case-sensitive fashion.
and
The terminating class name corresponds to a file name ending in .php. The file name MUST match the case of the terminating class name.
In the default configuration Laravel specifies that the root namespace is App and is situated in the app folder (ironically Laravel did not make this case sensitive but composer allows this for the root namespace). So for example if you want to load App\Models\user then composer will look for the file app/Models/user.php. Note that in the default Laravel installation the file is actually named User.php.
Now I do think there is a bug in the composer autoloader or a limitation in Windows in that it only checks if the file exists and doesn't check if the file also matches the case. Since Windows is a case insensitive filesystem when composer asks it if app/Models/user.php exists then Windows will respond that it does, even if the casing is wrong. However Linux is a case sensitive filesystem therefore if you ask a Linux OS if app/Models/user.php exists it will respond that it does not. This will create a discrepancy between Windows and Linux if you're not careful.
I'm not sure if this is a composer bug or configuration or caching issue but the best course of action is to always match the case of your file names in your class names and in the way you refer to them.
usershould beUser. If your local is windows and your production is Linux this will cause a problem because the Linux filesystem is case sensitive while the windows one is not.Useroruser? That is pretty important. Show us the namespace of yourusermodel.