Files
monica/app/Models/Label.php
T

48 lines
948 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Label extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'vault_id',
'name',
'slug',
'description',
'bg_color',
'text_color',
];
/**
* Get the vault associated with the label.
*
* @return BelongsTo
*/
public function vault(): BelongsTo
{
return $this->belongsTo(Vault::class);
}
/**
* Get the contacts associated with the label.
*
* @return BelongsToMany
*/
public function contacts(): BelongsToMany
{
return $this->belongsToMany(Contact::class);
}
}