feat: add general, SEO, and social media settings pages with corresponding forms for enhanced configuration options
This commit is contained in:
parent
2c4761d643
commit
25d360983b
49
app/Filament/Pages/Settings/General/Index.php
Normal file
49
app/Filament/Pages/Settings/General/Index.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages\Settings\General;
|
||||||
|
|
||||||
|
use App\Filament\Pages\Settings\General\Schemas\GeneralSettingsForm;
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
|
use App\Settings\GeneralSettings;
|
||||||
|
use BackedEnum;
|
||||||
|
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\SettingsPage;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Support\Icons\Heroicon;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class Index extends SettingsPage
|
||||||
|
{
|
||||||
|
use HasPageShield;
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth;
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Umum';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
|
protected static ?string $slug = 'settings/general';
|
||||||
|
|
||||||
|
protected static string $settings = GeneralSettings::class;
|
||||||
|
|
||||||
|
protected static ?string $title = 'Umum';
|
||||||
|
|
||||||
|
public static function canAccess(): bool
|
||||||
|
{
|
||||||
|
return Filament::auth()->user()->can('View:GeneralSettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return GeneralSettingsForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSavedNotification(): ?Notification
|
||||||
|
{
|
||||||
|
return CheerfulNotification::update();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,39 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Pages\Settings;
|
namespace App\Filament\Pages\Settings\General\Schemas;
|
||||||
|
|
||||||
use App\Filament\Support\CheerfulNotification;
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use App\Settings\GeneralSettings;
|
|
||||||
use BackedEnum;
|
|
||||||
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
|
||||||
use Filament\Forms\Components\FileUpload;
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\RichEditor;
|
use Filament\Forms\Components\RichEditor;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Pages\SettingsPage;
|
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use UnitEnum;
|
|
||||||
|
|
||||||
class ManageGeneralSettings extends SettingsPage
|
class GeneralSettingsForm
|
||||||
{
|
{
|
||||||
use HasPageShield;
|
public static function configure(Schema $schema): Schema
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth;
|
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Umum';
|
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
|
||||||
|
|
||||||
protected static string $settings = GeneralSettings::class;
|
|
||||||
|
|
||||||
protected static ?string $title = 'Umum';
|
|
||||||
|
|
||||||
public function form(Schema $schema): Schema
|
|
||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
@ -106,9 +85,4 @@ public function form(Schema $schema): Schema
|
|||||||
])
|
])
|
||||||
->columns(3);
|
->columns(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSavedNotification(): ?Notification
|
|
||||||
{
|
|
||||||
return CheerfulNotification::update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
48
app/Filament/Pages/Settings/Seo/Index.php
Normal file
48
app/Filament/Pages/Settings/Seo/Index.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages\Settings\Seo;
|
||||||
|
|
||||||
|
use App\Filament\Pages\Settings\Seo\Schemas\SeoSettingsForm;
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
|
use App\Settings\SeoSettings;
|
||||||
|
use BackedEnum;
|
||||||
|
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\SettingsPage;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Support\Icons\Heroicon;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class Index extends SettingsPage
|
||||||
|
{
|
||||||
|
use HasPageShield;
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedMagnifyingGlass;
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'SEO';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 3;
|
||||||
|
|
||||||
|
protected static ?string $slug = 'settings/seo';
|
||||||
|
|
||||||
|
protected static string $settings = SeoSettings::class;
|
||||||
|
|
||||||
|
protected static ?string $title = 'SEO';
|
||||||
|
|
||||||
|
public static function canAccess(): bool
|
||||||
|
{
|
||||||
|
return auth()->user()->can('View:SeoSettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return SeoSettingsForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSavedNotification(): ?Notification
|
||||||
|
{
|
||||||
|
return CheerfulNotification::update();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,37 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Pages\Settings;
|
namespace App\Filament\Pages\Settings\Seo\Schemas;
|
||||||
|
|
||||||
use App\Filament\Support\CheerfulNotification;
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use App\Settings\SeoSettings;
|
|
||||||
use BackedEnum;
|
|
||||||
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Pages\SettingsPage;
|
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use UnitEnum;
|
|
||||||
|
|
||||||
class ManageSeoSettings extends SettingsPage
|
class SeoSettingsForm
|
||||||
{
|
{
|
||||||
use HasPageShield;
|
public static function configure(Schema $schema): Schema
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedMagnifyingGlass;
|
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'SEO';
|
|
||||||
|
|
||||||
protected static ?int $navigationSort = 3;
|
|
||||||
|
|
||||||
protected static string $settings = SeoSettings::class;
|
|
||||||
|
|
||||||
protected static ?string $title = 'SEO';
|
|
||||||
|
|
||||||
public function form(Schema $schema): Schema
|
|
||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
@ -60,9 +39,4 @@ public function form(Schema $schema): Schema
|
|||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSavedNotification(): ?Notification
|
|
||||||
{
|
|
||||||
return CheerfulNotification::update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
48
app/Filament/Pages/Settings/SocialMedia/Index.php
Normal file
48
app/Filament/Pages/Settings/SocialMedia/Index.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages\Settings\SocialMedia;
|
||||||
|
|
||||||
|
use App\Filament\Pages\Settings\SocialMedia\Schemas\SocialMediaSettingsForm;
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
|
use App\Settings\SocialMediaSettings;
|
||||||
|
use BackedEnum;
|
||||||
|
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\SettingsPage;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Support\Icons\Heroicon;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class Index extends SettingsPage
|
||||||
|
{
|
||||||
|
use HasPageShield;
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShare;
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Media Sosial';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
|
protected static ?string $slug = 'settings/social-media';
|
||||||
|
|
||||||
|
protected static string $settings = SocialMediaSettings::class;
|
||||||
|
|
||||||
|
protected static ?string $title = 'Media Sosial';
|
||||||
|
|
||||||
|
public static function canAccess(): bool
|
||||||
|
{
|
||||||
|
return auth()->user()->can('View:SocialMediaSettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return SocialMediaSettingsForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSavedNotification(): ?Notification
|
||||||
|
{
|
||||||
|
return CheerfulNotification::update();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,37 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Pages\Settings;
|
namespace App\Filament\Pages\Settings\SocialMedia\Schemas;
|
||||||
|
|
||||||
use App\Filament\Support\CheerfulNotification;
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use App\Settings\SocialMediaSettings;
|
|
||||||
use BackedEnum;
|
|
||||||
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Pages\SettingsPage;
|
|
||||||
use Filament\Schemas\Components\Grid;
|
use Filament\Schemas\Components\Grid;
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use UnitEnum;
|
|
||||||
|
|
||||||
class ManageSocialMediaSettings extends SettingsPage
|
class SocialMediaSettingsForm
|
||||||
{
|
{
|
||||||
use HasPageShield;
|
public static function configure(Schema $schema): Schema
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Pengaturan';
|
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShare;
|
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Media Sosial';
|
|
||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
|
||||||
|
|
||||||
protected static string $settings = SocialMediaSettings::class;
|
|
||||||
|
|
||||||
protected static ?string $title = 'Media Sosial';
|
|
||||||
|
|
||||||
public function form(Schema $schema): Schema
|
|
||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
@ -69,9 +48,4 @@ public function form(Schema $schema): Schema
|
|||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSavedNotification(): ?Notification
|
|
||||||
{
|
|
||||||
return CheerfulNotification::update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -152,11 +152,11 @@ public function run(): void
|
|||||||
"Replicate:Location",
|
"Replicate:Location",
|
||||||
"Reorder:Location",
|
"Reorder:Location",
|
||||||
|
|
||||||
"View:ManageGeneralSettings",
|
"View:GeneralSettings",
|
||||||
|
|
||||||
"View:ManageSeoSettings",
|
"View:SeoSettings",
|
||||||
|
|
||||||
"View:ManageSocialMediaSettings",
|
"View:SocialMediaSettings",
|
||||||
|
|
||||||
"View:MediaClassificationChart",
|
"View:MediaClassificationChart",
|
||||||
|
|
||||||
@ -413,11 +413,11 @@ public function run(): void
|
|||||||
"Replicate:Location",
|
"Replicate:Location",
|
||||||
"Reorder:Location",
|
"Reorder:Location",
|
||||||
|
|
||||||
"View:ManageGeneralSettings",
|
"View:GeneralSettings",
|
||||||
|
|
||||||
"View:ManageSeoSettings",
|
"View:SeoSettings",
|
||||||
|
|
||||||
"View:ManageSocialMediaSettings",
|
"View:SocialMediaSettings",
|
||||||
|
|
||||||
"View:MediaClassificationChart",
|
"View:MediaClassificationChart",
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user