Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/panel/advanced/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<plugin name>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.
Expand Down Expand Up @@ -342,4 +370,4 @@ And that's it! Now you can take the zip file and share it with the world!
<Admonition type="info" title="License">
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.
</Admonition>
</Admonition>