-
Notifications
You must be signed in to change notification settings - Fork 34
Closed as not planned
Closed as not planned
Copy link
Description
- Laravel Version: 9.52.10
- Nova Version: 4.26.4
- PHP Version: 8.1.13
Description:
I have a Product Nova Resource in which I would like to have very separate fields for Index and Details. The reason for this is that I have a very complex custom field which I do not want to show on Index. Nova's Filter function does not respect it.
When you open the Index page of the resource (code) below, you get an Exception on /nova-api/products/filters. I think fieldsForDetail should not be run / evaluated on Index page.
Detailed steps to reproduce the issue on a fresh Nova installation:
<?php
namespace App\Nova;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class Product extends Resource
{
public static $model = \App\Models\Assets\Product::class;
public function fields(NovaRequest $request)
{
return [];
}
public function fieldsForIndex(NovaRequest $request)
{
return [
Text::make('Label'),
];
}
public function fieldsForDetail(NovaRequest $request)
{
throw new \Exception('it was called');
return [];
}
public function fieldsForCreate(NovaRequest $request)
{
return $this->fieldsForDetail($request);
}
public function fieldsForUpdate(NovaRequest $request)
{
return $this->fieldsForDetail($request);
}
}
Metadata
Metadata
Assignees
Labels
No labels