attributes['data'] = json_encode($value); } /** * Define the relationship with the activity's recipient. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('Flarum\Core\Models\User', 'user_id'); } public function subject() { return $this->mappedMorphTo(static::$subjects, 'subject', 'type', 'subject_id'); } public static function getTypes() { return static::$subjects; } /** * Register a notification type. * * @param string $type * @param string $class * @return void */ public static function registerType($class) { if ($subject = $class::getSubjectModel()) { static::$subjects[$class::getType()] = $subject; } } }