Tuto's Laravel Corner

TLC

Tuto's Laravel Corner

Join the community to ask questions about Tuto's Laravel Corner and get answers from other members.

Join

🚀laravel

💡filament

Simple (modal) resource and mutateFormDataBeforeSave()

I have a problem with my simple resource. I need to mutate the data before saving, but it's not possible to use mutateFormDataBeforeSave() as I would do with normal resource. Any ideas? I would like to add the following code: ```php...
Solution:
Try adding ->using() to the Filament\Tables\Actions\EditAction https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-the-saving-process ```php use Illuminate\Database\Eloquent\Model; ...

How to integrate filament v3 with stored procedure

I want to use stored procedures for CRUD needs. But I'm confused about how to call the stored procedure function from the create/edit button, or when I want to display the resulting data from the stored procedure in a table. anyone can help ?
Solution:
I think I'm going to record a video about this concept. Do you mind if I include your question in the video?(including your discord user name). Here's an example of using stored procedures to manage the users in a filament resource. First the create action ```php // app/Filament/Resources/Pages/CreateUser.php class CreateUser extends CreateRecord...

KeyValue UI not updating after $set(), but the value is changed

Hi Guys, I am using a button to change the keys and/or values in a KeyValue field that already contains data. When i do this the UI does not change, but the value will. ...
No description

attach properties to products - many to many relation

I have ProductResource and I want to associate some Properties to each product. For this I made a PropertiesRelationalManager The PropertyResource is bind of Property model and to the properties table. The properties table have the 2 columns, id and name The property values are stored in the property_values table which have the following columns: id, property_id and value...

Custom page with custom table

I'm working in a personal project where i want to feed my table with api data. I have already tried to use sushi, however it has a limitation when i talk about a paginated api. So the alternative i found was build a custom page, host a custom table and try to navigate through the api with it. But at this point i'm not progressing, someone can help me with livewire table content or any sort of help? This is my project at github: https://github.com/eduardoximenes/filament-app.git...
Solution:
I've finished the custom table. At this point, i don't think i need sushi anymore. Let's see what happens next...

Filament-selectify

Hello all. Merry Christmass and a Happy New Year! For those who believe still in Santa, I thought to take a lead and share something interesting I've found. I am not in any way related to it (unfortunately) but just thought that for people who would like to make their coding life easier and like to use for their projects the mighty Filament admin panel , this would be a perfect addition: https://github.com/andrewdwallo/filament-selectify...

Clean filters

I create custom pages to show 2 or 3 widgets, all has
use HasFiltersForm;
use HasFiltersForm;
I need when navigate and comeback to the pages, the filters set null....

Filament Test

Good evening, can anyone help with filament test using pest. I wanted to test the dashboard panel login. For examples can't be accessed by guest and redirect it to the login page.

multi tenancy

I have this error i'm using multi tenancy, I have companies table and i have fuel_options table that is linked with the companis table whene i create fuel option i get the error in the picture
No description

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?...
Solution:
I will answer myself: 1. I have created a new route to handle image downloads for product categories. 2. Used Tables\Columns\ViewColumn to load a custom blade view. 3. In that custom blade view all I have is a img tag pointing to the url I just created....

Multi-tenancy

Is there someone can help me to understand Multi-tenancy concept??

Has anybody successfully tried the new import action yet?

Hi, all: As the title says - has anybody tried to implement the new import action successfully yet? I followed the documentation but somehow fail to import records. I suspect the issue is somewhere in the queue because the import sits forever in pending_jobs in the job_batches table in the database. Is there a special command for job batch queueing apart from the queue:work, I wonder? @Tuto - it would be really great if you could record a short video just for this feature. There is not...

How to add a ViewPage in index

Like profile page of the user, I want to show the user login profile view page in a resource index page ? Any suggestion how? Generally a view page required a record but i want to pass the auth() ->user() ->id there but it doesn't work

Group records in sort order

Hi, Tuto - I have been watching your vet clinic streams lately and have a question. When we group a table, we can dispaly it in ASC or DESC order. But can we add the third parameter - 'sort_order' to the dropdown? Filament offers sorting out of the box and grouping by sort order by default would be nice in one of my projects. Thanks!

File Upload Error 422

``` { "message": "The files.0 failed to upload.", "errors": { "files.0": [...
No description

How to reload a Edit page

i have 2 panels and in admin panel i have student resource which is also present in app panel and i have a status field in the student resource table ok when the status is false the app panel user should not edit that record ,ex- in admin panel admin change the status of a record to false and the app panel user is already in the edit page of that record so then if he edit that record then the false status changed to true so how can i acheive that like when admin change the status and app panel u...
Solution:
I would use the beforeSave() method of the EditStudent page. This will check any conditions you want before actually saving the record. https://filamentphp.com/docs/3.x/panels/resources/editing-records#halting-the-saving-process...

multi tenancy

how can use role and permission in the same tenant what's the relation should be

How I can take only first column value to Bulk Action?

I just need to id of product list in Collection of $records, because for too much data, will kill the page with all columns of selected rows.
No description

checklist and dynamic field

i have checklist and i want create quantity field for every option selected

Old value after failed validation

Im trying to keep the old value of a select2, the data is getting from a ajax response, ```javascript $('#patient').select2({ minimumInputLength: 3, ajax: {...
No description