function handle_exception($e) { $template = App\Config::get('debug') ? 'debug' : '5xx'; $view = new App\Template($template, compact('e')); $response = new Symfony\Component\HttpFoundation\Response($view->fetch(), Symfony\Component\HttpFoundation\Response::HTTP_INTERNAL_SERVER_ERROR); $response->send(); }
public function install(Request $request, Response $response, array $args) { $template = new \App\Template('install.twig'); $template->title = 'Install'; $response->setContent($template->render()); return $response; }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('templates')->truncate(); DB::table('votes')->truncate(); DB::table('nominations')->truncate(); App\Template::create(['name' => '新闻', 'slug' => 'news']); App\Template::find(1)->get()->each(function ($tpl) { $tpl->votes()->saveMany(factory(App\Vote::class, 2)->create()->each(function ($v) { $v->user_id = '1'; $v->save(); $v->nominations()->saveMany(factory(App\Nomination::class, 10)->make()); })); }); }
public function remindReset(Request $request, Response $response, array $args) { $template = new \App\Template('remind_reset.twig'); // First check that the passwords match. $password = $request->get('password'); if ($password !== $request->get('password-confirmation')) { $template->alert('warning', 'Your passwords did not match.', true); return new RedirectResponse($this->config->baseUrl() . "/remind/" . $args['userid'] . "/" . $args['token']); } // Then see if the token is valid. $user = new User($this->db); $user->load($args['userid']); if (!$user->checkReminderToken($args['token'])) { $template->alert('warning', 'That reminder token has expired. Please try again.', true); return new RedirectResponse($this->config->baseUrl() . "/remind"); } // Finally change the password. This will delete the token as well. $user->changePassword($password); $template->alert('success', 'Your password has been changed. Please log in.', true); return new RedirectResponse($this->config->baseUrl() . "/login?name=" . $user->getName()); }
<?php require '../vendor/autoload.php'; /* JABH creamos una funcion en App define('DOMPDF_ENABLE_AUTOLOAD', false); require_once '../vendor/dompdf/dompdf/dompdf_config.inc.php'; */ $data = array('nombre' => 'Jonny Alexander Berrio', 'curso' => 'Laravel 5'); /* JABH creamos una funcion en App ob_start(); extract($data); include '../templates/pdf/certificate-2.php'; $html= ob_get_clean(); */ //require_once '../app/template.php'; //$html=Template::render('pdf/certificate-2',$data); $html = App\Template::render('pdf/certificate-2', $data); /* JABH creamos una funcion en App $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf"); */ //require_once '../app/pdf.php'; //Pdf::render('certificate-2',$html); App\Pdf::render('certificate-2', $html);
<?php if (isset($_POST) && sizeof($_POST) > 0) { $data = new \App\TopicData(); $data->add($_POST); header('Location: /'); exit; } $template = new \App\Template('../views/base.phtml'); $template->render('../views/index/add.phtml');