feat: note
This commit is contained in:
+10
-1
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Support\NoteContent;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Note extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'device_id', 'content',
|
||||
'device_id', 'content', 'content_hash',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -18,6 +19,14 @@ class Note extends Model
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{title: string, body: string, native_id: int|string|null}>
|
||||
*/
|
||||
public function items(): array
|
||||
{
|
||||
return NoteContent::normalizeStored($this->content);
|
||||
}
|
||||
|
||||
public function device(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Device::class);
|
||||
|
||||
Reference in New Issue
Block a user