Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jgravois's avatar

[l4.2] Relationships Lost on Deployment

I am looking for ANY ideas here ...

[Disclaimer] I am well aware that GoDaddy is NOT a great platform for Laravel deployment but I have NO CHOICE. I do have SSH access and installed Composer.

I cloned a local project to a GoDaddy Shared Linux server and ran 'composer install', 'bower install', 'dump-autoload' and migrated and seeded the database.

Locally running on MAMP PRO, everything works fine but on the server, when I switch the commented sections, I get 'Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR), Class 'user' not found'

It seems to me like I lost the relationships I have declared in my models.

I really don't know how to debug and/or solve this.

public function index()
    {
        $loans = Loan::all();
        return $loans;

        /*
        $loans = Loan::with('applicants.entitytype', 'committee.user', 'corporations','comments.status', 'distributor', 'farmer', 'farms.county', 'financials', 'insurance', 'loancrop.crop', 'loanstatus', 'loantype.reqdocs',  'location', 'partners', 'regions', 'ventures', 'user')->where('applicant_id', '!=', 'null')->get();


        return $this->respond([
            'data' => $this->loanTransformer->transformCollection($loans->all())
        ]);
        */
    }
0 likes
2 replies
fraserk's avatar
fraserk
Best Answer
Level 16

You server might be case sensitive. Try User

1 like
jgravois's avatar

@fraserk, good call.

It is strange that my app was actually working in MAMP on my laptop because I was taught that relationships were declared as

public function <<name of modelClass>>()
{
    return $this->belongsTo( '<<databasetablename>>', 'foreign_key');
}

Because of that poor teaching, ALL of my "databasetablename" were lowercase. When I was researching your answer, I saw in the documentation that it is actually return $this->belongsTo( '-modelClass-', 'foreign_key'); and once I changed all of them to the Uppercased Class name, everything worked fine.

Thanks!

1 like

Please or to participate in this conversation.