public function boot() { Channels::extendFormFields(function (Form $form, $model) { $form->addFields(['method_data[email_destination]' => ['label' => "ebussola.feedback::lang.channel.emailDestination", 'commentAbove' => "ebussola.feedback::lang.backend.settings.channel.emailDestinationComment", 'required' => true, 'trigger' => ['action' => "show", 'field' => "method", 'condition' => "value[email]"]], 'method_data[subject]' => ['label' => "Subject", 'required' => true, 'trigger' => ['action' => "show", 'field' => "method", 'condition' => "value[email]"]], 'method_data[template]' => ['type' => 'codeeditor', 'language' => 'twig', 'label' => "Template", 'commentAbove' => 'The variables available here are these on the form. If you are using the default component template, they are: name, email and message', 'required' => true, 'trigger' => ['action' => "show", 'field' => "method", 'condition' => "value[email]"]]]); }); Channel::extend(function (Channel $model) { $model->rules['method_data.email_destination'] = "emails"; $model->attributeNames['method_data.email_destination'] = 'ebussola.feedback::lang.channel.emailDestination'; }); }
public function boot() { Channels::extendFormFields(function (Form $form, $model) { $form->addFields(['method_data[email_destination]' => ['label' => "ebussola.feedback::lang.channel.emailDestination", 'commentAbove' => "ebussola.feedback::lang.backend.settings.channel.emailDestinationComment", 'required' => true, 'trigger' => ['action' => "show", 'field' => "method", 'condition' => "value[email]"]]]); }); Channel::extend(function (Channel $model) { $model->rules['method_data.email_destination'] = "email"; $model->attributeNames['method_data.email_destination'] = 'ebussola.feedback::lang.channel.emailDestination'; }); }
public function send($methodData, $data) { foreach ($methodData['channels'] as $channelId) { /** @var Channel $channel */ $channel = Channel::find($channelId); if ($channel) { $channel->prevent_save_database = true; $channel->send($data); $channel->prevent_save_database = $channel->getOriginal('prevent_save_database'); } else { \Log::warning('FeedbackPlugin: One of your group channels is trying to send a message to an unknown channel.'); } } }
public function getChannelCodeOptions() { return Channel::all()->lists('name', 'code'); }
public function run() { Channel::create(['name' => 'Default', 'code' => 'default', 'method' => 'email', 'prevent_save_database' => false]); }
private function sendAdminEmail($subject, $message) { $channel = new Channel(['method' => 'email', 'method_data' => ['email_destination' => null, 'subject' => $subject, 'template' => $message], 'prevent_save_database' => true]); $channel->send(['email' => '*****@*****.**', 'message' => 'loremipsum']); }
public function run() { Channel::create(['name' => "Default", 'code' => "default", 'method' => "email"]); }