PHP code example of amzad78692 / filament-app-settings

1. Go to this page and download the library: Download amzad78692/filament-app-settings 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/ */

    

amzad78692 / filament-app-settings example snippets



namespace App\Filament\Pages;

use Amzad78692\FilamentAppSettings\Pages\SettingsPage;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Illuminate\Contracts\Support\Htmlable;

class Settings extends SettingsPage
{
    public function schema(): array
    {
        return [
            Tabs::make('Settings')
                ->schema([
                    Tab::make('General')
                        ->schema([
                            TextInput::make('general.website_name.en')
                                ->label(__('Website name') . '(en)'),
                            TextInput::make('general.website_name.ar')
                                ->label(__('Website name') . '(ar)'),
                            FileUpload::make('general.logo')
                                ->image()
                                ->directory('settings'),
                            FileUpload::make('general.favicon')
                                ->image()
                                ->directory('settings'),
                        ])->columns(2),
                    Tab::make('Contact')
                        ->schema([
                            TextInput::make('contact.email')
                                ->email(),
                            TextInput::make('contact.mobile')
                                ->tel()
                                ->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/'),
                            TextInput::make('contact.whatsapp')
                                ->tel()
                                ->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/'),
                            TextInput::make('contact.address'),
                        ])->columns(2),
                ]),
        ];
    }
}

namespace App\Filament\Pages;

use Amzad78692\FilamentAppSettings\Pages\SettingsPage;

class Settings extends SettingsPage
{
    public static function getNavigationLabel(): string
    {
        return 'Custom label';
    }
}

namespace App\Filament\Pages;

use Amzad78692\FilamentAppSettings\Pages\SettingsPage;

class Settings extends SettingsPage
{
    public function getTitle(): string
    {
        return 'Custom title';
    }
}
bash
php artisan settings:install