12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
62
app/Models/Contact.php
Normal file
62
app/Models/Contact.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Scopes\PortalScope;
|
||||
use Database\Factories\ContactFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
/** @use HasFactory<ContactFactory> */
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope(new PortalScope);
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'company_id',
|
||||
'portal',
|
||||
'salutation_key',
|
||||
'title',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'responsibility',
|
||||
'phone',
|
||||
'fax',
|
||||
'email',
|
||||
'legacy_portal',
|
||||
'legacy_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'portal' => Portal::class,
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function company(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
|
||||
public function pressReleases(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(PressRelease::class, 'press_release_contact');
|
||||
}
|
||||
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue