1. Install Laravel
composer require filament/filament
2. Membuat Panel
php artisan filament:install --panels
3. Membuat username
php artisan make:filament-user
4. Menghilangkan default widget Filament Dashboard
\app\Providers\Filament\AdminPanelProvider.php
->widgets([
// Widgets\AccountWidget::class,// Widgets\FilamentInfoWidget::class,
])
5. Setting pengaturan dengan menambahkan method
\app\Providers\Filament\AdminPanelProvider.php
->darkMode(false)
->navigation(true)
->topbar(true)
->breadcrumbs(true);
Source : https://filamentphp.com/docs/3.x/panels/themes#disabling-dark-mode
6. Membuat Model dan Database Migration
php artisan make:model Student -m
Schema::create('students', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code');
$table->string('address');
$table->timestamps();
});
Lakukan proses migrasi
php artisan migrate
Pada file app\Models\Student.php tambahkan kode berikut
protected $fillable = [
"name",
"code",
"address",
];
// atau
protected $guarded = [];
7. Membuat Filament Resource
php artisan make:filament-resource Student
8. Edit file app\Filament\Resources\StudentResource.php
a. Mengubah icon pada menu navigasi
protected static ?string $navigationIcon = 'heroicon-o-users';
b. Mengganti nama label pada navigasi
protected static ?string $navigationLabel = 'Data Siswa';
c. Import form
Menambahkan class Card dan TextInput
use Filament\Forms\Components\Card;
use Filament\Forms\Components\TextInput;
public static function form(Form $form): Form
d. Menambahkan kolom dalam table
Import class TextColumn
return $table
->columns([
TextColumn::make('id')->sortable()->searchable(),
TextColumn::make('name')->sortable()->searchable(),
TextColumn::make('code')->sortable()->searchable(),
TextColumn::make('address')->sortable(),
])
Memodifikasi tampilan create dan edit menjadi bentuk modal, caranya dengan menghapus baris berikut :
'create' => Pages\CreateStudent::route('/create'),
'create' => Pages\EditStudent::route('/edit'),
Laravel Livewire Volt
Laravel Volt
composer require livewire/volt
php artisan volt:install
Laravel Folio
composer require laravel/folio
php artisan folio:install