小编ron*_*res的帖子

Laravel Nova 从另一个字段引用字段值

据我所知,要引用 Nova 字段,您可以在字段函数中使用 $this 对象。

所以我有这段代码,我的问题是这些值是空的,不应该:

  • $this->原点坐标
  • $this->目的地坐标

即使我的索引页显示了带有值的origin_coordinates 和destination_coordinates 字段。

您知道为什么“测量”字段为空吗?这是基于我提到的字段。

谢谢,

    BelongsTo::make('Warehouse')
        ->withoutTrashed()
        ->rules('required')
        ->sortable(),


    BelongsTo::make('Customer')
        ->withoutTrashed()
        ->rules('required')
        ->sortable(),

    BelongsToDependency::make('Consignee')
        ->dependsOn('customer', 'customer_id'),


    Text::make('origin_coordinates', function() {
        return $this->warehouse->longitude . ','. $this->warehouse->latitude;
    }),

    Text::make('destination_coordinates', function() {
        return $this->consignee->longitude . ',' . $this->consignee->latitude;
    }),

    RouteMeasures::make('Measures')    <---- Here is my problems this value is empty and should not
        ->route(
            $this->origin_coordinates,
            $this->destination_coordinates, 
            env('MAPBOX_ACCESS_TOKEN')
        ),

Run Code Online (Sandbox Code Playgroud)

laravel laravel-nova

7
推荐指数
0
解决办法
2041
查看次数

当我使用 Laravel Nova 时,.gitignore 中要包含哪些目录?

我应该避免将 Laravel Nova 应用程序 (.gitignore) 推送到 GitHub 的哪些目录?只是 /nova 目录吗?我想这些目录应该推送到 GitHub,并且我不会影响 Laravel Nova 许可证,对吗?

  • /应用程序/新星
  • /公共/供应商/nova
  • /资源/lang/供应商/nova
  • /资源/视图/供应商/nova

laravel laravel-nova

5
推荐指数
0
解决办法
921
查看次数

标签 统计

laravel ×2

laravel-nova ×2