From 1256f86cc1c585435f994e0a3cbb93bd9456f2c7 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 9 Jan 2026 09:51:42 +0100 Subject: [PATCH 1/2] add info about routes to plugin docs --- docs/panel/advanced/plugins.mdx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/panel/advanced/plugins.mdx b/docs/panel/advanced/plugins.mdx index 06fc0ae..0c950b8 100644 --- a/docs/panel/advanced/plugins.mdx +++ b/docs/panel/advanced/plugins.mdx @@ -207,6 +207,34 @@ This means you need to prefix view-strings with your plugin id, e.g. `myplugin:: If present, a seeder with the name of your plugin will be automatically registered. It needs to be named `Seeder` (e.g. `MyPluginSeeder`) and put inside your plugins `database/Seeder` folder, e.g. `plugins/myplugin/database/Seeder/MyPluginSeeder.php`. This seeder will be automatically called when a user installs the plugin or when seeders are run in general, e.g. when using `php artisan db:seed` or `php artisan migrate --seed`. +### Routes + +Routes need to be registered in a `RouteServiceProvider`. Example: + +```php +use Illuminate\Foundation\Support\Providers\RouteServiceProvider; + +class MyPluginRoutesProvider extends RouteServiceProvider +{ + public function boot(): void + { + $this->routes(function () { + // Single new endpoint with Controller + Route::get('test', [TestController::class, 'test'])->name('my-plugin.test')); + + // Load routes from file + Route::prefix('/my-plugin')->group(plugin_path('my-plugin', 'routes/web.php')); + + // Add routes from file to existing client api + Route::middleware(['api', 'client-api', 'throttle:api.client']) + ->prefix('/api/client') + ->scopeBindings() + ->group(plugin_path('my-plugin', 'routes/api-client.php')); + }); + } +} +``` + ### Plugin Settings Your main plugin class can implement the `HasPluginSettings` interface to conveniently add a settings page to your plugin. From 3848c2fded0075b66391f48e8ab2c8ede1e32430 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 9 Jan 2026 10:21:52 +0100 Subject: [PATCH 2/2] small fix --- docs/panel/advanced/plugins.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/panel/advanced/plugins.mdx b/docs/panel/advanced/plugins.mdx index 0c950b8..57ec525 100644 --- a/docs/panel/advanced/plugins.mdx +++ b/docs/panel/advanced/plugins.mdx @@ -220,7 +220,7 @@ class MyPluginRoutesProvider extends RouteServiceProvider { $this->routes(function () { // Single new endpoint with Controller - Route::get('test', [TestController::class, 'test'])->name('my-plugin.test')); + Route::get('test', [TestController::class, 'test'])->name('my-plugin.test'); // Load routes from file Route::prefix('/my-plugin')->group(plugin_path('my-plugin', 'routes/web.php')); @@ -370,4 +370,4 @@ And that's it! Now you can take the zip file and share it with the world! You can license your plugin code under whatever license you want. You do not have to use the same license as the panel! You also don't have to open source your plugin code. But if you do want to open source it we recommend [MIT](https://choosealicense.com/licenses/mit) or [GPL v3](https://choosealicense.com/licenses/gpl-3.0) as license. - \ No newline at end of file +