Php ID字段未显示(在Larave从6.x更新到7.x和Nova 2.x更新到3.x之后)

Php ID字段未显示(在Larave从6.x更新到7.x和Nova 2.x更新到3.x之后),php,laravel,composer-php,laravel-nova,Php,Laravel,Composer Php,Laravel Nova,昨天我把Laravel从6.x升级到了7.x,把Nova从2.x升级到了3.x。但是,由于我这样做了,ids在使用id::make()时不再显示在Nova上的表中。甚至连ID::make('ID','ID'),ID::make()->asBigInt()或ID::make('ID','ID')->asBigInt()都没有工作,我不知道为什么 这会影响我所有的Nova型号,而不是我在这里发布的型号。这只是一个示例模型,因为它很薄 你知道为什么Nova不能解析我模型的ids吗?当使用Text::m

昨天我把Laravel从6.x升级到了7.x,把Nova从2.x升级到了3.x。但是,由于我这样做了,
id
s在使用
id::make()
时不再显示在Nova上的表中。甚至连
ID::make('ID','ID')
ID::make()->asBigInt()
ID::make('ID','ID')->asBigInt()
都没有工作,我不知道为什么

会影响我所有的Nova型号,而不是我在这里发布的型号。这只是一个示例模型,因为它很薄

你知道为什么Nova不能解析我模型的
id
s吗?当使用
Text::make('ID','ID')
时,我看到
ID
。但是为什么不使用
ID::make()

这是我的模型:

namespace App;

use Gwd\SeoMeta\Traits\SeoSitemapTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use Gwd\SeoMeta\Traits\SeoMetaTrait;

class Page extends Model
{
    use SeoMetaTrait, SeoSitemapTrait;

    protected static function boot()
    {
        parent::boot();
        static::creating(function ($page) {
            if (!$page->user_id){
                $page->user_id = Auth::id();
            }
        });
    }

    /**
     * @Protected_variables
     */

    protected $table = 'pages';

    protected $guarded = ['id'];

    protected $casts = [
        'publish_at' => 'datetime',
        'created_at' => 'datetime',
        'updated_at' => 'datetime'
    ];

    /**
     * @Public_variables
     */

    /**
     * @Relationships
     */

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public function pageStatus()
    {
        return $this->belongsTo('App\PageStatus');
    }

    public function pageType()
    {
        return $this->belongsTo('App\PageType');
    }
这是我的Nova模型:

<?php

namespace App\Nova;

use Epartment\NovaDependencyContainer\HasDependencies;
use Epartment\NovaDependencyContainer\NovaDependencyContainer;
use Froala\NovaFroalaField\Froala;
use Gwd\SeoMeta\SeoMeta;
use Illuminate\Http\Request;
use Inspheric\Fields\Indicator;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\DateTime;
use Pdewit\ExternalUrl\ExternalUrl;
use App\PageStatus;

class Page extends Resource
{
    use HasDependencies;

    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = \App\Page::class;

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

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

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

            Text::make('Title')
                ->rules('required', 'max:255'),

            ExternalUrl::make('Product Link', 'slug')
                ->onlyOnDetail(),

            Text::make('Slug', 'slug')
                ->hideFromIndex()
                ->creationRules('unique:pages,slug')
                ->rules('required', 'alpha_dash', 'max:80'),

            Froala::make('Content')
                ->hideFromIndex()
                ->rules('required'),

            Indicator::make('Status', function() {
                return $this->pageStatus->status;
            })
                ->labels([
                    'publish' => 'Publish',
                    'future' => 'Future',
                    'draft' => 'Draft',
                    'pending' => 'Pending',
                    'private' => 'Privat'
                ])
                ->colors([
                    'publish' => 'green',
                    'future' => 'purple',
                    'draft' => 'blue',
                    'pending' => 'orange',
                    'private' => 'red'
                ]),

            BelongsTo::make('Status', 'pageStatus', 'App\Nova\PageStatus')
                ->onlyOnForms(),

            NovaDependencyContainer::make([
                DateTime::make('When to Publish', 'publish_at')
                    ->format('DD.MM.YYYY @ HH:MM:SS')
                    ->rules('required', 'date_format:Y-m-d H:i:s')
            ])->dependsOn('pageStatus', PageStatus::getIdByStatus('future')),

            BelongsTo::make('Type', 'pageType', 'App\Nova\PageType')
                ->viewable(false)
                ->sortable(),

            BelongsTo::make('User', 'user'),

            SeoMeta::make('SEO', 'seo_meta'),
        ];
    }

    /**
     * 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 [];
    }
}


<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pages', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedBigInteger('user_id')->index();
            $table->char('title')->index();
            $table->char('slug')->index()->unique();
            $table->text('content');
            $table->unsignedBigInteger('page_type_id')->index();
            $table->unsignedBigInteger('post_category_id')->index()->nullable();
            $table->unsignedBigInteger('page_status_id')->index();
            $table->timestamp('publish_at')->nullable();
            $table->softDeletesTz();
            $table->timestamps();

            $table->foreign('user_id')
                ->references('id')
                ->on('users')
                ->onDelete('restrict');

            $table->foreign('page_type_id')
                ->references('id')
                ->on('page_types')
                ->onDelete('restrict');

            $table->foreign('post_category_id')
                ->references('id')
                ->on('post_categories')
                ->onDelete('restrict');

            $table->foreign('page_status_id')
                ->references('id')
                ->on('page_statuses')
                ->onDelete('restrict');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pages');
    }
}