/** * Run the database seeds. * * @return void */ public function run() { \Solunes\Master\App\ImageSize::truncate(); \Solunes\Master\App\ImageFolder::truncate(); \Solunes\Master\App\TempFile::truncate(); \Solunes\Master\App\VariableTranslation::truncate(); \Solunes\Master\App\Variable::truncate(); \Solunes\Master\App\InboxUser::truncate(); \Solunes\Master\App\InboxMessage::truncate(); \Solunes\Master\App\Inbox::truncate(); \Solunes\Master\App\Notification::truncate(); \Solunes\Master\App\Activity::truncate(); DB::table('permission_role')->truncate(); DB::table('role_user')->truncate(); \Solunes\Master\App\Role::truncate(); \Solunes\Master\App\Permission::truncate(); \App\User::truncate(); \Solunes\Master\App\EmailTranslation::truncate(); \Solunes\Master\App\Email::truncate(); \Solunes\Master\App\IndicatorValue::truncate(); \Solunes\Master\App\IndicatorGraph::truncate(); \Solunes\Master\App\IndicatorAlert::truncate(); \Solunes\Master\App\Indicator::truncate(); \Solunes\Master\App\FieldOptionTranslation::truncate(); \Solunes\Master\App\FieldOption::truncate(); \Solunes\Master\App\FieldConditional::truncate(); \Solunes\Master\App\FieldExtra::truncate(); \Solunes\Master\App\FieldTranslation::truncate(); \Solunes\Master\App\Field::truncate(); \Solunes\Master\App\Section::truncate(); \Solunes\Master\App\Filter::truncate(); \Solunes\Master\App\NodeExtra::truncate(); \Solunes\Master\App\NodeRequest::truncate(); \Solunes\Master\App\NodeTranslation::truncate(); \Solunes\Master\App\Node::truncate(); \Solunes\Master\App\MenuTranslation::truncate(); \Solunes\Master\App\Menu::truncate(); \Solunes\Master\App\PageTranslation::truncate(); \Solunes\Master\App\Page::truncate(); \Solunes\Master\App\SiteTranslation::truncate(); \Solunes\Master\App\Site::truncate(); \Solunes\Master\App\Language::truncate(); \App\PasswordReminder::truncate(); }
public static function make_email($email_name, $to_array, $vars = [], $vars_if = [], $vars_foreach = []) { // $vars = ['@search@'=>'Reemplazar con esto'] if ($email = \Solunes\Master\App\Email::where('name', $email_name)->first()) { $msg = $email->content; if (count($vars_if) > 0) { foreach ($vars_if as $var_name => $var_value) { $beginning = '@' . $var_name . '@'; $end = '@end' . $var_name . '@'; if ($var_value === true) { $msg = str_replace($beginning, '', $msg); $msg = str_replace($end, '', $msg); } else { $beginningPos = strpos($msg, $beginning); $endPos = strpos($msg, $end); $textToDelete = substr($msg, $beginningPos, $endPos + strlen($end) - $beginningPos); $msg = str_replace($textToDelete, '', $msg); } } } if (count($vars_foreach) > 0) { } if (count($vars) > 0) { $msg = str_replace(array_keys($vars), array_values($vars), html_entity_decode($msg)); } \Mail::send('master::emails.default', ['msg' => $msg], function ($m) use($email, $to_array, $msg) { $m->to($to_array)->subject($email->title); }); return true; } else { return false; } }