belongsTo('App\Account'); } /** * Get the contacts record associated with the tag. */ public function contacts() { return $this->belongsToMany('App\Contact')->withPivot('account_id')->withTimestamps(); } /** * Update the slug. */ public function updateSlug() { $this->name_slug = str_slug($this->name); $this->save(); } }