API Reference

Complete documentation of the larahammer:make command and all available options.

Command Syntax

bash
php artisan larahammer:make {name} {fields*} [options]

Arguments

name

Model name in StudlyCase (e.g., Product, BlogPost, UserProfile)

bash
php artisan larahammer:make Product

fields*

Field definitions for the migration. Multiple fields supported.

bash
php artisan larahammer:make Product name:string price:decimal status:enum(active,inactive)

Supported types: string, text, integer, boolean, date, datetime, decimal, enum, json, longText, mediumText, uuid, and more.

Target Options

Choose your UI presentation layer (required — prompted if omitted):

--target=blade

Blade views + controller + routes

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

--target=filament

Filament admin resource + routes

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

--target=api

REST API controller + JSON resource

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

--target=all

Blade + Filament + API

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

Feature Flags

Phase 1: Role System & UI Enhancements

--with-roles

Generate role-based access control system with migration, model, and seeder.

--with-landing

Generate Tailwind-styled landing page.

--with-admin

Generate complete Filament admin panel.

--with-security-middleware

Generate CheckRole and AdminPanelProtection middleware.

Phase 2: Testing & Advanced Features

--with-factories

Generate model factory with Faker data.

--with-soft-deletes

Add soft delete support to model and migration.

--with-policies

Generate authorization policy class for all actions.

--with-api-auth

Generate API authentication with Sanctum middleware.

--with-tests

Generate feature and unit tests for all CRUD operations.

--with-audit-log

Generate activity logging with observer pattern.

Convenience & Utility

--all

Generate everything: all targets + all advanced features

Equivalent to: --target=all --with-roles --with-admin --with-landing --with-security-middleware --with-factories --with-soft-deletes --with-policies --with-api-auth --with-tests --with-audit-log

--force

Overwrite existing files without confirmation.

Examples

Simple CRUD with Blade Views

bash
php artisan larahammer:make Post title:string slug:string content:text --target=blade

Admin Panel with Filament

bash
php artisan larahammer:make BlogCategory name:string description:text --target=filament

REST API with Authentication

bash
php artisan larahammer:make Article title:string content:text --target=api --with-api-auth

Complete Application

bash
php artisan larahammer:make Order order_number:string total:decimal status:enum(pending,processing,completed,cancelled) --all

Combination of Specific Features

bash
php artisan larahammer:make Product name:string price:decimal --target=all --with-factories --with-tests --with-policies

Tip: You can combine any target with any combination of feature flags. Only the features you request will be generated.

Generated File Structure

When you run php artisan larahammer:make Product --all, you'll get:

text
app/
├── Models/
│   └── Product.php
├── Http/
│   ├── Controllers/
│   │   ├── ProductController.php (Blade)
│   │   └── Api/ProductController.php (API)
│   ├── Requests/
│   │   ├── StoreProductRequest.php
│   │   └── UpdateProductRequest.php
│   └── Resources/
│       └── ProductResource.php
├── Filament/
│   ├── Resources/
│   │   └── ProductResource.php
│   └── Pages/
│       ├── CreateProduct.php
│       └── EditProduct.php
├── Observers/
│   └── ProductObserver.php
├── Policies/
│   └── ProductPolicy.php
└── Models/Role.php, Activity.php (if applicable)

database/
├── migrations/
│   ├── create_products_table.php
│   └── (other migrations)
├── factories/
│   └── ProductFactory.php
└── seeders/
    ├── ProductSeeder.php
    └── RoleSeeder.php

routes/
├── web.php (Blade routes)
└── api.php (API routes)

resources/
└── views/
    └── products/
        ├── index.blade.php
        ├── create.blade.php
        ├── edit.blade.php
        └── show.blade.php

tests/
├── Feature/
│   └── ProductTest.php
└── Unit/
    └── ProductTest.php

Next Steps