Is that possible to get data at once and then perform query on it instead of database. Because I am doing calculation for almost 500 customers. for while i need to run almost 100 queries for each customer in database with same pattern , that why i am asking that if I can get data at once and then perform query on that data instead of database. because each time for each customer increase mysql cpu consumption
What i am doing right now
foreach($customers as $customer)
{
$customer_charge= CustomerCharge::where('customer_id',$customer->id)->with('rate_charge')->with('chilled_rate_card')-->with('frozen_rate_card')->get()
$this->calculateConsignment($customer_charge);
}
I want to do like that
$customer_charge= CustomerCharge::whereIn('customer_id',[array])->with('rate_charge')->with('chilled_rate_card')-->with('frozen_rate_card')->get()
Now find() here customer charge form $customer_charge object instead of database
Is that possible if yes then how?
Is that possible ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire