Commands for Laravel Filament

agussudarmanto

Agus Sudarmanto

Posted on January 4, 2024

Commands for Laravel Filament

# What is Filament

The Filament Panel Builder pre-installs the Form Builder, Table Builder, Notifications, Actions, Infolists, and Widgets packages

# Install Laravel

laravel new {folder-or-application-name}
- or -
composer create-project laravel/laravel {folder-or-application-name}
Enter fullscreen mode Exit fullscreen mode

# Install Filament Package

composer require filament/filament:"^3.0-stable" -W
php artisan filament:install --panels
Enter fullscreen mode Exit fullscreen mode

# Create a user

php artisan make:filament-user
Enter fullscreen mode Exit fullscreen mode

# Publishable configuration

php artisan vendor:publish --tag=filament-config
php artisan vendor:publish --tag=filament-panels-translations
php artisan vendor:publish --tag=filament-actions-translations
php artisan vendor:publish --tag=filament-forms-translations
php artisan vendor:publish --tag=filament-notifications-translations
php artisan vendor:publish --tag=filament-tables-translations
php artisan vendor:publish --tag=filament-translations
Enter fullscreen mode Exit fullscreen mode

# Panel Builder

Panels are a container for pages, resources, forms, tables, notifications, actions, info lists, and widgets.

## Make models

php artisan make:model Owner -m
php artisan make:model Patient -m
php artisan make:model Treatment -m
Enter fullscreen mode Exit fullscreen mode
// create_owners_table
Schema::create('owners', function (Blueprint $table) {
    $table->id();
    $table->string('email');
    $table->string('name');
    $table->string('phone');
    $table->timestamps();
});

// create_patients_table
Schema::create('patients', function (Blueprint $table) {
    $table->id();
    $table->date('date_of_birth');
    $table->string('name');
    $table->foreignId('owner_id')->constrained('owners')->cascadeOnDelete();
    $table->string('type');
    $table->timestamps();
});

// create_treatments_table
Schema::create('treatments', function (Blueprint $table) {
    $table->id();
    $table->string('description');
    $table->text('notes')->nullable();
    $table->foreignId('patient_id')->constrained('patients')->cascadeOnDelete();
    $table->unsignedInteger('price')->nullable();
    $table->timestamps();
});
Enter fullscreen mode Exit fullscreen mode

run php artisan migrate

References

💖 💪 🙅 🚩
agussudarmanto
Agus Sudarmanto

Posted on January 4, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related