Rename Fields
// App\Models\User
// Example URL: ?filter[phone][$eq]=0000000000
// The $renamedFilterFields property is used to map the client-side field names to the actual database column names.
protected $renamedFilterFields = [
'mobile' => 'phone', // The actual database column is 'mobile', but the client should use 'phone'.
'posts' => 'writing', // The actual relation is 'posts', but the client should use 'writing'.
];// App\Models\User
// Example URL: ?sort=phone
// The $sortFields property is used to map the client-side field names to the actual database column names for sorting.
protected $sortFields = [
'name',
'mobile' => 'phone', // The actual database column is 'mobile', but the client should use 'phone' for sorting.
];Last updated