Filament Settings

Do we have updated version of Filament-Settings plugin for Filament 3.2.x & Laravel 11.x?
Solution:
The solution is check if the DB exists function IsDbExists() { try {...
Jump to solution
25 Replies
Dennis Koch
Dennis Koch3mo ago
What issues do you have with it?
bhattji
bhattji3mo ago
It does not get installed (I am trying the one which uses spatie-valuestore in back-end)
Dennis Koch
Dennis Koch3mo ago
We need a bit more info than this to help
bhattji
bhattji3mo ago
composer require reworck/filament-settings ./composer.json has been updated Running composer update reworck/filament-settings Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires reworck/filament-settings * -> satisfiable by reworck/filament-settings[0.0.1, ..., 0.4. 0]. - reworck/filament-settings[0.0.1, ..., 0.4.0] require livewire/livewire ^v2.8.2 -> found livewire/livewire[v2.8.2, .. Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to sp ecific versions. You can also try re-running composer require with an explicit version constraint, e.g. "composer require reworck/filament- settings:*" to figure out if any version is installable, or "composer require reworck/filament-settings:^2.1" if you know which you need. Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Dennis Koch
Dennis Koch3mo ago
That package probably was never updated to Livewire v3. Why don't you try our official plugin for spatie/settings https://filamentphp.com/plugins/filament-spatie-settings
Filament
Spatie Settings by Filament - Filament
Filament support for Spatie's Laravel Settings package.
bhattji
bhattji3mo ago
Ok, do we have a video of its installation, usage etc
Dennis Koch
Dennis Koch3mo ago
Nope. Just the docs.
bhattji
bhattji3mo ago
I guess, this is quite complicated, novice like me need atleast a step-by-step tutorial doc, if not full video, specifically for Filament 3.x
Dennis Koch
Dennis Koch3mo ago
I don't know. The whole docs are like 4 sections. It shouldn't be that hard to follow If you can't install a package with a text description then you need to wait for someone to make a video. But we can't do that
bhattji
bhattji3mo ago
Ok, can you send the link of that doc?
Dennis Koch
Dennis Koch3mo ago
It's the link above. The docs are on the plugin page
bhattji
bhattji3mo ago
I tried installing the official filament settings plugin, but it gives error Problem 1 - filament/filament v3.2.0 requires illuminate/database ^10.0 -> found illuminate/database[v10.0.0, ..., v10.48.19] but these were not loaded, likely because it conflicts with another require. - filament/spatie-laravel-settings-plugin v3.2.0 requires filament/filament v3.2.0 -> satisfiable by filament/filament[v3.2.0]. - Root composer.json requires filament/spatie-laravel-settings-plugin 3.2 -> satisfiable by filament/spatie-laravel-settings-plugin[v3.2.0]. Installation failed, reverting ./composer.json and ./composer.lock to their original content. Please help
Dennis Koch
Dennis Koch3mo ago
Sounds like your Filament version is locked to 3.2.0 what does requirements of composer.json look like?
bhattji
bhattji3mo ago
I removed the trailing "^3.2" and it got installed. Thanks for the support I am facing a weird issue with Filament Settings Plugin (Spatie Settings) I have installed it and it works fine, however, if delete the database and try "php artisan migrate" it doesn't work. It asks for the settings table (created for Settings Plugin) with all the settings values. Fortunately, I did have the settings.sql saved. but if not, then how would I create the database?
Dennis Koch
Dennis Koch3mo ago
Did you follow the installation instructions for the Spatie package? https://github.com/spatie/laravel-settings?tab=readme-ov-file#installation
GitHub
GitHub - spatie/laravel-settings: Store strongly typed application ...
Store strongly typed application settings. Contribute to spatie/laravel-settings development by creating an account on GitHub.
bhattji
bhattji3mo ago
Yes, I followed, and it works all fine, that is not the issue. The problem comes if I have to regenerate the database. Earlier, if I give a new DB name in .env file, it use to regenerate the entire database. Now it gives error and asks for the settings table with all the settings values.
Dennis Koch
Dennis Koch3mo ago
When it doesn't create the settings table it sounds like you didn't publish the migration. Regarding missing settings: You need a way to seed them after migration.
bhattji
bhattji3mo ago
No, I did publish the migration, in fact I put the settings migration first by renaming the file with 00 000. But it does not generate any table since it looks for the settings table even before attempting to run any migration
Dennis Koch
Dennis Koch3mo ago
Can you share the stack trace of the error? Are you accessing Settings in a ServiceProvider? Is the plugin maybe accessing Settings in a ServiceProvider 🤔
bhattji
bhattji3mo ago
How do share the stack trace? No, I am not accessing in service provider but in an autoload file (may be that is causing the issue)
Dennis Koch
Dennis Koch3mo ago
Autoload file load even earlier. That's very likely the issue
bhattji
bhattji3mo ago
But I have only defined it, not using in autoload file use App\Settings\GeneralSettings; function getSetting($setting_name): string { return app(GeneralSettings::class)->$setting_name; } Ok, the issue was, I was accessing it in AdminPanelProvider. Great help, thanks a tonne btw, how to check if the database exists? So that, while regenerating, I can bypass.
Dennis Koch
Dennis Koch3mo ago
This could work: Schema::hasTable('settings')
bhattji
bhattji3mo ago
Great, that works as long as the DB exists, (php artisan migrate:fresh works) but if I delete the DB it doesn't (php artisan migrate doesn't work)
Solution
bhattji
bhattji3mo ago
The solution is check if the DB exists function IsDbExists() { try { Illuminate\Support\Facades\DB::connection()->getPdo(); return true; } catch (\Exception $e) { return false; } }
Want results from more Discord servers?
Add your server