Use YAML when you want one file to define model fields, relationships, and generator options.
php artisan crudify:generate --file=post.yamlCrudify generates Volt single-file page components by default. To opt out and generate classic Livewire pages, set options.volt: false.
model: Post
fields:
title:
type: string
unique: true
slug:
type: string
unique: true
index: true
body:
type: text
excerpt:
type: text
nullable: true
is_published:
type: boolean
default: false
published_at:
type: datetime
nullable: true
view_count:
type: integer
default: 0
rating:
type: decimal
nullable: true
featured_image:
type: image
nullable: true
attachment:
type: file
nullable: true
gallery:
type: image
multiple: true
nullable: true
documents:
type: file
multiple: true
nullable: true
relationships:
user:
type: belongsTo
model: User
category:
type: belongsTo
model: Category
tags:
type: belongsToMany
model: Tag
comments:
type: hasMany
model: Comment
searchable:
- title
- body
options:
soft_deletes: true
volt: false- model, migration, factory, seeder
- policy
- Volt index/create/edit/show pages
- Flux UI pages with Tailwind classes
- index page with search, sortable columns, and pagination
- relationship-aware forms and show/index rendering
- file and image upload handling
If options.volt: false, Crudify generates classic Livewire page classes, Blade views, controllers, form requests, and routes instead.
Supported relationship types:
belongsTo- generates model method and dropdown field in formshasMany- generates model methodhasOne- generates model methodbelongsToMany- generates model method, checkbox UI, sync on save, and pivot migration
Optional relationship keys:
display- attribute shown in selects, checkbox labels, index badges, and show pageslabel- user-facing label for forms, table headers, and detail sections
model: Post
fields:
title: string
body: text
relationships:
tags:
type: belongsToMany
model: Tag
display: slug
label: TopicsGenerated extras:
app/Models/Tag.phpif missing*_create_post_tag_table.phppivot migrationselectedTagsIdsvalidation rules- checkbox UI in create/edit
- related tags shown in index and show views
model: Post
fields:
title: string
body: text
is_published: boolean
relationships:
user:
type: belongsTo
model: User
tags:
type: belongsToMany
model: TagThis is a good fit for blog posts, articles, and knowledge base entries.
model: Product
fields:
name: string
slug:
type: string
unique: true
description: text
price: decimal
is_active: boolean
relationships:
collections:
type: belongsToMany
model: CollectionCrudify generates a collection_product pivot migration and checkbox selection UI for collections.
model: User
fields:
name: string
email:
type: string
unique: true
password: string
relationships:
roles:
type: belongsToMany
model: RoleThis is useful for admin panels where a user can have multiple roles.
stringtextintegerbigintfloatdecimalbooleandatedatetimetimestampjsonuuidforeignimagefile
fields:
name:
type: string
nullable: true
unique: true
index: true
default: Example
author_id:
type: foreign
foreign: usersSupported field options:
nullableuniqueindexdefaultforeignmultiple
Simple fields can use shorthand:
model: Product
fields:
name: string
description: text
price: decimal
is_active: booleanEquivalent long form:
model: Product
fields:
name:
type: string
description:
type: text
price:
type: decimal
is_active:
type: booleanmodel: Article
fields:
title: string
body: text
options:
volt: falseThis generates classic Livewire files under app/Livewire/Pages/... and resources/views/livewire/pages/....