SingletonResource
You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.
A resource for one entry without the ability to list, add and delete! Perfect for resources with settings. Implements singletonResource in Laravel routing.
To use it, you need to implement the getId method specifying the id of the record in the database.
// ... class SettingResource extends SingletonResource{ public static string $model = Setting::class; public static string $title = 'Settings'; public function getId(): int|string { return 1; }// ...
You can create SingletonResource
using the artisan command
php artisan moonshine:resource Setting --singleton
or
php artisan moonshine:resource Setting --s
with id
php artisan moonshine:resource Setting --s --id=1