Campagne */ public function campagnes() { return $this->hasMany('App\Models\Campagne', 'camp_siteId', 'site_id'); } /** * OneToMany * Site -> Contact */ public function contacts() { return $this->hasMany('App\Models\Contact', 'contact_siteId', 'site_id'); } /** * The users that belong to the site. */ public function users() { return $this->belongsToMany('App\Models\User', 'site_user', 'site_id', 'user_id'); } /** * OneToMany * Site -> Coupon */ public function coupons() { return $this->hasMany('App\Models\Coupon', 'coupon_siteId', 'id'); } /** * @return string */ public function __toString() { return $this->site_id . " : " . $this->site_nom; } }