approving news items

This commit is contained in:
HolgerHatGarKeineNode
2023-02-11 16:23:24 +01:00
parent 0b3528a4f0
commit a95e6222d2
3 changed files with 94 additions and 74 deletions

View File

@@ -33,19 +33,7 @@ class ArticleOverview extends Component
'tags',
])
->where('type', 'markdown_article')
->when(app()->environment('production'),
function ($query) {
if (auth()->user() && auth()
->user()
->hasRole('news-editor')) {
return;
}
$query
->whereHas('createdBy.roles',
fn($query) => $query->where('roles.name', 'news-editor'))
->where('approved', true);
}
)
->where('news', true)
->orderByDesc('created_at')
->get(),
])->layout('layouts.app', [