AES Encryption Explained: How It Works and Why It Matters
Jun 23, 2026
Generate a complete Laravel Eloquent Model class with fillable attributes, casts, relationships, and more.
Singular CamelCase, e.g. Post, BlogPost, UserProfile
Auto-filled from model name. Uses Laravel convention: snake_case + plural.
Comma-separated column names. Leave empty for $guarded.
Comma-separated. Only used when fillable is empty.
Add attribute casts (e.g. is_admin → boolean).
Foreign key and local key are auto-resolved by Laravel convention if left blank.
Comma-separated full trait class names.
This tool helps you quickly create a Laravel Eloquent model class with full configuration. Follow these steps:
Post or UserProfile. The table name auto-fills.belongsTo, hasMany, and more.Post.php.Tip
After generating, place the file in app/Models/. Then run php artisan make:model Post or paste the generated code directly.
Use singular CamelCase: Post, BlogPost, UserProfile. Laravel automatically maps Post to the posts table. You can override this with the $table property.
$fillable is a whitelist of attributes that can be mass-assigned. $guarded is a blacklist. Use one or the other — if $fillable is set, $guarded is ignored.
Casts tell Eloquent how to convert attribute values when you access them. For example, a boolean cast converts is_admin from 0/1 to true/false, while array/json automatically serialize/deserialize JSON columns.
Yes, unless you never use model factories. HasFactory is included by Laravel in every generated model and is required for testing with factories.
Yes. The default namespace is App\Models (Laravel 8+). If you use a different structure like App\Domain\Posts\Models, update the Namespace field.
Blog
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026