You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
39 lines
733 B
39 lines
733 B
<?php |
|
|
|
namespace App\Models; |
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
class Document extends Model |
|
{ |
|
protected $fillable = [ |
|
'uuid', |
|
'title', |
|
'html', |
|
'json', |
|
'document_state_id', |
|
'user_id' |
|
]; |
|
|
|
public function jsonSerialize():array |
|
{ |
|
return [ |
|
'uuid' => $this->uuid, |
|
'title' => $this->title, |
|
'html' => $this->html, |
|
'json' => $this->json, |
|
'state' => $this->state, |
|
'user' => $this->user, |
|
]; |
|
} |
|
|
|
public function state() |
|
{ |
|
return $this->belongsTo(DocumentState::class); |
|
} |
|
|
|
public function user() |
|
{ |
|
return $this->belongsTo(User::class); |
|
} |
|
}
|
|
|