Ejemplo n.º 1
0
 /**
  * Alias the services in the boot.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/PublishedAssets/Views/themes' => base_path('resources/themes'), __DIR__ . '/PublishedAssets/Controllers' => app_path('Http/Controllers/Quarx'), __DIR__ . '/Migrations' => base_path('database/migrations'), __DIR__ . '/PublishedAssets/Middleware' => app_path('Http/Middleware'), __DIR__ . '/PublishedAssets/Routes' => base_path('routes'), __DIR__ . '/PublishedAssets/Config' => base_path('config')]);
     $theme = Config::get('quarx.frontend-theme', 'default');
     $this->loadViewsFrom(__DIR__ . '/Views', 'quarx');
     View::addLocation(base_path('resources/themes/' . $theme));
     View::addNamespace('quarx-frontend', base_path('resources/themes/' . $theme));
     /*
     |--------------------------------------------------------------------------
     | Blade Directives
     |--------------------------------------------------------------------------
     */
     Blade::directive('theme', function ($expression) {
         if (Str::startsWith($expression, '(')) {
             $expression = substr($expression, 1, -1);
         }
         $theme = Config::get('quarx.frontend-theme');
         $view = '"quarx-frontend::' . str_replace('"', '', str_replace("'", '', $expression)) . '"';
         return "<?php echo \$__env->make({$view}, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
     });
     Blade::directive('menu', function ($expression) {
         return "<?php echo Quarx::menu({$expression}); ?>";
     });
     Blade::directive('widget', function ($expression) {
         return "<?php echo Quarx::widget({$expression}); ?>";
     });
     Blade::directive('images', function ($expression) {
         return "<?php echo Quarx::images({$expression}); ?>";
     });
     Blade::directive('edit', function ($expression) {
         return "<?php echo Quarx::editBtn({$expression}); ?>";
     });
     Blade::directive('markdown', function ($expression) {
         return "<?php echo Markdown::convertToHtml({$expression}); ?>";
     });
 }
Ejemplo n.º 2
0
 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @return void
  */
 protected function registerViewPath()
 {
     View::addLocation(__DIR__ . "/views");
 }