orient img resource author name required

This commit is contained in:
Kerim 2023-01-12 16:30:17 +05:00
parent 0bb170eb98
commit 7b61c934b0
3 changed files with 22 additions and 16 deletions

View File

@ -44,7 +44,8 @@ class Post extends Model
'powerseo_keywords' => 'required',
'excerpt' => 'required',
'awtor' => 'required',
'img_source' => 'required'
'img_source' => ['required', 'not_in:orient,orientnews,Orient,OrientNews,Orient News,Orient news,orient news,ORIENT NEWS,ORIENT,NEWS,orient news,news'],
'author_name' => 'required'
];
/**
@ -178,14 +179,12 @@ class Post extends Model
{
if(isset($this->awtor)){
if($this->awtor->type == 'other'){
$fields->author_name->hidden = false;
$fields->author_name->value = '';
$fields->author_name->readOnly = false;
}elseif(isset($fields->author_name)){
//$fields->author_name->value = null;
$fields->author_name->hidden = true;
$fields->author_name->value = $this->awtor->name;
$fields->author_name->readOnly = true;
}
}else{
//$fields->author_name->hidden = true;
return;
}
if(isset($fields->category_groups)){
@ -555,6 +554,9 @@ class Post extends Model
public function scopeFilterId($query, $id)
{
if(!isset($id)){
return;
}
return $query->where('id', $id);
}

View File

@ -67,9 +67,8 @@ secondaryTabs:
author_name:
label: 'Author Name'
span: auto
hidden: 1
dependsOn:
- awtor
dependsOn: awtor
readOnly: true
type: text
tab: 'rainlab.blog::lang.post.tab_manage'
featured:

View File

@ -75,6 +75,13 @@ function onStart(){
<div class="affiche-item-item">
<div class="affiche-item-top">
<div class="affiche-item-img">
{% if post.featured_image %}
<img src="{{post.featured_image|media}}" alt="{{post.title}}" />
{% endif %}
</div>
<div class="affiche-item-data">
<div class="affiche-item-data">
@ -104,11 +111,9 @@ function onStart(){
</div>
</div>
</div>
<div class="affiche-item-img">
{% if post.featured_image %}
<img src="{{post.featured_image|media}}" alt="{{post.title}}" />
{% endif %}
</div>
</div>
<div class="affiche-item-bottom">
{{post.content|md}}