Example #1
0
 public static function path($view)
 {
     $view = str_replace(".", "/", $view);
     $file = App::getAppRoot() . "/views/{$view}.php";
     if (!file_exists($file)) {
         throw new \RuntimeException("View Not Found: [{$file}]");
     }
     return $file;
 }
Example #2
0
 /**
  * return stdClass by default
  */
 public static function get($name, $array = false)
 {
     $file = App::getAppRoot() . "/config/{$name}.php";
     if (!file_exists($file)) {
         throw new \RuntimeException("Config Not Found: [{$name}]");
     }
     $config = (include $file);
     if (!is_array($config)) {
         throw new \RuntimeException("Invalid Config: [{$name}]");
     }
     return $array ? $config : (object) $config;
 }
Example #3
0
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
App::alias(Config::get("app")->aliases);
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application.
| By default we will build a basic log file setup which creates a single
| file for logs.
|
*/
Log::useFile("/tmp/caravel.log");
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors.
|
*/
App::error(function (Exception $e, App $app) {
});
App::filter(function () {
});
App::homepage("/Demo/index");
Example #4
0
 public static function currentRouteAction()
 {
     $controller = App::getController();
     $action = App::getAction();
     return "{$controller}@{$action}";
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     // In this situation, we need to let Caravel know how to find commands.
     $this->autoload(array(self::getAppRoot() . "/commands"));
 }