| | |
| | | $this->types = $types; |
| | | } |
| | | |
| | | public function getNotificationTypes(bool $all = false):array |
| | | { |
| | | return ($all) ? $this->types : array_keys($this->types); |
| | | } |
| | | |
| | | private function defineTable():void |
| | | { |
| | | $table = CustomTable::for('notifications_main'); |
| | | |
| | | $typeEnum = implode(',',array_map(function($type) { return '`'.$type.'`';}, array_keys($this->types))); |
| | | $typeEnum = implode(',',array_map(function($type) { return "'{$type}'";}, array_keys($this->types))); |
| | | |
| | | $table->setColumns([ |
| | | 'id' => 'bigint(20) unsigned NOT NULL AUTO_INCREMENT', |
| | |
| | | '`user_status` (`for_user`, `status`)', |
| | | '`target_lookup` (`target_id`, `target_type`)', |
| | | '`unread_notifications` (`for_user`, `status`, `created_at`)', |
| | | '`requires_action` (`for_user`, `requires_action`, `action_taken`)', |
| | | '`requires_action` (`for_user`, `action_taken`)', |
| | | '`from_user_lookup` (`for_user`, `from_user`, `target_id`, `target_type`, `type`)' |
| | | ]); |
| | | |