Skip to content

Commit

Permalink
feat: Add route filament-peek.preview
Browse files Browse the repository at this point in the history
  • Loading branch information
pboivin committed Sep 30, 2023
1 parent 6b4d22c commit a160819
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use Pboivin\FilamentPeek\CachedPreview;

Route::prefix('filament-peek')->group(function () {
Route::get('preview', function () {
abort_unless($token = Request::query('token'), 404);

abort_unless($preview = Cache::get("filament-peek-preview-{$token}"), 404);

/** @var CachedPreview $preview*/
return $preview->render();
})->name('filament-peek.preview');
});
3 changes: 2 additions & 1 deletion src/FilamentPeekServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function configurePackage(Package $package): void
$package->name(FilamentPeekPlugin::ID)
->hasTranslations()
->hasConfigFile()
->hasViews();
->hasViews()
->hasRoute('web');
}
}

0 comments on commit a160819

Please sign in to comment.