【问题标题】:Laravel Nova App\Model not found after resource created创建资源后找不到 Laravel Nova App\Model
【发布时间】:2020-08-11 22:36:38
【问题描述】:

我创建了一个建筑模型和资源,我通过以下方式完成了。

php artisan make:model Building -m

php artisan nova:resource Building

创建了我的迁移,并且工作正常,但我还需要建筑类型,所以我创建了以下内容。

php artisan make:model BuidlingType -m

php artisan nova:resource BuildingType

但是当我想访问仪表板时出现错误:

Class 'App\BuildingType' not found (View: /Users/Username/projects/enest/vendor/laravel/nova/resources/views/layout.blade.php)```

【问题讨论】:

  • 你打错了:php artisan make:model BuidlingType -m,你写的BuidlingType应该是BuildingType
  • 哦,我明白了,非常感谢!

标签: laravel eloquent laravel-nova laravel-migrations


【解决方案1】:

您可以更正资源中的模型:

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

https://nova.laravel.com/docs/2.0/resources/#defining-resources

【讨论】:

    猜你喜欢
    • 2019-04-23
    • 2019-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-24
    • 2019-08-16
    • 2021-03-05
    • 2023-03-19
    相关资源
    最近更新 更多