👻
VILT Stack Generator
  • Get Started
    • 👻Overview
    • 💻Environment Setup
    • 🚀Install
  • Generate
    • 🧠Resource
    • 🔥Action
    • 🧩Modal
    • 📈Widget
    • 📏Route
    • 🖥️Views
    • 🔒Roles
  • Resource
    • 🔦Using
    • 🪝Hooks
    • 📤Import & Export
  • Builders
    • 🔡Form
    • 📺Table
    • 📄Page
  • Components
    • 💫Using
    • 🆎Text
    • 🔤Textarea
    • 🔠Rich
    • 🔢Number
    • 📞Tel
    • ✉️Email
    • 🔄Toggle
    • 🖌️Color
    • 📅Date
    • ⌛Time
    • ⏲️DateTime
    • ⚡Select
    • 🔁Repeater
    • 📑Schema
    • ✨Section
    • 🖼️Media
    • 💟HasOne
    • 🎁Relation
  • Managers
    • 🔤Translation
    • 📖Menu
    • ♠️Share
  • Helpers
    • ⚠️Alert
    • 💻Render
    • 🌠Actions
    • 🌟Modal
  • Plugins
    • 🔤Translations
    • 📀Settings
    • 📖Menus
    • 🔔Notifications
    • 💳Payment
    • 🏗️Build Plugins
  • Learning
    • 🙏Task To Get Start
    • 🚨CI/CD
    • 🦄Awesome TailwindCSS
Powered by GitBook
On this page
  • Use Quick CRUD
  • Custom Query
  1. Components

HasOne

PreviousMediaNextRelation

Last updated 2 years ago

you can use HasOne::class to build a select input like this

HasOne::make('name');

this class works with vue ViltHasOne.vue

it has some more methods for setting options

->options(array) //you can use Options::class to add new options or array ["name"=>"", "id"=>""]
->trackByName(string)
->trackById(string)
->relation(string)
->model(Model::class)

Use Quick CRUD

you can use

->add()
->rows([
 Text::make('name')
])

to make a simple CRUD with a button after the input and when you add a new one it will be appended to the select input.

Custom Query

to custom the query when you call the API you can use this method

->query('customer_id', '=', 1)
💟