Lager-v3/app/Models/Note.php

37 lines
685 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Note extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
'note_type_id',
'user_id',
'note',
'loanable_type',
'loanable_id'
];
public function user()
{
return $this->belongsTo(User::class,'user_id')->withTrashed();
}
public function type()
{
return $this->belongsTo(NoteType::class,'note_type_id');
}
public function loanable()
{
return $this->morphTo()->withTrashed();
}
}