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 Server

Community questions

Rrt22149/17/2023

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?
Mmikemastercorp9/17/2023

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...
Mmikemastercorp9/17/2023

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?

For example I have a ressource named: Termination failure so it seems awkward if the ressource creation title is: Create Termination Failure. My idea is to change the text to: "Add a Termination Failure" which seem much more suitable and is part of my learning path how to rename the resource creatio...
Eekta_169059/16/2023

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.
Mmikemastercorp9/15/2023

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 kno...
Jjoaopaulolndev9/15/2023

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.
Mmikemastercorp9/14/2023

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 al...
Ccodprez9/14/2023

how to set a value of an input field using values in a repeater

I have this input fields inside a repeater, product name, price and quantity, and I have an input field total disabled by default outside of the repeater, I want to populate the result of foreach(price * quantity) inside the total field
Ffae._19/13/2023

Working with Database Transactions.

Hello everyone. I recently developed a stock management system and worrying if race conditions might've happened if two users access the same resource at the same time as we need to store the stock data in a table. Is there anything I can do to prevent it ? I heard about database transactions but I don't have a clue to implement this in filament v3. The idea maybe is to have a custom store function inside filament ?

Here is currently a rough schema of my tables :
```
items
id
name
stoc...
Mmikemastercorp9/12/2023

Working on a Laravel Filament project using remote Shared Hosting

Hello guys.

As part of my "training punishment" I decided to try to install a fresh Laravel + Filament project on my shared cPanel hosting and edit the files locally with a remote sync. Why am I trying this - simple, I switch PCs often as part of my IT work related day so having a centralized project space would allow me to edit from wherever whenever.

So far, I've discovered a package provided from Micro$oft named RemoteSSH which allows you to connect to a shared host, lists all your files in...
Jjangili19/11/2023

is there a way to mutate data on createOptionForm in Select input.

i want to attach the creator_id before saving the form instead of having the a readonly field.

` Forms\Components\Select::make('payment_method_id')
->label('Payment Method')
->relationship(name: 'paymentMethod', titleAttribute: 'name')
->required()
->createOptionForm([
Forms\Components\TextInput::make('name')->required(),
Forms\Components\Textarea::make('description')...
Yyuliarahma9/11/2023

is there a way to make tabs filter optional according to roles

i have a teacher role and admin role, i want a tab filter only when i login as an admin, if i login as a teacher tab filter on the resource is not showing, is there a way to do that? thanks.
Rrt22149/9/2023

Render data from two resources

Is there a way to render data in a form from two different resources (tables or models) without a relationship between them? Thanks
Eenergetic_rabbit_953899/7/2023

Need Help wrapping my mind around Filament implementation

Hello!
I recently stumbled across this channel and love the content. Thank you for providing such great videos.
Hoping this group can help me get a better understanding of how Filament might help me with a hobby project I am working on. Fair warning, I am not that great with Laravel, still learning. I am just here to get understanding and learn more.

I want to create an application that let's different departments manage tasks, schedules, notes, etc.

Department heads (admins) would assign t...
Yyuliarahma9/7/2023

how to share resources on both panels

i have 2 panel, teacher and stundet, i want to create a resource that accessible for both roles, thnaks.
Ffae._19/4/2023

Widgets $tableColumnSearches of type array error

I followed the bootcamp until the Transactions Overview Widget tutorial and attempting to implement it in my project. The widget appeared but it seems like when I'm clicking table pagination elements the error pops up.

Removing the widget solves the issue but Is there a way to resolve this? Thanks beforehand.
Ccodprez9/4/2023

Custom setting page with filamentphp

I'm attempting to set up the edit page as the primary view for a filamentphp resource, specifically for managing page settings. These settings will consist of a single data row, and I want to restrict it to only being editable, with no option to create new rows or delete the existing one. Despite my efforts to find a solution, I haven't been able to. I'm open to any pointers, workarounds, or alternative approaches that could help me achieve this. Thanks for your assistance!
Ccpereiraweb8/29/2023

Validation doesn't work on form created with createOptionForm

Folks, I used the createOptionForm function to enable a new record creation form in a select field. Unfortunately, on this form, the unique() validation is not working. I followed a tip from Povilas in the code below, also without success:
```php
// Document comes from a Leandro Ferreira package for document fields in pt_BR
Document::make('cpf')
->label('CPF')
->live()
->cpf('999.999.999-99')
->dehydrateStateUsing(fn(string $state): string => preg_replace('/[.-]+/', '', $state))
->un...
Ssamnaghavi8/21/2023

TinyMce in filamentphp as a customField

I want to use TinyMCE in my form builder, but I can't. When I use the script inside my custom view, TinyMCE loads, but it disappears when I use a reactive() or any real-time functionality like a wizard. Additionally, when I hit "create", it won't send the data and I get the error "title cannot be null".
I also tried registering the TinyMCE script file as the Filament documentation suggests (https://filamentphp.com/docs/3.x/support/assets#registering-javascript-files). I can see the script file w...