Laravel Nova:TypeError:无法读取未定义的属性“status”

问题描述 投票:0回答:1

一堆我的Nova资源停止了工作。尝试创建它们时,我在控制台中收到以下错误:

Uncaught (in promise) TypeError: Cannot read property 'status' of undefined
at a.<anonymous> (app.js?id=7319bf5027431449796c:1)
at y (app.js?id=7319bf5027431449796c:1)
at Generator._invoke (app.js?id=7319bf5027431449796c:1)
at Generator.e.(anonymous function) [as next] (http://url/vendor/nova/app.js?id=7319bf5027431449796c:1:460720)
at o (app.js?id=7319bf5027431449796c:1)
at app.js?id=7319bf5027431449796c:1
at new Promise (<anonymous>)
at new t (app.js?id=7319bf5027431449796c:1)
at a.<anonymous> (app.js?id=7319bf5027431449796c:1)
at a.<anonymous> (app.js?id=7319bf5027431449796c:1)

根本没有任何内容出现在错误日志中。有什么指向我应该看的地方吗?只影响一些资源,其他人工作正常。

编辑:这是受影响的Nova资源之一:

<?php

namespace App\Nova;

use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Naxon\NovaFieldSortable\Concerns\SortsIndexEntries;
use Naxon\NovaFieldSortable\Sortable;

class Unterprodukt extends Resource
{
    use SortsIndexEntries;
    public static $defaultSortField = 'order';

    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = 'App\Unterprodukt';

    /**
     * Get the displayble label of the resource.
     *
     * @return string
     */
    public static function label()
    {
        return 'Unterprodukte';
    }

    /**
     * Get the displayble singular label of the resource.
     *
     * @return string
     */
    public static function singularLabel()
    {
        return 'Unterprodukt';
    }

    /**
     * The logical group associated with the resource.
     *
     * @var string
     */
    public static $group = 'Versicherung';

    /**
     * The single value that should be used to represent the resource when being displayed.
     *
     * @var string
     */
    public static $title = 'name';

    /**
     * The columns that should be searched.
     *
     * @var array
     */
    public static $search = [
        'id',
        'name',
    ];

    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            ID::make()
                ->sortable()
                ->hideFromIndex(),

            Text::make('Name', 'name')
                ->sortable(),

            BelongsTo::make('Produkt', 'produkt', 'App\Nova\Produkt')
                ->sortable(),

            Sortable::make('Reihenfolge', 'id')
                ->sortable(),

            HasMany::make('Dokumente', 'dokumente', 'App\Nova\Dokument'),
        ];
    }

    /**
     * Get the cards available for the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function cards(Request $request)
    {
        return [];
    }

    /**
     * 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 [];
    }
}
laravel laravel-nova
1个回答
1
投票

对此的快速解决方法就是这样

Sortable::make('Order', 'id')->exceptOnForms()
© www.soinside.com 2019 - 2024. All rights reserved.