Abel Cobreros
Abel Cobreros
Explore posts from servers
TLCTuto's Laravel Corner
Created by Abel Cobreros on 6/28/2024 in #💡filament
Refresh sub navigation after save
I have created an edit page for a Resource that should only show based on a field value. I am using the canAccess static method to check the value in the record and it works great, if the value is not valid and you try to access the page you get a 403 error and the sub-navigation item is added/removed accordingly but I need to manually refresh the page to actually see the change in the sub-navigation. Is there a way to force the sub-navigation to refresh after the form is saved to automatically add or remove the link to the page?
4 replies
FFilament
Created by Abel Cobreros on 6/28/2024 in #❓┊help
Refresh sub navigation after save
I have created an edit page for a Resource that should only show based on a field value. I am using the canAccess static method to check the value in the record and it works great, if the value is not valid and you try to access the page you get a 403 error and the sub-navigation item is added/removed accordingly but I need to manually refresh the page to actually see the change in the sub-navigation. Is there a way to force the sub-navigation to refresh after the form is saved to automatically add or remove the link to the page?
4 replies
FFilament
Created by Abel Cobreros on 2/19/2024 in #❓┊help
Issue with halt() on beforeSave and a repeater with relationship
So I am working on a Inventory Management System for a client where we have to deal with inventory (product with boxes, batches, etc) and I am having an issue when managing the products added to a sale. So if I am editing a sale with 3 products and I delete one of them, when I click save I want to reset the stock assigned for those 3 products and after the sale is updated I want to assign the stock again to the 2 products that are left. However, looks like the repeater is doing it's own thing independently and on beforeSave I can only see the 2 products that are left and not the 3 that were originally there. I have been playing around and I've figured that if I try to get the list of products with $this->record->saleProducts on beforeSave(), the actual sale_products table gets updated so is impossible for me to see if a product has been deleted or not. I have tried to alter the delete action of the repeater and I can reassing the stock and everything but if the user does not click save later the deleted product shows again and now the inventory does not match the reality. What am I doing wrong?
5 replies
TLCTuto's Laravel Corner
Created by Abel Cobreros on 12/9/2023 in #💡filament
Work with private images
I am developing an admin panel for a little store so they can manage their stock, sells, etc. I need to allow them to upload images for categories and products but I don't want them to be public, so I am saving them inside storage/app/product-categories for example. Now the problem is I want to show that image in a table or to preview it on the form but there is no public url to do so. My idea was to create a specific route to handle this so only logged in users can see the image but I couldn't find a way to modify the src attribute of the image in the Table Builder. Does anyone know how to do this or am I force to have them stored inside the public folder? What if I need to store sensitive images?
4 replies
FFilament
Created by Abel Cobreros on 8/8/2023 in #❓┊help
Is it possible to get form from resource and add it to createOptionForm?
As the title says, I don't like having to repeat the content of the form in a section and in any other select field that has a createOptionForm method on it. I guess I can just put it on a helper function in a service class or something but I was wondering if it would be possible to do it in a nicer way.
8 replies
FFilament
Created by Abel Cobreros on 8/3/2023 in #❓┊help
EncryptCookies middleware 419 page expired error
I have a custom SimplePage with a form that is throwing a 419 error every time I try to submit it. I have tried also to create a filament-form component with the exact same result. After some digging I've noticed the issue is related with the \Illuminate\Cookie\Middleware\EncryptCookies middleware and the problem goes away as soon as I remove the middleware from the panel or my custom route. Any ideas why?
7 replies
FFilament
Created by Abel Cobreros on 8/3/2023 in #❓┊help
Custom Join form returns 419 error
I am working on a new project and wanted to take advantage of it to use Filament V3. I have created a Users section where I can create, edit and delete them. However I don't want to have a register form, so when I create a user an email is sent with a url to create the account. The url contains a token that expires after a period of minutes. Everything works great up to this point, I added a custom action button to resend the invitation in case it expires or the email address is changed. However I am having issues to create the Join form, which is just a SimplePage with the email address, password and confirmation password. I have checked how the Register page works and even checked the code of the Breezy plugin. I tried to replicate every single piece of code except for the parts that I need to change like the properties, the function to submit the form, etc., and every time I try to submit I get a 419 error. The CSRF token is there so it doesn't seem to be the issue. If I just create a Page with the filament-page command and seems to only create a Page for logged in users and couldn't find a way to make it work differently. In those kind of pages the form works great and don't get any 419 error. I am an experienced developer but never worked before with livewire nor filament. I usually work with InertiaJS and React. Could you please guide me on what could I be doing wrong?
7 replies