public function send($person, $view, $data, $subject) { $view = view_path($view); \Mail::send($view, $data, function ($message) use($person, $subject) { $message->to($person->email)->subject($subject); }); }
public function getTemplateIncludes($file) { preg_match_all('/<include\\s+(.*)>/', $file, $includes); $templates = $includes[1]; foreach ($templates as $template) { $templatePath = view_path(trim(str_replace('.', '/', $template))); if (file_exists("{$templatePath}.lb")) { $templateFile = file_get_contents("{$templatePath}.lb"); } else { throw new TemplateNotFoundException($template); } $file = preg_replace("/<include\\s+{$template}>/", $templateFile, $file); } return $file; }
/** * Execute the console command. * * @return mixed */ public function handle() { $partsOfView = explode('.', $this->argument('view')); $nameOfFile = array_pop($partsOfView); $paths = implode('/', $partsOfView); if (!is_dir(view_path($paths))) { mkdir(view_path($paths), 0777, true); } $viewName = $paths . '/' . $nameOfFile . '.blade.php'; if (file_exists(view_path($viewName))) { throw new \Exception("File already exists."); } File::put(view_path($viewName), ''); $this->info('File created.'); }
public function handle($exception) { Log::exception($exception); if (PHP_SAPI == 'cli') { echo $exception->getMessage(); echo "\r\n"; die; } if (defined('EXCEPTIONS_TEMPLATE')) { $template = EXCEPTIONS_TEMPLATE; } if (isset($template) && file_exists(view_path("{$template}.lb"))) { $view = new View($template, ['exception' => $exception]); } else { $view = new View('exceptions', ['exception' => $exception], __DIR__ . '/'); } echo $view->render(); die; }
/** * Initialization * * @param string $template * @param array $variables */ public function __construct($template, array $variables = [], $customPath = NULL, $compileVars = false) { if ($customPath) { $template = $customPath . str_replace('.', '/', $template); } else { $template = view_path(str_replace('.', '/', $template)); } if (file_exists("{$template}.lb")) { $this->template = "{$template}.lb"; } elseif (file_exists("{$template}.php")) { $this->template = "{$template}.php"; } else { throw new TemplateNotFoundException($template); } if ($compileVars) { $this->variables = ViewCompiler::compileVariables($variables); } else { $this->variables = $variables; } $this->compileTemplate(); }
function View($name) { $this->name = $name; $this->path = view_path($name); require_once $this->path; }
<?php return ['driver' => 'eloquent', 'model' => Modules\User\Entities\User::class, 'table' => 'users', 'login' => 'username', 'password' => ['email' => view_path('auth.mail.reset'), 'table' => 'password_resets', 'expire' => 60]];
<?php return ['theme' => 'bootstrap', 'custom' => view_path('layouts/styde'), 'control_access' => true, 'translate_texts' => true, 'novalidate' => false, 'abbreviations' => ['ph' => 'placeholder', 'max' => 'maxlength', 'tpl' => 'template'], 'themes' => ['bootstrap' => ['field_templates' => ['checkbox' => 'checkbox', 'checkboxes' => 'collections', 'radios' => 'collections'], 'field_classes' => ['default' => 'form-control', 'checkbox' => '', 'error' => 'input-with-feedback']]]];
/** * include view and send arguments. * * @param string $view * @param array $args */ function include_view($view, $args = array()) { if (!empty($args)) { extract($args); } include view_path() . $view . '.php'; }
<?php // debug ini_set("display_errors", "on"); // timezone date_default_timezone_set('Asia/Shanghai'); // view path view_path(__DIR__ . '/view/'); // db config db_config();