每当我尝试使用控制器在Postman中创建发布请求时,都会收到该错误,我认为正是此Model引起了问题。我该如何解决该错误?我认为json_decode引起了问题。请帮我。谢谢
<?php
namespace App;
use Illuminate\Database\Eloquent\SoftDeletes;
class Group extends BaseModel
{
use SoftDeletes;
/**
* The connection name for the model.
*
* @var string
*/
protected $connection = 'mysql-core';
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'deleted_at'
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'uuid',
'organization_id',
'name',
'description',
'allowed_members',
];
public function setAllowedMembersAttribute($value)
{
if (empty($value)) {
$value = [];
}
$this->attributes['allowed_members'] = json_encode($value, JSON_HEX_QUOT | JSON_HEX_TAG);
}
public function getAllowedMembersAttribute($value)
{
if ($value === null) {
return [];
}
return json_decode($value);
}
}