[增添]添加了datasource的setting数据库以及默认值
This commit is contained in:
72
vendor/filament/spatie-laravel-settings-plugin/README.md
vendored
Normal file
72
vendor/filament/spatie-laravel-settings-plugin/README.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# Filament Spatie Settings Plugin
|
||||
|
||||
## Installation
|
||||
|
||||
Install the plugin with Composer:
|
||||
|
||||
```bash
|
||||
composer require filament/spatie-laravel-settings-plugin:"^3.2" -W
|
||||
```
|
||||
|
||||
## Preparing your page class
|
||||
|
||||
Settings pages are Filament pages that extend the `Filament\Pages\SettingsPage` class.
|
||||
|
||||
This package uses the [`spatie/laravel-settings` package](https://github.com/spatie/laravel-settings) to store and retrieve settings via the database.
|
||||
|
||||
Before you start, create a settings class in your `app/Settings` directory, and a database migration for it. You can find out more about how to do this in the [Spatie documentation](https://github.com/spatie/laravel-settings#usage).
|
||||
|
||||
Once you've created your settings class, you can create a settings page in Filament for it using the following command:
|
||||
|
||||
```bash
|
||||
php artisan make:filament-settings-page ManageFooter FooterSettings
|
||||
```
|
||||
|
||||
In this example, you have a `FooterSettings` class in your `app/Settings` directory.
|
||||
|
||||
In your new settings page class, generated in the `app/Filament/Pages` directory, you will see the static `$settings` property assigned to the settings class:
|
||||
|
||||
```php
|
||||
protected static string $settings = FooterSettings::class;
|
||||
```
|
||||
|
||||
## Building a form
|
||||
|
||||
You must define a form schema to interact with your settings class inside the `form()` method.
|
||||
|
||||
Since the [Form Builder](https://filamentphp.com/docs/forms) is installed in the Panel Builder by default, you may use any form [fields](https://filamentphp.com/docs/forms/fields) or [layout components](https://filamentphp.com/docs/forms/layout) you like:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('copyright')
|
||||
->label('Copyright notice')
|
||||
->required(),
|
||||
Repeater::make('links')
|
||||
->schema([
|
||||
TextInput::make('label')->required(),
|
||||
TextInput::make('url')
|
||||
->url()
|
||||
->required(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
```
|
||||
|
||||
The name of each form field must correspond with the name of the property on your settings class.
|
||||
|
||||
The form will automatically be filled with settings from the database, and saved without any extra work.
|
||||
|
||||
## Publishing translations
|
||||
|
||||
If you wish to translate the package, you may publish the language files using:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=filament-spatie-laravel-settings-plugin-translations
|
||||
```
|
||||
35
vendor/filament/spatie-laravel-settings-plugin/composer.json
vendored
Normal file
35
vendor/filament/spatie-laravel-settings-plugin/composer.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "filament/spatie-laravel-settings-plugin",
|
||||
"description": "Filament support for `spatie/laravel-settings`.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/filamentphp/filament",
|
||||
"support": {
|
||||
"issues": "https://github.com/filamentphp/filament/issues",
|
||||
"source": "https://github.com/filamentphp/filament"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"filament/filament": "self.version",
|
||||
"illuminate/console": "^10.45|^11.0",
|
||||
"illuminate/filesystem": "^10.45|^11.0",
|
||||
"illuminate/support": "^10.45|^11.0",
|
||||
"spatie/laravel-settings": "^2.2|^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Filament\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Filament\\SpatieLaravelSettingsPluginServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ar/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ar/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'حفظ التغييرات',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'تم الحفظ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/az/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/az/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Yadda saxla',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Yadda saxlanıldı',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/bn/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/bn/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'সংরক্ষণ করুন',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'সংরক্ষিত হয়েছে',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ca/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ca/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Desar canvis',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Canvis desats',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ckb/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ckb/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'نوێکردنەوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'نوێکرایەوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/cs/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/cs/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Uložit změny',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Uloženo',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/da/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/da/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Gem ændringer',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Gemt',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/de/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/de/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Änderungen speichern',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Gespeichert',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/en/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/en/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Save changes',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Saved',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/es/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/es/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Guardar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Guardado',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/eu/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/eu/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Gorde',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Gordeta',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fa/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fa/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'ذخیره',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'ذخیره شد',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fi/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fi/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Tallenna',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Tallennettu',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fr/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/fr/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Sauvegarder',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Sauvegardé',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/he/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/he/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'שמור שינויים',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'נשמר בהצלחה',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hr/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hr/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Spremi promjene',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Spremljeno',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hu/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hu/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Változtatások mentése',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Mentve',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hy/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/hy/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Պահպանել',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Պահպանվել է',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/id/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/id/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Simpan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Pengaturan berhasil disimpan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/it/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/it/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Salva',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Salvato',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ja/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ja/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => '変更を保存',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => '保存しました',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/km/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/km/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'រក្សាទុកការផ្លាស់ប្តូរ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'បានរក្សាទុក',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ku/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ku/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'نوێکردنەوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'نوێکرایەوە',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/lt/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/lt/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Išsaugoti pakeitimus',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Išsaugota',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ms/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ms/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Simpan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Disimpan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/nl/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/nl/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Wijzigingen opslaan',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Opgeslagen',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/no/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/no/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Lagre endringer',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Lagret',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/np/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/np/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'परिवर्तनहरू सुरक्षित गर्नुहोस',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'सुरक्षित गरियो',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/pt_BR/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/pt_BR/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Salvar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Salvo',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/pt_PT/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/pt_PT/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Guardar alterações',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Guardado',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ro/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ro/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Salvare',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Salvat cu succes',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ru/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/ru/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Сохранить',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Сохранено',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/sk/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/sk/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Uložiť zmeny',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Uložené',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/sv/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/sv/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Spara ändringar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Sparades',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/tr/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/tr/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Kaydet',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Kaydedildi',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/uk/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/uk/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Зберегти',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Збережено',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/uz/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/uz/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'O\'zgarishlarni saqlash',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Saqlandi',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/vi/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/vi/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => 'Lưu thay đổi',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => 'Đã lưu',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/zh_CN/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/zh_CN/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => '保存',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => '已保存',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/zh_TW/pages/settings-page.php
vendored
Normal file
25
vendor/filament/spatie-laravel-settings-plugin/resources/lang/zh_TW/pages/settings-page.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'form' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'save' => [
|
||||
'label' => '保存',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'saved' => [
|
||||
'title' => '已保存',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
12
vendor/filament/spatie-laravel-settings-plugin/resources/views/pages/settings-page.blade.php
vendored
Normal file
12
vendor/filament/spatie-laravel-settings-plugin/resources/views/pages/settings-page.blade.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<x-filament-panels::page>
|
||||
<x-filament-panels::form id="form" wire:submit="save">
|
||||
{{ $this->form }}
|
||||
|
||||
<x-filament-panels::form.actions
|
||||
:actions="$this->getCachedFormActions()"
|
||||
:full-width="$this->hasFullWidthFormActions()"
|
||||
/>
|
||||
</x-filament-panels::form>
|
||||
|
||||
<x-filament-panels::page.unsaved-data-changes-alert />
|
||||
</x-filament-panels::page>
|
||||
12
vendor/filament/spatie-laravel-settings-plugin/src/Commands/Aliases/MakeSettingsPageCommand.php
vendored
Normal file
12
vendor/filament/spatie-laravel-settings-plugin/src/Commands/Aliases/MakeSettingsPageCommand.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands\Aliases;
|
||||
|
||||
use Filament\Commands;
|
||||
|
||||
class MakeSettingsPageCommand extends Commands\MakeSettingsPageCommand
|
||||
{
|
||||
protected $hidden = true;
|
||||
|
||||
protected $signature = 'filament:settings-page {name?} {settingsClass?} {--panel=} {--F|force}';
|
||||
}
|
||||
118
vendor/filament/spatie-laravel-settings-plugin/src/Commands/MakeSettingsPageCommand.php
vendored
Normal file
118
vendor/filament/spatie-laravel-settings-plugin/src/Commands/MakeSettingsPageCommand.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands;
|
||||
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Panel;
|
||||
use Filament\Support\Commands\Concerns\CanIndentStrings;
|
||||
use Filament\Support\Commands\Concerns\CanManipulateFiles;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
use function Laravel\Prompts\select;
|
||||
use function Laravel\Prompts\text;
|
||||
|
||||
class MakeSettingsPageCommand extends Command
|
||||
{
|
||||
use CanIndentStrings;
|
||||
use CanManipulateFiles;
|
||||
|
||||
protected $description = 'Create a new Filament settings page class';
|
||||
|
||||
protected $signature = 'make:filament-settings-page {name?} {settingsClass?} {--panel=} {--F|force}';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$page = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the page name?',
|
||||
placeholder: 'ManageFooter',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
->replace('/', '\\');
|
||||
$pageClass = (string) str($page)->afterLast('\\');
|
||||
$pageNamespace = str($page)->contains('\\') ?
|
||||
(string) str($page)->beforeLast('\\') :
|
||||
'';
|
||||
|
||||
$settingsClass = (string) str($this->argument('settingsClass') ?? text(
|
||||
label: 'What is the settings name?',
|
||||
placeholder: 'FooterSettings',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ');
|
||||
|
||||
$panel = $this->option('panel');
|
||||
|
||||
if ($panel) {
|
||||
$panel = Filament::getPanel($panel, isStrict: false);
|
||||
}
|
||||
|
||||
if (! $panel) {
|
||||
$panels = Filament::getPanels();
|
||||
|
||||
/** @var Panel $panel */
|
||||
$panel = (count($panels) > 1) ? $panels[select(
|
||||
label: 'Which panel would you like to create this in?',
|
||||
options: array_map(
|
||||
fn (Panel $panel): string => $panel->getId(),
|
||||
$panels,
|
||||
),
|
||||
default: Filament::getDefaultPanel()->getId()
|
||||
)] : Arr::first($panels);
|
||||
}
|
||||
|
||||
$pageDirectories = $panel->getPageDirectories();
|
||||
$pageNamespaces = $panel->getPageNamespaces();
|
||||
|
||||
$namespace = (count($pageNamespaces) > 1) ?
|
||||
select(
|
||||
label: 'Which namespace would you like to create this in?',
|
||||
options: $pageNamespaces
|
||||
) :
|
||||
(Arr::first($pageNamespaces) ?? 'App\\Filament\\Pages');
|
||||
$path = (count($pageDirectories) > 1) ?
|
||||
$pageDirectories[array_search($namespace, $pageNamespaces)] :
|
||||
(Arr::first($pageDirectories) ?? app_path('Filament/Pages/'));
|
||||
|
||||
$path = (string) str($page)
|
||||
->prepend('/')
|
||||
->prepend($path)
|
||||
->replace('\\', '/')
|
||||
->replace('//', '/')
|
||||
->append('.php');
|
||||
|
||||
if ($this->checkForCollision([$path])) {
|
||||
return static::INVALID;
|
||||
}
|
||||
|
||||
$potentialCluster = (string) str($namespace)->beforeLast('\Pages');
|
||||
$clusterAssignment = null;
|
||||
$clusterImport = null;
|
||||
|
||||
if (
|
||||
class_exists($potentialCluster) &&
|
||||
is_subclass_of($potentialCluster, Cluster::class)
|
||||
) {
|
||||
$clusterAssignment = $this->indentString(PHP_EOL . PHP_EOL . 'protected static ?string $cluster = ' . class_basename($potentialCluster) . '::class;');
|
||||
$clusterImport = "use {$potentialCluster};" . PHP_EOL;
|
||||
}
|
||||
|
||||
$this->copyStubToApp('SettingsPage', $path, [
|
||||
'class' => $pageClass,
|
||||
'clusterAssignment' => $clusterAssignment,
|
||||
'clusterImport' => $clusterImport,
|
||||
'namespace' => $namespace . ($pageNamespace !== '' ? "\\{$pageNamespace}" : ''),
|
||||
'settingsClass' => $settingsClass,
|
||||
]);
|
||||
|
||||
$this->components->info("Filament settings page [{$path}] created successfully.");
|
||||
|
||||
return static::SUCCESS;
|
||||
}
|
||||
}
|
||||
198
vendor/filament/spatie-laravel-settings-plugin/src/Pages/SettingsPage.php
vendored
Normal file
198
vendor/filament/spatie-laravel-settings-plugin/src/Pages/SettingsPage.php
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Pages;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Forms\ComponentContainer;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Concerns\CanUseDatabaseTransactions;
|
||||
use Filament\Pages\Concerns\HasUnsavedDataChangesAlert;
|
||||
use Filament\Support\Exceptions\Halt;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Throwable;
|
||||
|
||||
use function Filament\Support\is_app_url;
|
||||
|
||||
/**
|
||||
* @property ComponentContainer $form
|
||||
*/
|
||||
class SettingsPage extends Page
|
||||
{
|
||||
use CanUseDatabaseTransactions;
|
||||
use Concerns\InteractsWithFormActions;
|
||||
use HasUnsavedDataChangesAlert;
|
||||
|
||||
protected static string $settings;
|
||||
|
||||
protected static string $view = 'filament-spatie-laravel-settings-plugin::pages.settings-page';
|
||||
|
||||
/**
|
||||
* @var array<string, mixed> | null
|
||||
*/
|
||||
public ?array $data = [];
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->fillForm();
|
||||
}
|
||||
|
||||
protected function fillForm(): void
|
||||
{
|
||||
$this->callHook('beforeFill');
|
||||
|
||||
$settings = app(static::getSettings());
|
||||
|
||||
$data = $this->mutateFormDataBeforeFill($settings->toArray());
|
||||
|
||||
$this->form->fill($data);
|
||||
|
||||
$this->callHook('afterFill');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
$this->beginDatabaseTransaction();
|
||||
|
||||
$this->callHook('beforeValidate');
|
||||
|
||||
$data = $this->form->getState();
|
||||
|
||||
$this->callHook('afterValidate');
|
||||
|
||||
$data = $this->mutateFormDataBeforeSave($data);
|
||||
|
||||
$this->callHook('beforeSave');
|
||||
|
||||
$settings = app(static::getSettings());
|
||||
|
||||
$settings->fill($data);
|
||||
$settings->save();
|
||||
|
||||
$this->callHook('afterSave');
|
||||
|
||||
$this->commitDatabaseTransaction();
|
||||
} catch (Halt $exception) {
|
||||
$exception->shouldRollbackDatabaseTransaction() ?
|
||||
$this->rollBackDatabaseTransaction() :
|
||||
$this->commitDatabaseTransaction();
|
||||
|
||||
return;
|
||||
} catch (Throwable $exception) {
|
||||
$this->rollBackDatabaseTransaction();
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->rememberData();
|
||||
|
||||
$this->getSavedNotification()?->send();
|
||||
|
||||
if ($redirectUrl = $this->getRedirectUrl()) {
|
||||
$this->redirect($redirectUrl, navigate: FilamentView::hasSpaMode() && is_app_url($redirectUrl));
|
||||
}
|
||||
}
|
||||
|
||||
public function getSavedNotification(): ?Notification
|
||||
{
|
||||
$title = $this->getSavedNotificationTitle();
|
||||
|
||||
if (blank($title)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Notification::make()
|
||||
->success()
|
||||
->title($title);
|
||||
}
|
||||
|
||||
public function getSavedNotificationTitle(): ?string
|
||||
{
|
||||
return $this->getSavedNotificationMessage() ?? __('filament-spatie-laravel-settings-plugin::pages/settings-page.notifications.saved.title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `getSavedNotificationTitle()` instead.
|
||||
*/
|
||||
protected function getSavedNotificationMessage(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getSettings(): string
|
||||
{
|
||||
return static::$settings ?? (string) str(class_basename(static::class))
|
||||
->beforeLast('Settings')
|
||||
->prepend('App\\Settings\\')
|
||||
->append('Settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Action | ActionGroup>
|
||||
*/
|
||||
public function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getSaveFormAction(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getSaveFormAction(): Action
|
||||
{
|
||||
return Action::make('save')
|
||||
->label(__('filament-spatie-laravel-settings-plugin::pages/settings-page.form.actions.save.label'))
|
||||
->submit('save')
|
||||
->keyBindings(['mod+s']);
|
||||
}
|
||||
|
||||
public function getSubmitFormAction(): Action
|
||||
{
|
||||
return $this->getSaveFormAction();
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int | string, string | Form>
|
||||
*/
|
||||
protected function getForms(): array
|
||||
{
|
||||
return [
|
||||
'form' => $this->form(
|
||||
$this->makeForm()
|
||||
->schema($this->getFormSchema())
|
||||
->statePath('data')
|
||||
->columns(2)
|
||||
->inlineLabel($this->hasInlineLabels()),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
public function getRedirectUrl(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Filament;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SpatieLaravelSettingsPluginServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->commands($this->getCommands());
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../resources/views' => resource_path('views/vendor/filament-spatie-laravel-settings-plugin'),
|
||||
], 'filament-spatie-laravel-settings-plugin-views');
|
||||
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
$file->getRealPath() => base_path("stubs/filament/{$file->getFilename()}"),
|
||||
], 'filament-stubs');
|
||||
}
|
||||
}
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'filament-spatie-laravel-settings-plugin');
|
||||
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'filament-spatie-laravel-settings-plugin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string>
|
||||
*/
|
||||
protected function getCommands(): array
|
||||
{
|
||||
$commands = [
|
||||
Commands\MakeSettingsPageCommand::class,
|
||||
];
|
||||
|
||||
$aliases = [];
|
||||
|
||||
foreach ($commands as $command) {
|
||||
$class = 'Filament\\Commands\\Aliases\\' . class_basename($command);
|
||||
|
||||
if (! class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aliases[] = $class;
|
||||
}
|
||||
|
||||
return [
|
||||
...$commands,
|
||||
...$aliases,
|
||||
];
|
||||
}
|
||||
}
|
||||
23
vendor/filament/spatie-laravel-settings-plugin/stubs/SettingsPage.stub
vendored
Normal file
23
vendor/filament/spatie-laravel-settings-plugin/stubs/SettingsPage.stub
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
{{ clusterImport }}use App\Settings\{{ settingsClass }};
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
|
||||
class {{ class }} extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
|
||||
|
||||
protected static string $settings = {{ settingsClass }}::class;{{ clusterAssignment }}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
// ...
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user