And, I was able to fix it by changing this:
public function fields(Request $request)
{
return [
ID::make('ID', 'ID')->sortable(),
];
}
So... two questions:
-
I assume this is an issue because my ID column is uppercase in the DB schema instead of lowercase. Is there a more better way to go about this? (No way Nova can just grab the name of the ID column from the db?)
-
More importantly: I am concerned about having DB column names and table names in two different places (my Laravel User resource as well as my main Eloquent User model). To add the 'Email' field, I already had to change this chunk of code:
Text::make('Email', 'Email')
->sortable()
->rules('required', 'email', 'max:254')
->creationRules('unique:myCustomUsersTable,email')
->updateRules('unique:myCustomUsersTable,email,{{resourceId}}'),
It just seems very... bad... to have something like the table name buried in a string in a PHP method call (where even phpStorm can't see it for refactoring). Is there any elegant way to get around this?