roguesherlock
roguesherlock
Explore posts from servers
FFilament
Created by roguesherlock on 9/9/2024 in #❓┊help
How to create a cluster for an individual record?
Hey I'm new to filament 3 so would love your help with this. Basically I have a client resource that has a lot of other related resources related to it (forms, sites, logos, etc). I want to basically create a cluster of these related resources for each individual client such that when a user clicks on a client on the dashboard, they see a sub nav for that client with links to these individual resources filtered for that client (overview, forms, sites, logos, etc). Does it make senes? Semantically cluster seems like the right fit but I just don't know how to create a cluster for individual client record like that.
2 replies
DTDrizzle Team
Created by roguesherlock on 7/18/2023 in #help
infer model with relations
is possible to infer model along with all its relations? Like if I have projects and projectsRelations which includes tasks can I create a type Project that includes tasks?
export const projects = mysqlTable(
"projects",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
}
)

export const projectsRelations = relations(projects, ({ many }) => ({
tasks: many(tasks),
}))


export type Project = InferModel<<projects-with-its-relations>?>

// currently I just do
export type Project = InferModel<typeof projects> & {tasks?: Task[]}
export const projects = mysqlTable(
"projects",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
}
)

export const projectsRelations = relations(projects, ({ many }) => ({
tasks: many(tasks),
}))


export type Project = InferModel<<projects-with-its-relations>?>

// currently I just do
export type Project = InferModel<typeof projects> & {tasks?: Task[]}
2 replies