gpt4 book ai didi

php - 拉拉维尔 : 'Trait ' App\Sluggable' not found' even The Provider Was Added

转载 作者:行者123 更新时间:2023-12-02 20:02:21 38 4
gpt4 key购买 nike

当我尝试将 slug 添加到我的 laravel 项目时出现错误。

这是我的提供商Cviebrock\EloquentSluggable\ServiceProvider::class,

这是我的composer.json

"require": {
....
"cviebrock/eloquent-sluggable": "^4.0"
},

这是我的模型

<?php

...
use Cviebrock\EloquentSluggable\SluggableTrait;

class Artikel extends Model
{
....
use Sluggable;
...
public function sluggable()
{
return [
'slug' => [
'source' => 'artikel_judul'
]
];
}
}

这是我的错误 my error

最佳答案

根据 docs ,应该是这样的

use Cviebrock\EloquentSluggable\Sluggable;

class Artikel extends Model
{
....
use Sluggable;
...

关于php - 拉拉维尔 : 'Trait ' App\Sluggable' not found' even The Provider Was Added,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39179199/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com