1. Go to this page and download the library: Download bambamboole/filament-pages 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/ */
bambamboole / filament-pages example snippets
use Bambamboole\FilamentPages\FilamentPagesPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentPagesPlugin::make(),
]);
}
use Bambamboole\FilamentPages\Blocks\AbstractBlock;
use Bambamboole\FilamentPages\Blocks\IsBlock;
use Filament\Forms\Components\Builder\Block;
use Filament\Forms\Components\TextInput;
#[IsBlock(type: 'call-to-action', label: 'Call to Action')]
class CallToActionBlock extends AbstractBlock
{
protected string $view = 'blocks.call-to-action';
public function build(Block $block): Block
{
return $block->schema([
TextInput::make('heading')->
use Bambamboole\FilamentPages\Blocks\AbstractBlock;
use Bambamboole\FilamentPages\Blocks\IsBlock;
use Bambamboole\FilamentPages\Models\Page;
use Filament\Forms\Components\Builder\Block;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\TextInput;
use RalphJSmit\Laravel\SEO\SchemaCollection;
#[IsBlock(type: 'faq', label: 'FAQ')]
class FaqBlock extends AbstractBlock
{
protected string $view = 'blocks.faq';
public function build(Block $block): Block
{
return $block->schema([
Repeater::make('questions')->schema([
TextInput::make('question')->
use Bambamboole\FilamentPages\Blocks\BlockAsset;
public function assets(): array
{
return [
'css' => [
BlockAsset::url(asset('css/cta.css')),
BlockAsset::inline('.cta { background: var(--primary); }'),
],
'js' => [
BlockAsset::url('https://cdn.example.com/lib.js'),
BlockAsset::inline('console.log("CTA loaded");'),
],
];
}
use Bambamboole\FilamentPages\Layouts\AbstractLayout;
use Bambamboole\FilamentPages\Layouts\IsLayout;
use Bambamboole\FilamentPages\Models\Page;
use Illuminate\Http\Request;
use Illuminate\View\View;
#[IsLayout(key: 'landing-page', label: 'Landing Page')]
class LandingPageLayout extends AbstractLayout
{
protected string $view = 'layouts.landing-page';
public function render(Request $request, Page $page): View
{
return view($this->view, ['page' => $page]);
}
}
use Bambamboole\FilamentPages\Facades\FilamentPages;
FilamentPages::routes();