Files
monica/app/Models/PostTemplate.php
T

53 lines
1.1 KiB
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\HasMany;
class PostTemplate extends Model
{
use HasFactory;
protected $table = 'post_templates';
/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'account_id',
'label',
'position',
'can_be_deleted',
];
/**
* The attributes that should be cast to native types.
*
* @var array<string, string>
*/
protected $casts = [
'can_be_deleted' => 'boolean',
];
/**
* Get the account associated with the post type.
*/
public function account(): BelongsTo
{
return $this->belongsTo(Account::class);
}
/**
* Get the post type section records associated with the post type.
*/
public function postTemplateSections(): HasMany
{
return $this->hasMany(PostTemplateSection::class);
}
}