-
routes/web.php
Open in GitHubuse App\Http\Controllers\Links\ApproveLinkAndCreatePostController; use App\Http\Controllers\Links\ApproveLinkController; use Illuminate\Support\Facades\Route; use App\Http\Controllers\Links\RejectLinkController; // Route::prefix('community')->group(function () { // Route::middleware('signed')->group(function () { Route::get('{link}/approve', ApproveLinkController::class)->name('link.approve'); Route::get('{link}/approve-and-create-post', ApproveLinkAndCreatePostController::class)->name('link.approve-and-create-post'); Route::get('{link}/reject', RejectLinkController::class)->name('link.reject'); }); }); //
-
app/Models/Link.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\URL; class Link extends Model { // public function approveUrl(): string { return URL::temporarySignedRoute( 'link.approve', now()->addMonth(), ['link' => $this], ); } public function approveAndCreatePostUrl(): string { return URL::temporarySignedRoute( 'link.approve-and-create-post', now()->addMonth(), ['link' => $this], ); } public function rejectUrl(): string { return URL::temporarySignedRoute( 'link.reject', now()->addMonth(), ['link' => $this], ); } }
-
resources/views/mails/links/submitted.blade.php
Open in GitHub@component('mail::message') Hi, A link titled "[{{ $link->title }}]({{ $link->url }})" was submitted by {{ $link->user->email }}. {{ $link->text }} [Approve]({{ $link->approveUrl() }}) [Approve and create post]({{ $link->approveAndCreatePostUrl() }}) [Reject link]({{ $link->rejectUrl() }}) Kr, Your blog @endcomponent