Support the ongoing development of Laravel.io →
Input Database Eloquent

Sorry if my title is confusing, not sure how to explain this within a line. Let's say I have a table with some columns and I have this

$model = Document::where('systemName', '=', $systemName)->where('ticketNumber', '=', ($nextTicketNumber))->get(); ticketNumber is unique where as there are quite a few systemNames

The above will get exactly what I want but I want more. I want an array which will store all the rows under the same systemName. I know I can do this by doing $allSystemNameModel = Document::where('systemName', '=', $systemName)

But is there a possible way to not having two variables and be easier?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

et4891 et4891 Joined 14 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.