1. Go to this page and download the library: Download postare/db-config library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
postare / db-config example snippets
namespace App\Filament\Pages;
use Filament\Forms\Form;
use Postare\DbConfig\AbstractPageSettings;
use Filament\Forms\Components\TextInput;
class WebsiteSettingsPage extends AbstractPageSettings
{
public ?array $data = [];
protected static ?string $title = 'Website Settings';
protected static ?string $navigationIcon = 'heroicon-o-globe-europe-africa';
protected ?string $subheading = 'Manage your website configurations here.';
protected static string $view = 'filament.config-pages.website';
protected function settingName(): string
{
return 'website';
}
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('site_name')->
// *Recommended* Helper method with optional default value
db_config('website.site_name', 'default value')
// Blade Directive
@db_config('website.site_name')
// Static Class
\Postare\DbConfig\DbConfig::get('website.site_name', 'default value');