QR_code_generator/app/Models/Companies/Contact.php

34 lines
687 B
PHP

<?php
namespace App\Models\Companies;
use App\Support\RelationValuesTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Contact extends Model {
use RelationValuesTrait;
protected $table = 'company_contacts';
protected $dates = [
];
protected $fillable = [
'company_id',
'type',
'value'
];
protected $hidden = [
];
public function company(): BelongsTo {
return $this->belongsTo(Company::class);
}
public function getParsedTypeAttribute(): array {
return ['name' => $this->type, 'title' => ContactType::TITLES[$this->type] ?? null];
}
}