mercredi 21 juin 2017

Laravel scope method check in other table?

I have 3 models, Customer, Service and ServiceElement

My scope in model Customer:

public function scopeServicesExternal($query, $customer_id, $service_id){
        return $query->where('customer_id', $customer_id)->where('service_id', $service_id);
}

This scope gives me all results for a service, this is ok. but it is possible to extend it to get only elements wich field agent is not empty in model ServiceElement?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tu4P8U
via IFTTT

Aucun commentaire:

Enregistrer un commentaire