Files
monica/app/Models/Note.php
T
2021-12-04 18:26:14 -05:00

54 lines
987 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Note extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'contact_id',
'author_id',
'author_name',
'title',
'body',
];
/**
* Get the contact associated with the note.
*
* @return BelongsTo
*/
public function contact()
{
return $this->belongsTo(Contact::class);
}
/**
* Get the author associated with the note.
*
* @return BelongsTo
*/
public function author()
{
return $this->belongsTo(User::class);
}
/**
* Get the note's feed item.
*/
public function feedItem()
{
return $this->morphOne(ContactFeedItem::class, 'feedable');
}
}