belongsTo(User::class)->removeOption('soft_delete'); } public function setCustomAttr($value){ if(!$value){ $value=[]; } return json_encode($value,JSON_UNESCAPED_UNICODE); } public function getCustomAttr($value){ $data=json_decode($value,true); static $config; if(!$config){ $config=config('site.userApprove')?:[]; } $res=[]; foreach ($config as $key=>$title){ $res[]=[ 'key'=>$key, 'title'=>$title, 'value'=>$data[$key]??'', ]; } return $res; } }