PHP code example of postare / db-config

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


use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema; // or import the correct Schema depending on your setup

public function content(Schema $schema): Schema
{
    return $schema
        ->components([
            TextInput::make('site_name')->

db_config('website.site_name', 'Default Name');

\Postare\DbConfig\DbConfig::get('website.site_name', 'Default Name');

\Postare\DbConfig\DbConfig::set('website.site_name', 'Acme Inc.');

\Postare\DbConfig\DbConfig::getGroup('website');
// => [ 'site_name' => 'Acme Inc.', 'contact' => ['email' => '[email protected]'] ]

\Postare\DbConfig\Facades\DbConfig::get('website.site_name');

// Store a nested structure
\Postare\DbConfig\DbConfig::set('profile.preferences', [
    'theme' => 'dark',
    'notifications' => ['email' => true, 'sms' => false],
]);

// Read a nested value with default
db_config('profile.preferences.theme', 'light'); // 'dark'

// Read a missing nested value
db_config('profile.preferences.timezone', 'UTC'); // 'UTC'
bash
php artisan vendor:publish --tag="db-config-migrations"
php artisan migrate
bash
php artisan make:db_config {name} {panel?}
bash
php artisan make:db_config website
php artisan make:db_config website admin