Learn how to write a valid schema for the Laravel AI Code Generator.
This schema format allows the AI to automatically generate:
Every table must follow this structure:
table:table_name
primary:id
columns
timestamps
softDeletes
relationships
Use lowercase plural names with snake_case.
Correct
users
blog_posts
order_items
Wrong
Users
BlogPosts
OrderItems
Every table should contain:
primary:id
Columns use this format:
column_name=type|validation1|validation2
Example:
name=string|required|max:255
email=string|required|email|unique
| Type | Example |
|---|---|
| string | name=string |
| text | content=text |
| integer | age=integer |
| boolean | is_active=boolean |
| decimal | price=decimal:10,2 |
| date | publish_date=date |
| datetime | published_at=datetime |
| json | settings=json |
| enum | status=enum:draft,published |
Validation rules are separated using |
title=string|required|max:255
user_id=foreign|table:users|onDelete:cascade
Foreign keys automatically generate database constraints and relationships.
Relationships use this format:
relationship:type:model
relationship:hasMany:posts
relationship:belongsTo:user
relationship:belongsToMany:tags
table:users
primary:id
name=string|required|max:255
email=string|required|unique
password=string|required
timestamps
relationship:hasMany:posts
relationship:hasMany:comments
table:posts
primary:id
user_id=foreign|table:users|onDelete:cascade
title=string|required|max:255
slug=string|required|unique
content=text|required
status=enum:draft,published|default:draft
timestamps
softDeletes
relationship:belongsTo:user
relationship:hasMany:comments
relationship:belongsToMany:tags
table:comments
primary:id
post_id=foreign|table:posts|onDelete:cascade
user_id=foreign|table:users|onDelete:cascade
comment=text|required
timestamps
relationship:belongsTo:post
relationship:belongsTo:user
table:tags
primary:id
name=string|required|unique
timestamps
relationship:belongsToMany:posts
pivot:post_tag
post_id=foreign|table:posts|onDelete:cascade
tag_id=foreign|table:tags|onDelete:cascade
Wrong
table:User
user_id=foreign
relationship:user:posts
Correct
table:users
user_id=foreign|table:users|onDelete:cascade
relationship:hasMany:posts
primary:idtimestamps to all tablessoftDeletes for important tablesHirfix AI reduced my backend development time from weeks to just 2 hours. The code quality is incredible!
The schema to Laravel feature is a game changer. Upload ERD and get full backend structure instantly.
Perfect for rapid development and MVPs. Clean code, good documentation and excellent support.
Join thousands of developers who are building faster with Hirfix AI.