Files
CRM/app/Models/Contact/Address.php
Kroonk a213a1dba0
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
refactor: replace custom CRM with Monica fork
2026-05-22 16:19:55 +02:00

77 lines
1.6 KiB
PHP

<?php
namespace App\Models\Contact;
use App\Traits\HasUuid;
use App\Models\Account\Place;
use App\Models\Account\Account;
use App\Interfaces\LabelInterface;
use App\Models\ModelBindingWithContact as Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* An Address is where the contact lives (or lived).
* The actual address (street name etc…) is represented with a Place object.
*/
class Address extends Model implements LabelInterface
{
use HasUuid;
/**
* The attributes that aren't mass assignable.
*
* @var array<string>|bool
*/
protected $guarded = ['id'];
/**
* All of the relationships to be touched.
*
* @var array
*/
protected $touches = ['contact'];
protected $table = 'addresses';
/**
* Get the account record associated with the address.
*
* @return BelongsTo
*/
public function account()
{
return $this->belongsTo(Account::class);
}
/**
* Get the contact record associated with the address.
*
* @return BelongsTo
*/
public function contact()
{
return $this->belongsTo(Contact::class);
}
/**
* Get the place record associated with the address.
*
* @return BelongsTo
*/
public function place()
{
return $this->belongsTo(Place::class);
}
/**
* Get the label associated with the contact.
*
* @return BelongsToMany
*/
public function labels()
{
return $this->belongsToMany(ContactFieldLabel::class);
}
}