From 112c317b0ee51bae8ccfa91b3f13e143ced2d456 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 30 Jan 2023 16:11:59 +0500 Subject: [PATCH] from server 30.01.23 --- plugins/rainlab/blog/models/Post.php | 12 +++++++----- plugins/rainlab/blog/models/post/columns.yaml | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 0dba6f4c5..2f7525638 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -234,12 +234,14 @@ class Post extends Model // \Log::info($fields->category_groups->value); // \Log::info($fields->category_groupsq->value); - + if (isset($this->awtor)) { - if ($this->awtor->type == 'other') { + if ($this->awtor->type == 'other' && $context == "create") { $fields->author_name->value = ''; $fields->author_name->readOnly = false; - } elseif (isset($fields->author_name)) { + } elseif ($this->awtor->type == 'other' && $context == "update") { + $fields->author_name->readOnly = false; + }elseif (isset($fields->author_name)) { $fields->author_name->value = $this->awtor->name; $fields->author_name->readOnly = true; } @@ -277,8 +279,8 @@ class Post extends Model $fields->categories->value = null; } - \Log::info($fields->category_groups->value); - \Log::info($this->category_groups); + //\Log::info($fields->category_groups->value); + // \Log::info($this->category_groups); if($this->category_groups->where('type', 'news')->count()){ $fields->type_post->hidden = false; diff --git a/plugins/rainlab/blog/models/post/columns.yaml b/plugins/rainlab/blog/models/post/columns.yaml index d8052b16a..5efa68184 100644 --- a/plugins/rainlab/blog/models/post/columns.yaml +++ b/plugins/rainlab/blog/models/post/columns.yaml @@ -59,3 +59,8 @@ columns: sortable: false select: name relation: awtor + author_name: + label: 'Awtor Ady' + type: text + searchable: true + sortable: true