Closed romaninsh closed 2 years ago
Outbox Model: (WARNING - USES LEGACY SYNTAX)
class Outbox extends Model {
public $table = 'outbox';
function init()
{
parent::init();
$this->hasOne('User')->editable(false);
$this->addField('slug'); // short text describing message
$this->addField('message')->type('text');
$this->addField('email');
$this->addField('name');
$this->addField('tags')->type('text');
$this->addField('is_sent')->type('boolean');
$this->addField('is_urgent')->type('boolean');
$this->addField('error')->type('text');
$this->addField('is_bounced')->type('boolean');
// Instantiate Mandrill here, used in two function now
$this->mandrill = new Mandrill($this->app->getConfig('mandril/key'));
$this->tags_array = [
'FromServer' => $this->app->pm->base_url,
'Site' => get_class($this->app) == 'App_CLI' ? 'Command Line' : $this->app->getFrontendURL()
];
}
function new($slug, $template, $tags = []) {
}
function send() {
}
}
The way to integrate would be by adding this into your User class:
$this->hasMany('Messages', new Outbox());
To use:
$user->ref('Messages')
->new('password reminder', 'reminder', ['link'=>$link])
->send();
this is not akt4/ui problem, should be solved in https://github.com/atk4/outbox
Outbox add-on offers a modern implementation of sending user messages (email, SMS, push notification, etc) through "Gateways".
The main idea is to have add-on which could handle two-way communications with mail delivery provider:
Optional features:
To provide cross-gateway transparency we also need to use a good 3rd party framework. Here are some candidates:
Example Admin UI:
Send a message UI:
Email field:
Current status: not started