I need your help, please!
I have two models customer
and membership
. Customer hasMany
Memberships.
I need to extract all customers with a membership active
. I did this but it extracts only memberships, without customers data. How can I change it to solve the problem?
Membership::has("customer")
->forCompany($companyId)
->whereIn('state', ['ATTIVA', 'IN ATTESA DI ESITO', 'DA INVIARE'])
->where(function ($query) {
$query
->where('end_date', '>=', Carbon::now()->toDateString())
->orWhereNull('end_date');
})