Mur */ public function murs() { return $this->hasMany('App\Mur', 'mur_contactId', 'contact_id'); } /** * OneToMany * Contact -> Panier */ public function paniers() { return $this->hasMany('App\Panier', 'panier_contactId', 'contact_id'); } /** * ManyToOne * Contact -> Site */ public function site() { return $this->belongsTo('App\Site', 'contact_siteId'); } public function scopeSearchName($query, $name) { if ($name) $query->where('contact_nom', $name); } public function scopeSearchFirstname($query, $firstname) { if ($firstname) $query->where('contact_prenom', $firstname); } public function scopeSearchEmail($query, $email) { if ($email) $query->where('contact_email', $email); } public function scopeSearchVille($query, $ville) { if ($ville) $query->where('contact_ville', $ville); } public function scopeSearchCp($query, $cp) { if ($cp) $query->where('contact_cp', $cp); } public function scopeSearchCountry($query, $country) { if ($country) $query->where('contact_country', $country); } }