feat: add Website Settings, Imap Settings and Configuration Settings via inerba/filament-db-config
This commit is contained in:
108
app/Filament/Pages/WebsiteSettings.php
Normal file
108
app/Filament/Pages/WebsiteSettings.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\KeyValue;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Inerba\DbConfig\AbstractPageSettings;
|
||||
|
||||
class WebsiteSettings extends AbstractPageSettings
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed> | null
|
||||
*/
|
||||
public ?array $data = [];
|
||||
|
||||
protected static ?string $title = 'Website Settings';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth; // Uncomment if you want to set a custom navigation icon
|
||||
|
||||
// protected ?string $subheading = ''; // Uncomment if you want to set a custom subheading
|
||||
|
||||
// protected static ?string $slug = 'website-settings'; // Uncomment if you want to set a custom slug
|
||||
|
||||
protected string $view = 'filament.pages.website-settings';
|
||||
|
||||
protected function settingName(): string
|
||||
{
|
||||
return 'website';
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide default values.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Website Information')
|
||||
->description('Change Basic Website Information')
|
||||
->collapsible()
|
||||
->schema([
|
||||
TextInput::make('app_name')->label('Website Name')->required(),
|
||||
TextInput::make('app_version')->label('Website Version')->required(),
|
||||
TextInput::make('app_base_url')->label('Base URL')->required(),
|
||||
TextInput::make('app_admin')->label('Website Admin')->email()->required(),
|
||||
TextInput::make('app_contact')->label('Contact Email')->email()->required(),
|
||||
]),
|
||||
Section::make('Custom Codes')
|
||||
->description('Add custom codes to header and footer')
|
||||
->collapsed()
|
||||
->columns(2)
|
||||
->schema([
|
||||
Textarea::make('app_header')->label('Custom Header')->rows(6)->columnSpan(1),
|
||||
Textarea::make('app_footer')->label('Custom Footer')->rows(6)->columnSpan(1),
|
||||
]),
|
||||
Section::make('Meta Information')
|
||||
->description('Change Website Meta Information')
|
||||
->collapsed()
|
||||
->schema([
|
||||
TextInput::make('app_title')->label('Title')->required(),
|
||||
Textarea::make('app_description')->label('Description')->rows(3),
|
||||
TextInput::make('app_keyword')->label('Keyword'),
|
||||
KeyValue::make('app_meta')
|
||||
->label('Meta (Optional)')
|
||||
->keyPlaceholder('Name')
|
||||
->valuePlaceholder('Content'),
|
||||
]),
|
||||
Section::make('Social Links')
|
||||
->description('Enter your social links')
|
||||
->collapsed()
|
||||
->schema([
|
||||
|
||||
Repeater::make('app_social')
|
||||
->statePath('app_social')
|
||||
->schema([
|
||||
TextInput::make('icon')->label('Icon')->required()->maxLength(100),
|
||||
TextInput::make('url')->label('URL')->url()->required()->maxLength(255),
|
||||
]),
|
||||
|
||||
]),
|
||||
Section::make('Ad Spaces')
|
||||
->description('You can setup your Ad Codes here for various Ad Spaces')
|
||||
->collapsed()
|
||||
->schema([
|
||||
Textarea::make('ads_settings.one')->label('Ad Space 1')->rows(4),
|
||||
Textarea::make('ads_settings.two')->label('Ad Space 2')->rows(4),
|
||||
Textarea::make('ads_settings.three')->label('Ad Space 3')->rows(4),
|
||||
Textarea::make('ads_settings.four')->label('Ad Space 4')->rows(4),
|
||||
Textarea::make('ads_settings.five')->label('Ad Space 5')->rows(4),
|
||||
]),
|
||||
|
||||
])
|
||||
->statePath('data');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user