diff --git a/config/prezet.php b/config/prezet.php index 3cc42c1..be484cd 100644 --- a/config/prezet.php +++ b/config/prezet.php @@ -1,18 +1,6 @@ 'prezet', - /* |-------------------------------------------------------------------------- | Data Classes diff --git a/routes/web.php b/routes/prezet.php similarity index 75% rename from routes/web.php rename to routes/prezet.php index f76122a..2c70171 100644 --- a/routes/web.php +++ b/routes/prezet.php @@ -6,7 +6,7 @@ use BenBjurstrom\Prezet\Http\Controllers\ShowController; use Illuminate\Support\Facades\Route; -Route::get(config('prezet.image.path').'{path}', ImageController::class) +Route::get('prezet/{path}', ImageController::class) ->name('prezet.image') ->where('path', '.*'); @@ -14,10 +14,10 @@ ->name('prezet.ogimage') ->where('slug', '.*'); -Route::get(config('prezet.path'), IndexController::class) +Route::get('prezet', IndexController::class) ->name('prezet.index'); -Route::get(config('prezet.path').'/{slug}', ShowController::class) +Route::get('prezet/{slug}', ShowController::class) ->name('prezet.show') ->where('slug', '.*'); // https://laravel.com/docs/11.x/routing#parameters-encoded-forward-slashes diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index c556b3d..9de15ba 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -17,6 +17,7 @@ public function handle(): int { // Add the prezet disk to the filesystems config $this->addStorageDisk(); + $this->addRoutes(); $this->copyContentStubs(); $this->publishVendorFiles(); $this->copyTailwindFiles(); @@ -25,6 +26,13 @@ public function handle(): int return self::SUCCESS; } + protected function addRoutes() + { + $files = new Filesystem; + $files->copy(__DIR__.'/../../routes/prezet.php', base_path('routes/prezet.php')); + $files->append(base_path('routes/web.php'), "require __DIR__.'/prezet.php';"); + } + protected function copyTailwindFiles() { $files = new Filesystem; diff --git a/src/PrezetServiceProvider.php b/src/PrezetServiceProvider.php index 00dc69b..967b07e 100644 --- a/src/PrezetServiceProvider.php +++ b/src/PrezetServiceProvider.php @@ -20,7 +20,6 @@ public function configurePackage(Package $package): void ->name('prezet') ->hasConfigFile() ->hasViews('prezet') - ->hasRoute('web') ->hasCommands([ OgimageCommand::class, InstallCommand::class, diff --git a/stubs/prezet/.obsidian/app.json b/stubs/prezet/.obsidian/app.json index def9f67..988d035 100644 --- a/stubs/prezet/.obsidian/app.json +++ b/stubs/prezet/.obsidian/app.json @@ -6,4 +6,4 @@ "tabSize": 2, "newFileLocation": "folder", "newFileFolderPath": "content" -} +} \ No newline at end of file diff --git a/stubs/prezet/.obsidian/appearance.json b/stubs/prezet/.obsidian/appearance.json index 992f7d4..c8c365d 100644 --- a/stubs/prezet/.obsidian/appearance.json +++ b/stubs/prezet/.obsidian/appearance.json @@ -1,3 +1,3 @@ { "accentColor": "" -} +} \ No newline at end of file diff --git a/stubs/prezet/.obsidian/community-plugins.json b/stubs/prezet/.obsidian/community-plugins.json index b54e1b9..ebe8b38 100644 --- a/stubs/prezet/.obsidian/community-plugins.json +++ b/stubs/prezet/.obsidian/community-plugins.json @@ -1,4 +1,4 @@ [ "image-converter", "janitor" -] +] \ No newline at end of file diff --git a/stubs/prezet/.obsidian/core-plugins-migration.json b/stubs/prezet/.obsidian/core-plugins-migration.json index 26dca85..436f43c 100644 --- a/stubs/prezet/.obsidian/core-plugins-migration.json +++ b/stubs/prezet/.obsidian/core-plugins-migration.json @@ -27,4 +27,4 @@ "file-recovery": true, "publish": false, "sync": false -} +} \ No newline at end of file diff --git a/stubs/prezet/.obsidian/core-plugins.json b/stubs/prezet/.obsidian/core-plugins.json index 90b8eac..9405bfd 100644 --- a/stubs/prezet/.obsidian/core-plugins.json +++ b/stubs/prezet/.obsidian/core-plugins.json @@ -17,4 +17,4 @@ "outline", "word-count", "file-recovery" -] +] \ No newline at end of file