2017-10-10 15:58:07 +01:00
|
|
|
<?php
|
|
|
|
|
2018-01-15 14:02:13 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2017-10-10 15:58:07 +01:00
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2017-12-19 16:00:42 +00:00
|
|
|
use App\Models\Bookmark;
|
2018-01-15 14:02:13 +00:00
|
|
|
use Illuminate\View\View;
|
2017-10-10 15:58:07 +01:00
|
|
|
|
|
|
|
class BookmarksController extends Controller
|
|
|
|
{
|
2018-01-15 14:02:13 +00:00
|
|
|
/**
|
|
|
|
* Show the most recent bookmarks.
|
|
|
|
*
|
2020-08-09 15:54:10 +01:00
|
|
|
* @return View
|
2018-01-15 14:02:13 +00:00
|
|
|
*/
|
|
|
|
public function index(): View
|
2017-10-10 15:58:07 +01:00
|
|
|
{
|
2017-10-11 18:04:05 +01:00
|
|
|
$bookmarks = Bookmark::latest()->with('tags')->withCount('tags')->paginate(10);
|
2017-10-10 15:58:07 +01:00
|
|
|
|
|
|
|
return view('bookmarks.index', compact('bookmarks'));
|
|
|
|
}
|
2017-10-10 16:17:29 +01:00
|
|
|
|
2018-01-15 14:02:13 +00:00
|
|
|
/**
|
|
|
|
* Show a single bookmark.
|
|
|
|
*
|
2020-08-09 15:54:10 +01:00
|
|
|
* @param Bookmark $bookmark
|
|
|
|
* @return View
|
2018-01-15 14:02:13 +00:00
|
|
|
*/
|
|
|
|
public function show(Bookmark $bookmark): View
|
2017-10-10 16:17:29 +01:00
|
|
|
{
|
2017-10-11 18:04:05 +01:00
|
|
|
$bookmark->loadMissing('tags');
|
|
|
|
|
2017-10-10 16:17:29 +01:00
|
|
|
return view('bookmarks.show', compact('bookmark'));
|
|
|
|
}
|
2017-10-10 15:58:07 +01:00
|
|
|
}
|