diff --git a/kernel/IGTabel/ViewJsonTableEloquentModel.php b/kernel/IGTabel/ViewJsonTableEloquentModel.php index 07a0a96..6d1e3d4 100644 --- a/kernel/IGTabel/ViewJsonTableEloquentModel.php +++ b/kernel/IGTabel/ViewJsonTableEloquentModel.php @@ -3,6 +3,7 @@ namespace kernel\IGTabel; use app\helpers\Debug; +use app\models\User; use Illuminate\Database\Eloquent\Model; class ViewJsonTableEloquentModel @@ -18,7 +19,14 @@ class ViewJsonTableEloquentModel $this->meta['params'] = $params['params'] ?? []; $this->meta['actions'] = $params['actions'] ?? []; - $this->jsonStr = (new JSONCreator($this->meta, $model->toArray()))->getJson(); +// $this->jsonStr = (new JSONCreator($this->meta, $model->toArray()))->getJson(); + $model = $model->toArray(); + if(isset($model['user_id'])) + { + $model['user_id'] = User::find($model['user_id'])->username; + } + + $this->jsonStr = (new JSONCreator($this->meta, $model))->getJson(); } public function getJson(): ?string