Features & Examples

Larahammer provides three implementation phases with 13 different options to suit your needs.

Core Features (Always Generated)

Database Migration

Auto-generated migration from your field definitions.

php
Schema::create('products', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->decimal('price', 8, 2);
    $table->text('description');
    $table->timestamps();
});

Eloquent Model

Full model with casts and relationships.

php
class Product extends Model
{
    use HasFactory;
    
    protected $fillable = ['name', 'price', 'description'];
    
    protected $casts = [
        'price' => 'decimal:2',
    ];
}

Form Request

Built-in validation rules.

php
class StoreProductRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'price' => 'required|numeric|min:0',
            'description' => 'required|string',
        ];
    }
}

Database Seeder

Auto-populate data for testing.

php
class ProductSeeder extends Seeder
{
    public function run(): void
    {
        Product::factory(50)->create();
    }
}

Phase 1: UI Targets

Choose your presentation layer:

Blade Views

bash
php artisan larahammer:make Product name:string price:decimal --target=blade

Generates: Controller, views (index, create, edit, show), and routes. Perfect for traditional Laravel apps.

Filament Admin Panel

bash
php artisan larahammer:make Product name:string price:decimal --target=filament

Generates: Filament resource with forms, tables, and actions. Modern admin panel out of the box.

REST API

bash
php artisan larahammer:make Product name:string price:decimal --target=api

Generates: API controller, JSON resources, and routes. Perfect for decoupled frontends.

All Targets

bash
php artisan larahammer:make Product name:string price:decimal --target=all

Generates all three targets simultaneously. Supports Blade, Filament, and API in one project.

Phase 2: Advanced Features

Role-Based Access Control

bash
php artisan larahammer:make Product --with-roles

Includes role system, user relationships, and helper methods.

Landing Page

bash
php artisan larahammer:make Product --with-landing

Tailwind-styled landing page with hero, features, and CTA sections.

Security Middleware

bash
php artisan larahammer:make Product --with-security-middleware

CheckRole and AdminPanelProtection middleware for RBAC.

Admin Panel

bash
php artisan larahammer:make Product --with-admin

Complete Filament admin panel with dashboard and resources.

Phase 3: Production Features

Model Factories

bash
php artisan larahammer:make Product --with-factories

Faker-powered factories for testing with realistic data.

Soft Deletes

bash
php artisan larahammer:make Product --with-soft-deletes

Soft delete support with restore functionality.

Authorization Policies

bash
php artisan larahammer:make Product --with-policies

Authorization policies for view, create, update, delete actions.

API Authentication

bash
php artisan larahammer:make Product --with-api-auth

Sanctum-based API authentication with middleware.

Testing Suite

bash
php artisan larahammer:make Product --with-tests

Feature and unit tests covering all CRUD operations.

Activity Logging

bash
php artisan larahammer:make Product --with-audit-log

Observer-based activity logging for audit trails.

The Ultimate Command

Generate everything with a single command:

bash
php artisan larahammer:make Product name:string price:decimal description:text --all

The --all flag generates all 3 targets + all 12 advanced features. Perfect for starting a new project.

Next Steps