with email it can be a thread of messages correct?
- User
with email it can be a thread of messages correct?
- Assistant
Yes, an email can be part of a thread of messages. An email thread consists of a series of emails that are related to the same subject or conversation. When someone replies to an email, their response typically includes the original message, creating a chain of messages that can be traced back through the correspondence. This makes it easier to follow the context of the conversation and see how it has developed over time. Many email clients also organize these threads for easier viewing.
- User
so if i was working on a message management system for yii2 app, to handle inquiries, contact form and order issues. and returning not only emails via this mms mvc.. should I be attempting to be able to handle threads? right now I have a migration/database that handles messages that i can send a reply to and save within the same table. but thats it, one layer.
- Assistant
- User
let me show you my database:
$this->createTable('{{%message}}', [ 'id' => $this->primaryKey(), // Type: Contact(1), Inquiry(2), Order(3). 'type' => $this->tinyInteger()->notNull(), 'product_id' => $this->integer(11),// For Inquiry messages. 'name' => $this->string(),// For Contact messages. 'email' => $this->string()->notNull(), 'subject' => $this->text()->defaultValue(null),// For Contact messages. 'body' => $this->text()->notNull(), // Status: Unread(1), Read(2), Important(4), Resovled(8), Spam(16), Archived(32),Flagged(64), Draft(128) 'status' => $this->smallInteger()->notNull()->defaultValue(0), // New Message: true(1), false(0). 'new_message' => $this->tinyInteger()->notNull()->defaultValue(1), 'replied' => $this->text()->defaultValue(null), //'repliedTime' => $this->timestamp()->defaultValue(null), 'repliedTime' => $this->integer(), 'created_by' => $this->integer(),//->notNull(), Note: Guest and user created. 'updated_by' => $this->integer(), 'created_at' => $this->integer()->notNull(), 'updated_at' => $this->integer(), ], $tableOptions); // BlameableBehavior: index `created_by` and `updated_by` in `{{%message}}` with foreign keys to `{{%user}}.id`, cascade delete. $this->createIndex('{{%idx-message-created_by}}', '{{%message}}', 'created_by'); $this->addForeignKey('{{%fk-message-created_by}}', '{{%message}}', 'created_by', '{{%user}}', 'id', 'CASCADE'); $this->createIndex('{{%idx-message-updated_by}}', '{{%message}}', 'updated_by'); $this->addForeignKey('{{%fk-message-updated_by}}', '{{%message}}', 'updated_by', '{{%user}}', 'id', 'CASCADE'); - Assistant
- User
but you speaking of another table correct?
- Assistant
- User
i dont follow how this would salve the threading. Could you explain futhure
- Assistant
- User
so its their message thats saved in the 'name', 'email', 'subject', 'body'... 'new_message' informs the admin if its new or not (might not actually be needed anymore, since status handles multi statuses). the 'replied and 'repliedTime' is the admin response to this message. So will this kinda of classing as a parent_id, still function?
- Assistant
- User
not sure how it should be coded within the mvc. but i like the idea.
- Assistant
- User
pretty sure adding parent_id should always be handled in the background either the controller or model or model form.
- Assistant
- User
ok lets start from the beginning, what do i need for the migrate file.
- Assistant
- User
ok so now i need to update the model
- Assistant
- User
ok so now i need the controller and view files
- Assistant
- User
i need the entire controller... and view files
- Assistant