Comments & Discussion
Great course, thanks. I am wondering: what about a multi-value column as in TagsColumn, where each record should be addressed via a url resource? Thanks
Thanks, Povilas! Let's imagine a similar scenario: we have a Post and an Attachment models based on their tables, and they have their linked relationship, so for example in PostResource we can have a TagColumn that shows each attachment for a singular post:
// PostResource.php
TagsColumn::make('attachment.slug')->separator(','),
So, how it could be possible to add a url method that can link to an AttachmentResource with a certain record? I hope it's clear :)
Don't think this is possi in the core. You have to make a custom column. you can take TagsColumn as a starter and add what you need.
Is there any solution to open modal instead of url? I create fake column that pass record id to the controler that generate QR code for specific client in new tab. It works, but opening modal that will show the QR instead of new tab would be great.
TextColumn::make('qr')
->label("Kod QR")
->default('QR')
->icon('heroicon-o-qr-code')
->url(fn (Client $record): string => route('qrCode', ['id' => $record['id']]))
->openUrlInNewTab()
,
wow, what a good course is that.. thanks a lot <3
I have a question because the foreign key "product_id" in table "payments" is not nullable() we can't delete a product that has a payment.. so in this situation what is the good practice:
Well spotted. There's actually no "good practice", it's a question to you as a project creator, or to your client who ordered this project. Personally, I love using Soft Deletes almost everywhere, just in case.