pnoeric
2 months ago
287
2
Nova

Laravel Nova showing no data - related to table name/field names?

Posted 2 months ago by pnoeric

Hmm I'm not sure what's wrong, I JUST started with Laravel Nova and I can't get it to display my users table. :-(

The Eloquent model for Users is set up correctly; in tinker I can enter User::first() and that works fine. I see data, it's all good. (In fact I have seeded the table fully using standard Laravel factory/seeder procedure.)

But the screen is totally blank in the interface. I see rows and each of them just has a '-'. Clicking the "view" icon on any row returns a 404.

In my Nova/User.php file, I have public static $model = \App\Models\User::class; which is correct.

I suspect this is related to my non-standard table and column names. (Yes I know that's not fun, and no I can't change them; I'm forced to use an existing DB structure.)

But again, my Eloquent model is set up correctly (specifying the correct DB $table in the model so it functions). And in the Nova/User resource file, I've even simplified things so I can just see a list of IDs:

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
        ];
    }

The ID column in my db is named 'ID' (caps) and I've specified that in the Eloquent model (protected $primaryKey = 'ID';).

Help :-(

Please sign in or create an account to participate in this conversation.