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/ */
/** @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');