Example #1
0
 public function sendResponse($data)
 {
     switch ($this->contentType) {
         case 'text/html':
             Response::html($data);
             break;
         case 'application/json':
         case 'text/json':
             header('Content-type:text/json');
             Response::json($data);
             break;
     }
 }
Example #2
0
<?php

Event::on(404, function () {
    Response::html(View::from('special/error', ['code' => 404, 'message' => 'Page not found']));
});
Route::on('/', function () {
    return View::from('index');
});