0
私はグループモデルをスラッグで保存しようとしていますが、スラッグを未翻訳バージョンの名前で保存しています。Laravel slug transltionsを無効にする
強制的に入力値を使用する方法はありますか?
これはモデルです:
class Group extends Model
{
use CrudTrait;
use Sluggable, SluggableScopeHelpers;
use HasTranslations;
protected $table = 'groups';
protected $primaryKey = 'id';
protected $fillable = ['name', 'slug'];
protected $hidden = ['pivot'];
protected $translatable = ['name'];
public $timestamps = true;
*/
public function users()
{
return $this->belongsToMany(User::class);
}
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable()
{
return [
'slug' => [
'source' => 'name'
],
];
}
}
そして今、私は名前などを入れたときにtest
これは私のスラッグの値を{"en":"{\"en\":\"test\"}"}
として保存します
通常の代わりにtest
誰かが私が間違っているかもしれないことを知っていますか?
私はLaravelのバックパックも使用しています。