tag view links/views

This commit is contained in:
Alexander Yakovlev 2022-09-06 12:07:08 +07:00
parent ed9cc0ad46
commit 3d823b10d5
Signed by: oreolek
GPG key ID: 8D24103F5EE2A6C0
5 changed files with 17 additions and 4 deletions

View file

@ -8,5 +8,9 @@ class TagController extends Controller
{
public function view($id) {
$tag = Tag::findOrFail($id);
$posts = $tag->posts()->published()->orderBy('posted_at', 'DESC')->simplePaginate(15);
return view('read', [
'items' => $posts
]);
}
}

View file

@ -146,7 +146,8 @@ class ViewComposer extends GenericView
$tags = $this->item->tags()->get();
$retval = '';
foreach($tags as $tag) {
$retval .= Html::el('a', ['href' => route('tag', $tag->id)]);
$retval .= Html::el('a', $tag->name)
->setAttribute('href', route('tag.view', $tag->id));
}
return $retval;
}

View file

@ -80,7 +80,7 @@ return [
|
*/
'locale' => 'ru',
'locale' => 'en',
/*
|--------------------------------------------------------------------------
@ -93,7 +93,7 @@ return [
|
*/
'fallback_locale' => 'en',
'fallback_locale' => 'ru',
/*
|--------------------------------------------------------------------------

View file

@ -0,0 +1,5 @@
<?php
return [
'Tags:' => 'Метки:',
];

View file

@ -24,7 +24,10 @@
@if (!empty($load_comments_action))
<a name="comments"></a>
@endif
{!! $tags !!}
@if (!empty($tags))
{{ _('Tags:') }}
{!! $tags !!}
@endif
@if (!empty($load_comments_action))
<div id="comments" data-url="{!! $load_comments_action !!}"></div>
<div id="new_comment" data-url="{!! $load_comment_form_action !!}"></div>