Add tag permalink page
This commit is contained in:
parent
9a5246374e
commit
ab3611cbce
@ -13,7 +13,7 @@ A little project because I haven't made anything new in a while, I would like to
|
||||
* [x] Bookmark editing (title, description, url)
|
||||
* [x] Bookmark tag editing
|
||||
* [ ] Tag cloud
|
||||
* [ ] Tag permalink
|
||||
* [x] Tag permalink
|
||||
* [ ] Multi-user support
|
||||
|
||||
## Developing
|
||||
|
65
app/Http/Controllers/TagController.php
Normal file
65
app/Http/Controllers/TagController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Tag $tag)
|
||||
{
|
||||
return view('tag.show', [ 'tag' => $tag, ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Tag $tag)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Tag $tag)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Tag $tag)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -102,5 +102,17 @@
|
||||
border-radius: 7px;
|
||||
background-color: #9E2A2B;
|
||||
color: #FFF3B0;
|
||||
|
||||
a {
|
||||
&,
|
||||
&:active,
|
||||
&:visited {
|
||||
color: #FFF3B0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<ul class="bookmark-tags">
|
||||
@foreach ($bookmark->tags as $tag)
|
||||
<li class="bookmark-tag">
|
||||
{{ $tag->name }}
|
||||
<a href="{{ action('TagController@show', $tag) }}">{{ $tag->name }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
9
resources/views/tag/show.blade.php
Normal file
9
resources/views/tag/show.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div>
|
||||
@foreach ($tag->bookmarks as $bookmark)
|
||||
<x-bookmark :bookmark="$bookmark" />
|
||||
@endforeach
|
||||
</div>
|
||||
@endsection
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\BookmarkController;
|
||||
use App\Http\Controllers\TagController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get(
|
||||
@ -11,3 +12,9 @@ Route::get(
|
||||
|
||||
Route::resource('bookmarks', BookmarkController::class);
|
||||
Route::post('/bookmarks/{bookmark}', [BookmarkController::class, 'update']);
|
||||
|
||||
Route::resource('tags', TagController::class)->parameters(
|
||||
[
|
||||
'tags' => 'tag:name', // tag names in url, rather than ids
|
||||
]
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user