contacts) { foreach ($model->contacts as $contact) { Note::where('contact_id', $contact->id)->unsearchable(); } Contact::where('vault_id', $model->id)->unsearchable(); } }); } /** * Get the account associated with the vault. * * @return BelongsTo */ public function account() { return $this->belongsTo(Account::class); } /** * Get the template associated with the vault. * * @return BelongsTo */ public function template() { return $this->belongsTo(Template::class, 'default_template_id'); } /** * Get the contact associated with the vault. * * @return HasMany */ public function contacts() { return $this->hasMany(Contact::class); } /** * Get the labels associated with the vault. * * @return HasMany */ public function labels() { return $this->hasMany(Label::class); } /** * Get the users associated with the vault. * * @return BelongsToMany */ public function users() { return $this->belongsToMany(User::class)->withTimestamps()->withPivot('permission'); } /** * Get the contact important date types associated with the vault. * * @return HasMany */ public function contactImportantDateTypes() { return $this->hasMany(ContactImportantDateType::class); } /** * Get the companies associated with the vault. * * @return HasMany */ public function companies() { return $this->hasMany(Company::class); } }