karpadiem
CanAccessPanel logic causing 403 error for livewire.update on Tenant Registration Form
Dealing with an issue that I think comes down to inexperience.
In my development environment, I am working on my logic for what panels a user has access to.
in my user model, i have these functions:
Simple enough. Does what it is supposed to. However, I ran into problems. Because a newly registered user is not associated with a tenant yet, the user was not able to access the company/new page to create a tenant. Additionally, I realized they couldn't access the /company/logout page. Each presented with a 403 error.
This is where I worry I'm messing up. I added some exceptions based on routes:
18 replies
Table Column Relationship Sum, Avg, Max, Min, ext being ignored
I have model that consists of products. The products have a relationship of locationInventory that contain the inventory numbers for each location. On my Product Resource Table, I have a column like this:
Based on the documentation here: https://filamentphp.com/docs/3.x/tables/columns/relationships#aggregating-relationships, this should sum the total amount of quantity_in_stock for all locations. However, what I’m getting is a list of values instead.
Any pointers on what I might be doing wrong?
I have made sure the inventory values are casted to Integers and Floats, updated filament, cleared all caches.
11 replies
Creating new entries for multiple recourses in a single form
TLDR: Need to create multiple new entries in various Resources using a single form.
I"m essentially, building an ERM system. When creating an employee, I need to handle creating new records for several different Resources. I've landed on a wizard to be the best way to handle guiding the user through the flow. I think i have a lot of the pieces figured out, but need help understanding how to tie it all together.
To keep it simple, I'll just cover the first two steps.
Step 1) Select or Create a contact: In this step a user can either select a entry from the Contact Resource that already exists, or enter in all the fields to create a new. Essentially, as the basic information about the 'person' who is the employee is stored here. Preferably, the new contact will only be created at the final step when the wizard is complete.
Step 2) Enter Employee information: Here the user will enter things like full time, part time, start date, ect.
User submits the form, the new contact is created if needed, and the new employee is created with a relationship to the contact.
My biggest issue is the Contact step. My first pass at this, I was using a select with relationship and "getCreateOptionActionForm" but I worry opening up another model in this situation might end up being confusing. So I went with the code below (next message). With this, a user can select an existing contact and the new contact form is hidden. If they do not select a contact, the form is shown. I also wanted to reuse the form from my contact resource, so i am referencing my form class
My biggest issue is the Contact step. My first pass at this, I was using a select with relationship and "getCreateOptionActionForm" but I worry opening up another model in this situation might end up being confusing. So I went with the code below (next message). With this, a user can select an existing contact and the new contact form is hidden. If they do not select a contact, the form is shown. I also wanted to reuse the form from my contact resource, so i am referencing my form class
ContactResource::formSchema()
Using a wizard on my "CreateEmployee.php" page for my EmployeeResource, what is the best way to pass an array of contact data into the handleRecordCreation() function. Preferably using my ContactResource::formSchema() as a scheme?13 replies