'json', 'is_read' => 'boolean', 'read_at' => 'datetime', ]; } public function user() { return $this->belongsTo(User::class); } public function violation() { return $this->belongsTo(Violation::class); } public function spLetter() { return $this->belongsTo(SpLetter::class, 'sp_letter_id'); } public function scopeUnread($query) { return $query->where('is_read', false); } }