Show the tags

This commit is contained in:
Jonny Barnes 2017-10-11 16:30:09 +01:00
parent abe5063c4a
commit 919a6c22ad
3 changed files with 23 additions and 1 deletions

View file

@ -8,7 +8,7 @@ class BookmarksController extends Controller
{ {
public function index() public function index()
{ {
$bookmarks = Bookmark::paginate(10); $bookmarks = Bookmark::with('tags')->latest()->paginate(10);
return view('bookmarks.index', compact('bookmarks')); return view('bookmarks.index', compact('bookmarks'));
} }

View file

@ -17,7 +17,19 @@ Bookmarks «
{{ $bookmark->url }} {{ $bookmark->url }}
@endempty @endempty
</a> &nbsp; <a href="/bookmarks/{{ $bookmark->id }}">🔗</a> </a> &nbsp; <a href="/bookmarks/{{ $bookmark->id }}">🔗</a>
@isset($bookmark->content)
<p>{{ $bookmark->content }}</p>
@endisset
@if(count($bookmark->tags()->get()) > 0)
<ul>
@foreach($bookmark->tags as $tag)
<li><a href="/bookmarks/tagged/{{ $tag->tag }}">{{ $tag->tag }}</a></li>
@endforeach
</ul>
@endif
</div> </div>
@endforeach @endforeach
</div> </div>
{{ $bookmarks->links() }}
@stop @stop

View file

@ -15,5 +15,15 @@ Bookmark «
{{ $bookmark->url }} {{ $bookmark->url }}
@endempty @endempty
</a> </a>
@isset($bookmark->content)
<p>{{ $bookmark->content }}</p>
@endisset
@if(count($bookmark->tags()->get()) > 0)
<ul>
@foreach($bookmark->tags as $tag)
<li><a href="/bookmarks/tagged/{{ $tag->tag }}">{{ $tag->tag }}</a></li>
@endforeach
</ul>
@endif
</div> </div>
@stop @stop