F
Filament2mo ago
Cushty

Approved, denied, pending but with defaults

Hi, I have a separate application table that will store the application form fields and it has a relationship with a user, once submitted admin will approve or deny the application, I was thinking of using a lookup table and having a separate table for statuses. The issue is I need a default status set to pending. I was going to make a seeder file to seed the statuses, but this may cause issues as the migrations run before the seeder. I was going to use enums but people on here have said there are a lot of issues with enums, and I want to be able to let admin in filament add a status if needed. What would you guys do? Thanks
Solution:
if you want people to be able to add status' then it would need to be a table and a relationship.
Jump to solution
5 Replies
awcodes
awcodes2mo ago
It shouldn’t matter if the migration runs before the seeder. But you can also default it to pending in the migration. Then any record created will have a status of pending. There’s several ways you can handle this.
Cushty
Cushty2mo ago
would you use a php enum or a look up table? Thanks
Solution
awcodes
awcodes2mo ago
if you want people to be able to add status' then it would need to be a table and a relationship.
awcodes
awcodes2mo ago
personally, i use ENUMs in our projects because we have no need for anyone other than a developer to be able to change any status because if someone modifies an existing status and changes the value, then anything referencing that value would break. but different apps have different needs.
Cushty
Cushty2mo ago
thanks I used an Enum works really well
Want results from more Discord servers?
Add your server