From b24fe599f7d3c9b66e136e30f0ecc798adc73272 Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:22:26 +0530 Subject: [PATCH 1/6] settinggs helper and old migration were removed --- app/Helpers/SiteSettingsHelper.php | 13 ------- app/Models/SiteSettings.php | 14 ------- ...5_25_000000_create_site_settings_table.php | 37 ------------------- 3 files changed, 64 deletions(-) delete mode 100644 app/Helpers/SiteSettingsHelper.php delete mode 100644 app/Models/SiteSettings.php delete mode 100644 database/migrations/2023_05_25_000000_create_site_settings_table.php 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 @@ -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 From 0d04d89d3327edcf13872a868e70b965edfda501 Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:22:49 +0530 Subject: [PATCH 2/6] sitesettings package installed --- composer.json | 1 + composer.lock | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 17a9bc2..3513f15 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "php": "^8.2", "bezhansalleh/filament-shield": "^3.2", "guzzlehttp/guzzle": "^7.8", + "intelrx/sitesettings": "^1.0", "joelbutcher/socialstream": "*", "laravel/framework": "^11.0", "laravel/jetstream": "*", diff --git a/composer.lock b/composer.lock index 5075d65..22bc545 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dc4ff4163054bd7ef72718638aae1c09", + "content-hash": "79817fc2973eb134fafd63f5fbe1747c", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -2336,6 +2336,53 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "intelrx/sitesettings", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Raza9798/Site-Settings.git", + "reference": "268c7031057f955b1bc6aa5da3b959caad9c30f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Raza9798/Site-Settings/zipball/268c7031057f955b1bc6aa5da3b959caad9c30f2", + "reference": "268c7031057f955b1bc6aa5da3b959caad9c30f2", + "shasum": "" + }, + "require": { + "php": "^8.3" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Intelrx\\Sitesettings\\SitesettingsProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Intelrx\\Sitesettings\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "raza9798", + "email": "m.raza9798@gmail.com" + } + ], + "description": "Application global properties", + "support": { + "issues": "https://github.com/Raza9798/Site-Settings/issues", + "source": "https://github.com/Raza9798/Site-Settings/tree/1.0.0" + }, + "time": "2024-08-29T20:56:05+00:00" + }, { "name": "joelbutcher/socialstream", "version": "v6.1.5", From 23d8d32ee082d690d2207578cca0fe405ffe2ddf Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:25:17 +0530 Subject: [PATCH 3/6] siteconfig provider configured --- config/app.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/app.php b/config/app.php index d70d2d0..151ef0a 100644 --- a/config/app.php +++ b/config/app.php @@ -171,7 +171,7 @@ App\Providers\Filament\AdminPanelProvider::class, App\Providers\Filament\AppPanelProvider::class, App\Providers\RouteServiceProvider::class, - + Intelrx\Sitesettings\SitesettingsProvider::class, App\Providers\TeamServiceProvider::class, App\Providers\JetstreamServiceProvider::class, App\Providers\FortifyServiceProvider::class, @@ -192,6 +192,8 @@ 'aliases' => Facade::defaultAliases()->merge([ // 'Example' => App\Facades\Example::class, 'Menu' => Spatie\Menu\Laravel\Facades\Menu::class, + 'SiteConfig' => Intelrx\Sitesettings\SiteConfig::class, + ])->toArray(), ]; From 95515c5513e2f4767e2c03f53487f8e7c48f0de9 Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:26:41 +0530 Subject: [PATCH 4/6] site settings seeder refectored --- database/seeders/SiteSettingsSeeder.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/database/seeders/SiteSettingsSeeder.php b/database/seeders/SiteSettingsSeeder.php index b0b9e3c..d6ab197 100644 --- a/database/seeders/SiteSettingsSeeder.php +++ b/database/seeders/SiteSettingsSeeder.php @@ -4,16 +4,17 @@ 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 +25,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 From 8392fc7de2779ccb6ae89937f7f242ba72c0863a Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:28:57 +0530 Subject: [PATCH 5/6] sitesettings resource and service refectored --- app/Filament/Admin/Resources/GlobalSettingsResource.php | 8 +------- app/Services/SiteSettingsService.php | 2 +- database/seeders/SiteSettingsSeeder.php | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/Filament/Admin/Resources/GlobalSettingsResource.php b/app/Filament/Admin/Resources/GlobalSettingsResource.php index 4c8b04e..d8e7cdf 100644 --- a/app/Filament/Admin/Resources/GlobalSettingsResource.php +++ b/app/Filament/Admin/Resources/GlobalSettingsResource.php @@ -3,19 +3,13 @@ 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\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 { diff --git a/app/Services/SiteSettingsService.php b/app/Services/SiteSettingsService.php index 10aad5f..82f9c39 100644 --- a/app/Services/SiteSettingsService.php +++ b/app/Services/SiteSettingsService.php @@ -2,7 +2,7 @@ namespace App\Services; -use App\Models\SiteSettings; +use Intelrx\Sitesettings\Models\SiteSettings; use Illuminate\Support\Facades\Cache; class SiteSettingsService diff --git a/database/seeders/SiteSettingsSeeder.php b/database/seeders/SiteSettingsSeeder.php index d6ab197..65c7b74 100644 --- a/database/seeders/SiteSettingsSeeder.php +++ b/database/seeders/SiteSettingsSeeder.php @@ -3,7 +3,6 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; -use App\Models\SiteSettings; use Intelrx\Sitesettings\SiteConfig; class SiteSettingsSeeder extends Seeder From c4e0052dbcf651d49ea3c9c59ed4f01e6a874763 Mon Sep 17 00:00:00 2001 From: Raza9798 Date: Tue, 3 Sep 2024 02:36:35 +0530 Subject: [PATCH 6/6] liveweare components updated and crud fix --- .../Resources/GlobalSettingsResource.php | 45 +++---------------- resources/views/livewire/footer.blade.php | 8 ++-- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/app/Filament/Admin/Resources/GlobalSettingsResource.php b/app/Filament/Admin/Resources/GlobalSettingsResource.php index d8e7cdf..9b0f524 100644 --- a/app/Filament/Admin/Resources/GlobalSettingsResource.php +++ b/app/Filament/Admin/Resources/GlobalSettingsResource.php @@ -3,11 +3,10 @@ namespace App\Filament\Admin\Resources; use App\Filament\Admin\Resources\GlobalSettingsResource\Pages; -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 Intelrx\Sitesettings\Models\SiteSettings; @@ -21,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(), ]); } @@ -62,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/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 @@