nova-mega-filter
nova-mega-filter copied to clipboard
Undefined array key: 'symbol'
I have this really simple Mega filter to allow toggling of column visibility: But when loading the page it says: undefined array key "symbol"
It gives that for all table columns, except for "Name" - What could be the reason for this?
<?php
namespace App\Nova;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use DigitalCreative\MegaFilter\MegaFilter;
use Laravel\Nova\Http\Requests\NovaRequest;
use DigitalCreative\MegaFilter\HasMegaFilterTrait;
use DigitalCreative\MegaFilter\Column;
class Post extends Resource
{
use HasMegaFilterTrait;
public static $model = \App\Models\Post::class;
public static $title = 'symbol';
public static $tableStyle = 'tight';
public static $showColumnBorders = true;
public static $search = ['id',
'symbol',
'name',
];
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
Text::make('Name')->sortable(),
Text::make('Symbol')->sortable(),
];
}
/**
* Get the cards available for the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function cards(Request $request)
{
return [
MegaFilter::make([
'columns' => [
Column::make('Name', 'name'),
Column::make('Symbol', 'symbol'),
]
])
];
}
/**
* Get the filters available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function filters(Request $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function lenses(Request $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function actions(Request $request)
{
return [];
}
}