PHP code example of webid / druid

1. Go to this page and download the library: Download webid/druid 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/ */

    

webid / druid example snippets


->discoverResources(
        in: base_path('vendor/webid/druid/src/Filament/Resources'),
        for: 'Webid\\Druid\\Filament\\Resources'
    )
    ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
    ->discoverPages(
        in: base_path('vendor/webid/druid/src/Filament/Pages'),
        for: 'Webid\\Druid\\Filament\\Pages'
)


/** @var FilamentSettingsFieldsBuilder $fieldsBuilder */
$fieldsBuilder = $this->app->make(FilamentSettingsFieldsBuilder::class);

$fieldsBuilder->addField(
    TextInput::make('a_first_field') // A Filament field as explained in Filament documentation
        ->label(__('A first field'))
        ->show up
    // In the settings form, we have a tabs group named `tabs`. One of the tabs is named `application` 
    before: 'another_field' // We can specify a `before` or `after` param to put the new field in a specific spot
);


    HomepageController.php

    public function index(): View
    {
        /** @var Settings|null $page */
        $page = Druid::getSettingByKey('homepage_id');

        if (is_null($page)) {
            abort(404);
        }

        $homepage = $this->pageRepository->findOrFail($page->value);

        if (Druid::isMultilingualEnabled()) {
            $homepage->loadMissing('translations');
        }

        return view('druid::page.page', [
            'page' => PageResource::make($homepage)->toObject(),
        ]);
    }


    routes/web.php

    Route::get('/', [HomepageController::class, 'index'])->name('homepage');

druid:publish-scheduled-posts

php artisan druid:install

php artisan filament:install --panels
php artisan make:filament-user