58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ContactTask extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'contact_tasks';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
protected $fillable = [
|
|
'contact_id',
|
|
'author_id',
|
|
'author_name',
|
|
'label',
|
|
'description',
|
|
'completed',
|
|
'completed_at',
|
|
'due_at',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'completed' => 'boolean',
|
|
'completed_at' => 'datetime',
|
|
'due_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Get the contact associated with the contact task.
|
|
*/
|
|
public function contact(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Contact::class);
|
|
}
|
|
|
|
/**
|
|
* Get the author associated with the contact task.
|
|
*/
|
|
public function author(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|