F
Filamentsmoothtire

Count SaleItems sold by Product ID

Hello, I have a Sales Resource with (hasMany) SaleItems Resource which selects a product to sell from the Product table. I'm looking to have a column in my Product table that sums all the related product sales to give a Sold total. I've read through the docs and finding this particular issue to be a little tricky. Any help is appreciated!
S
smoothtire14d ago
migrations
No description
No description
No description
S
smoothtire14d ago
product table?
No description
K
krekas14d ago
I think you should create an attribute and count the sum there
S
smoothtire14d ago
Thank you @krekas, I'll look into that!
D
dissto14d ago
Take a look at withSum And please dont use decimal/floats for currency values And next time please use real code and not images 😋
S
smoothtire14d ago
Thanks @dissto! Sorry! @dissto From what I'm seeing, withCount will count the amount of relationships, right?
D
dissto14d ago
Yes, but I wrote to take a look at withSum not withCount 😋
S
smoothtire14d ago
Haha, oops! Thank you
Want results from more Discord servers?
Add your server
More Posts
Missing required parameter for View routeI have just found out the wonder of Repeaters, and after adding one to a form, the first time I submDownloadable() and Openable() gives me 404 errorhello! I am currently creating our system and the downloadable() and openable() syntax in my filamenhow to add external url in navigationi want to add external url in my navigation sidebar. but i find a way for a specific resource. whatcustom themeHas anyone used Multi-Tenancy with diferent DB Sqlite???Livewire View Not foundI have a brand new install of Laravel 11, Filament 3 and Livewire 3. I have been configuring the adBumped from 3 to 3.2 and getting Leage\Csv\Writer not found```/vendor/filament/actions/src/Exports/Jobs/PrepareCsvExport.php:53 Leage\Csv\Writer not found ``` Using TailwindHi I have a project where I'm using Tailwind. I have a related resouce, which I want to highlught Deferring loadingWhat does it actually do for tables?Column not found with table filter and joinsHello everyone, I am working on my first project with filament and I have hit a brick wall. I'm trTrying to find a way to show the infolist in the EditResource pageis it possible? so far i've just managed to make it appear in the view page, but id like it to appeahow to update another model instead of updating current resource?hello i want to insert data into another model first when user edit a form. what should i do?Laravel-Filament Qr generateHello, I hope you have a good day. I want to make a QR converter based on Laravel-filament. I want aHow to download Export instead of storing on server?I have created an export header action on my table like this: ```php ->headerActions([ ExportActioWizard form submitSo im using wizard steps and in my form i have 3 steps but the "create" , "create and create anotherWidget table custom queryHi all, i've a widget that aims to show the latest casting like this: ```php class LatestCastings Policy not applying on custom actionI have a custom filament class that extends filament table action. Its purpose is to update the recoIncorrect orderingHello everybody. Guys, why is this ordering always wrong? The 1040 should come at the end and not atText overflow ellipsisHi all, I'am looking for a way to the size the textcolumn according to the screen size. If the sizeFill FileUpload with generated imagesIm trying to fill a FileUpload field with an image I generate using OpenAI's Dall e I added the reFilter from AccessorHello Together, i'm using Laravel Venture for Workflow Jobs, and i have set in my model a Accessor.