diff --git a/app/Filament/Admin/Resources/GlobalSettingsResource.php b/app/Filament/Admin/Resources/GlobalSettingsResource.php index 4c8b04e..9b0f524 100644 --- a/app/Filament/Admin/Resources/GlobalSettingsResource.php +++ b/app/Filament/Admin/Resources/GlobalSettingsResource.php @@ -3,19 +3,12 @@ namespace App\Filament\Admin\Resources; use App\Filament\Admin\Resources\GlobalSettingsResource\Pages; -use App\Filament\Admin\Resources\GlobalSettingsResource\RelationManagers; -use App\Models\GlobalSettings; -use App\Models\SiteSettings; -use Faker\Provider\ar_EG\Text; -use Filament\Forms; -use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Resources\Resource; +use Filament\Forms; use Filament\Tables; -use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; -use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\SoftDeletingScope; +use Intelrx\Sitesettings\Models\SiteSettings; class GlobalSettingsResource extends Resource { @@ -27,40 +20,10 @@ class GlobalSettingsResource extends Resource public static function form(Form $form): Form { - // $table->string('name')->nullable(); - // $table->string('currency')->nullable(); - // $table->string('default_language')->nullable(); - // $table->text('address')->nullable(); - // $table->string('country')->nullable(); - // $table->string('email')->nullable(); - // $table->string('phone_01')->nullable(); - // $table->string('phone_02')->nullable(); - // $table->string('phone_03')->nullable(); - // $table->string('phone_04')->nullable(); - // $table->string('facebook')->nullable(); - // $table->string('twitter')->nullable(); - // $table->string('github')->nullable(); - // $table->string('youtube')->nullable(); - // $table->decimal('sales_commission_percentage', 5, 2)->default(1.00); - // $table->decimal('lettings_commission_percentage', 5, 2)->default(8.00); return $form ->schema([ - TextInput::make('name')->autocapitalize('words')->required(), - TextInput::make('currency')->autocapitalize('words')->required(), - TextInput::make('default_language')->autocapitalize('words')->required(), - TextInput::make('address')->autocapitalize('words')->required(), - TextInput::make('country')->autocapitalize('words')->required(), - TextInput::make('email')->autocapitalize('words')->required(), - TextInput::make('phone_01')->autocapitalize('words')->required(), - TextInput::make('phone_02')->autocapitalize('words'), - TextInput::make('phone_03')->autocapitalize('words'), - TextInput::make('phone_04')->autocapitalize('words'), - TextInput::make('facebook')->autocapitalize('words')->required(), - TextInput::make('twitter')->autocapitalize('words')->required(), - TextInput::make('github')->autocapitalize('words')->required(), - TextInput::make('youtube')->autocapitalize('words')->required(), - TextInput::make('sales_commission_percentage')->autocapitalize('words')->required(), - TextInput::make('lettings_commission_percentage')->autocapitalize('words')->required(), + Forms\Components\TextInput::make('key')->label('Title')->required(), + Forms\Components\TextInput::make('value')->required(), ]); } @@ -68,12 +31,8 @@ public static function table(Table $table): Table { return $table ->columns([ - TextColumn::make('name'), - TextColumn::make('currency'), - TextColumn::make('default_language')->label('language'), - TextColumn::make('country'), - TextColumn::make('email'), - TextColumn::make('phone_01')->label('Phone'), + Tables\Columns\TextColumn::make('key')->label('Title'), + Tables\Columns\TextColumn::make('value')->label('Value'), ]) ->filters([ // diff --git a/app/Helpers/SiteSettingsHelper.php b/app/Helpers/SiteSettingsHelper.php deleted file mode 100644 index 325aa33..0000000 --- a/app/Helpers/SiteSettingsHelper.php +++ /dev/null @@ -1,13 +0,0 @@ - Facade::defaultAliases()->merge([ // 'Example' => App\Facades\Example::class, 'Menu' => Spatie\Menu\Laravel\Facades\Menu::class, + 'SiteConfig' => Intelrx\Sitesettings\SiteConfig::class, + ])->toArray(), ]; diff --git a/database/migrations/2023_05_25_000000_create_site_settings_table.php b/database/migrations/2023_05_25_000000_create_site_settings_table.php deleted file mode 100644 index b7c2adc..0000000 --- a/database/migrations/2023_05_25_000000_create_site_settings_table.php +++ /dev/null @@ -1,37 +0,0 @@ -id(); - $table->string('name')->nullable(); - $table->string('currency')->nullable(); - $table->string('default_language')->nullable(); - $table->text('address')->nullable(); - $table->string('country')->nullable(); - $table->string('email')->nullable(); - $table->string('phone_01')->nullable(); - $table->string('phone_02')->nullable(); - $table->string('phone_03')->nullable(); - $table->string('phone_04')->nullable(); - $table->string('facebook')->nullable(); - $table->string('twitter')->nullable(); - $table->string('github')->nullable(); - $table->string('youtube')->nullable(); - $table->decimal('sales_commission_percentage', 5, 2)->default(1.00); - $table->decimal('lettings_commission_percentage', 5, 2)->default(8.00); - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists('site_settings'); - } -}; \ No newline at end of file diff --git a/database/seeders/SiteSettingsSeeder.php b/database/seeders/SiteSettingsSeeder.php index b0b9e3c..65c7b74 100644 --- a/database/seeders/SiteSettingsSeeder.php +++ b/database/seeders/SiteSettingsSeeder.php @@ -3,17 +3,17 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; -use App\Models\SiteSettings; +use Intelrx\Sitesettings\SiteConfig; class SiteSettingsSeeder extends Seeder { public function run() { - SiteSettings::create([ - 'name' => config('app.name', 'Liberu Real Estate'), + $data = [ + 'name' => config('app.name', 'Liberu '), 'currency' => '£', 'default_language' => 'en', - 'address' => '123 Real Estate St, London, UK', + 'address' => '123 St, London, UK', 'country' => 'United Kingdom', 'email' => 'info@liberurealestate.com', 'phone_01' => '+44 123 456 7890', @@ -24,6 +24,10 @@ public function run() 'twitter' => 'https://twitter.com/liberusoftware', 'github' => 'https://Github.com/liberusoftware', 'youtube' => 'https://YouTube.com/@liberusoftware', - ]); + ]; + + foreach ($data as $key => $value) { + SiteConfig::store($key, $value); + } } } \ No newline at end of file diff --git a/resources/views/livewire/footer.blade.php b/resources/views/livewire/footer.blade.php index 270a371..63288c7 100644 --- a/resources/views/livewire/footer.blade.php +++ b/resources/views/livewire/footer.blade.php @@ -23,7 +23,7 @@