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

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

Render HTML in select options filamentphp

hey please help me about Render HTML in select options filamentphp

Login user based on Department Panel

Hello Everyone I hope you're all doing well. I'm currently working on a project and could use some guidance and expertise to help me implement a user registration system with department-based access. I have three different panels: 'hr', 'finance', and 'property,' each with its respective logins. My goal is to allow a superadmin to register new users with their email, password, and department. When a registered user logs in, they should be directed to their designated department panel....
Solution:
I figured it out already Thankyou very much...

File Upload

I keep getting this error. I can't upload a file.
No description

Multitenant/Company plugin

As promised in the live stream. The link to a nice plugin for making a multi tenant installation with edit company and user profile. https://github.com/andrewdwallo/filament-companies...

Last stream, question about impersonation

Hello everybody, In the last stream somebody asked about acting as a other user. I found a plugin, which maybe could help. https://filamentphp.com/plugins/joseph-szobody-impersonate...

display information about the logged in user at the user resource level

good evening sir @tuto1902 , I have a php filament project, which has 2 dashboards, one "admin" and the other "user". I created a user resource(list all registered users), which is displayed in the 2 dashboards, but I would like that at the level of the user dashboard("user"), I would like that only the information of the connected user is displayed, and can only modify his information and not for others. thank you for helping me....
Solution:
the UserPanelProvider class should be automatically created when you create a new panel using php artisan make:filament-panel User and it should be located in app\Providers\Filament\UserPanelProvider.php It also should extend Filament\PanelProvider, not FilamentServiceProvider. And that error means that Laravel can't find the class you are extending from. Which usually means you either using the wron class name, or you didn't import the class with use...

emailVerification

Heloo everyone. In filament authentication feature there is emailverification(). Is that for check email verification? How to use it? I want to implement email verification after register new user, and sending email to the user that register. How step to implement that ?
Solution:
Add ->emailVerification() to your panel configuration and follow Laravel's documentation to prepare the User model for email verification. https://laravel.com/docs/10.x/verification#main-content Don't worry about protecting routes as Filament handles routes internally...

V2 plugin create for V3

I try to replicate solution forest filament tab layout plugin for V3 but it give error at canbehidden trait
Solution:
i just drop the plugin and use another plugin !

Google Distance Matrix API

Hello, has anyone have experience with implementing the Google Distance Matrix API into a Filament form? I need to find a solution to calculate a distance between two addresses and I need to know the distance to every country border on the route. Does anyone can help me with some coding solutions?...

Multi-tenancy for a filament page

Hi there. I have an app with multi-tenancy and it is working well with all the resources in such panel. For one resource, I had to create a new filament page (not associated with the resource) to do some simple mathematical operations. Sum of total columns and division to calculate percentages. this works great as well. The issue I have is that I cant filter the calculations by tenant. It just add all the values in the table . Can someone provide any advise please?
Solution:
Well, if I understood correctly, you needed to do a total calculation somewhere in your app and that is why I suggested the way to complete the total calculations, but yes, for multi tenancy you would need to filter your registered users model with the where condition: $total_users_count = Users::where('type', 'admin'); (of course you will change it to your own where clause as per the project needs as I am not aware of that so I gave just an example to look for an admin, but can be of course something else 😉 )...

Show multiple table columns in a single table column of ressource

Hey guys, me again. I am trying to find some documentation/info about how can I show in a table column the joined data from two fields (e.g. start_date and start_time which are two separate inputs of date/time would like to become: 21/12/2023 - 16:15 instead of showing each column separately. I believe we've done that with the pet clinic, but since I've started the project from video 1, I might have lost or not yet reached some of the merged data practice. Any hint or a link where to look as I seem to have some weird difficulty finding data in the documentation but I am not sure it is the fault of the DEVs who wrote the data...

Edit Create resource title text

Hey guys, Sorry if it sounds silly, but while working on my project, I've noticed that the text on every new resource adding is Create ... My question is what is the proper way to rename the text? ...
Solution:
Have you tried mofiying these two properties on the CreateTerminationFailure page?
protected static ?string $breadcrumb = 'Add Termination Failure';
protected static ?string $title = 'Add Termination Failure';
protected static ?string $breadcrumb = 'Add Termination Failure';
protected static ?string $title = 'Add Termination Failure';
...
No description

I'm having following error :ENUM

After defining the 'status' attribute in the 'AppointmentResource' and using 'App\Enums\AppointmentStatus,' I have added 'protected $casts = ['status' => AppointmentStatus::class]' in the model. However, I am encountering an error that says, 'Class "App\Enums\AppointmentStatus" not found.' I'm currently stuck at this point.
Solution:
it should look like this ```php <?php namespace App\Enums;...

Show record index in table row

Hey guys, I know this might sound a bit silly but I was reading the documentation of Filament and seem to not get my head around how can I show a simple table rows index instead of record id. Why I need that? Sometimes when we edit records and re-add some new, the ID of the table changes (of course) but we would still like to present the first one as 1, second as 2 etc. I am sure I am missing something ridiculously simple but just to speed up the custom project development and ask the great knowledge here to share some more, I will wait patiently for the answer to laugh at my miss (again) 🙂...

Hello Tuto,

I'm having the following error. When I'm using tenancy stuff and trying to use them together EditProfile is not possible because have a route problem. Thank you for your help, I think more people can have this same problem....
No description

How to use custom Admin UI with Filament

Hello guys. II've been with Laravel for a year or so and I love it so far. So is with Livewire which surprised me with it's simplicity in many occasions in terms of dynamics and code easiness to digest. I've came across Filament in a few months so I am still learning my way through this incredible ecosystem but I feel comfortable now thanks to tuto and many other contributors to build a semi-complex project on my own. The one thing that I would like to know and I've done some research on it already is how can we build a fully customized admin theme still using Filament under the hood. And by fully customized theme I am not meaning to change colors, backgrounds, icons etc. that Filament already allow with the custom theme, but what I mean is to use the incredible power to build quickly with Filament but use a custom ADMIN UI like AdminLTE, CoreUI or any other admin design that a project requires us to use....
Solution:
Another alternative I was reading about was to have custom PAGES which we can design and if allowed to use the functionality of Filament, can have our content attached. Not sure yet of all the bits and pieces, but there has to be an easy and elegant way to implement your custom theme to Filament panel. I can imagine someone requesting you to work on a project and providing frontend/backend design so that we can attach the functionality required and we tell that our panel does not support the custom GUI 🙂 I am sure it does, I just did not yet find it as I really love to use Filament and just need to invest some extra time in finding which template is where by design. I think that once I am done with the Vet clinic (or when the class is done with it) I can start by login/register form etc. and go slowly finding all the others, documenting their locations and think of a way or replacement that can be independent of the web framework. Maybe I am a dreamer but I am pretty sure if there is not a simple way to achieve the needed, there is a smart way to do so and the simple way is already in the DEV team minds....