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

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?...
Solution:
Ok so the solution I've found for now is to overwrite the getRedirectUrl() method on the Edit class: ``` protected function getRedirectUrl(): ?string {...

State - City select fields

I have this code, got from the filament documentation ```php Select::make('state_id') ->searchable()...
Solution:
```php Select::make('author_id') ->searchable() ->getSearchResultsUsing(fn (string $search): array => User::where('name', 'like', "%{$search}%")->limit(50)->pluck('name', 'id')->toArray()) ->getOptionLabelUsing(fn ($value): ?string => User::find($value)?->name),...

TAB pagination reset

My problem is that opening from a table a modal window that contains tabs, when I click on a tab the page of the table is reset. How do I avoid this?

Filter Filament Project Resources Based on Authenticated User's Team

I'm working on a Laravel application with a Filament admin panel. I need to filter the projects displayed in the admin panel so that only projects related to the authenticated user's team are shown. Here's a summary of my setup and what I've tried so far: Database Schema: User: belongs to a Team...
No description

Enable/Disable Login method

Hi, Does anybody have an idea about enabling or disabling login during the boot process? I think it's a bit tricky....

Searchable for models/relationships with different database connections

I have a model with a connection to another database, when it appears in the list table it doesn't have a problem, but when the fields of the model are given searchable parameters an error occurs, it seems the error is because the search query is not connected to another database. is there a solution for this?
No description

Loop certain data inside filament $form schema

Hi @tuto1902 , Is there's a way on how can I loop or show certain data inside the $form schema. I am using ->afterStateUpdated in side the $form ->schema. I want to show data from the database inside the $form ->schema. Thank you for the help....

Populate repeater using a select field outside of repeater rather than using the repeater add button

This is my code. Hoe do i use this select filed to poupulate my repeater. Forms\Components\Select::make('scan_code')...

scrollable section

Suppose I have two column in a page First section has long content to see I want to see all the content scrolling down But the second column must be fixed...
No description

filament bootcamp

Hi. I would like to learn more about testing . And just want to know if the bootcamp have this ? Regards

Pivot table and user roles

Hi, I am working on a multi-tenancy application in Filament and struggling with pivot table and user roles. Has anyone had a similar problem? ...

Removing border css class from info list.

Hey there, I wanna know if there is any way to remove border css class from info list.

Filament Approvals

Can anybody give me a solution, how to develop application approval process using recommended library ?

form builder

can anyone help me hoe to think this? thanks!...

Classification filament plugin ??!!

Hi, I would need your opinion on a plugin that I would like to create for filament. I wanted to organize the classification of the contacts model . I wanted to create a classification_types table with the following fields: id name...

Disable pagination when filters are applied.

I'm using different filters but I want to remove the pagination once a filter is applied, is it doable within the filters context?
Solution:
Thank you and I also ended up with this one

Using Repeater to save as JSON and display in Table

Hi all, The repeater field is driving me crazy. I use it to save a JSON array in the database but I am not able to display it in a table I have a model called 'Billing' Let's say it has only the fields 'id' and 'validity'...
Solution:
Thank you very much. I really wanted to avoid the relationship because json looked so much easier. It very unfortunate that iz does not work with json. I will give it a try with relationship....
No description

Three level dependent select

i have 3 table like this : table a => id, name table b =>id, table_a_id, name table c => id, table_b_id, name...

Checking for conflict in day, time and room validation.

Hi Tuto, May I ask your expertise on how can I implement a validation rule on checking the conflict of the day, time and room in a class schedule? I am using Laravel 10 and Filament 3.0. I have a belongsToMany relationship between the subjects and a schedule. I don't how or where to start. Appreciate your help. Thank you!
Next