*/ public function user(): BelongsTo { return $this->belongsTo(User::class); } public function isRead(): bool { return $this->read_at !== null; } /** * @return array */ protected function casts(): array { return [ 'type' => NotificationType::class, 'data' => 'array', 'read_at' => 'datetime', ]; } }