/**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     if (!$this->app->routesAreCached()) {
         require_once __DIR__ . '/routes.php';
     }
     require_once __DIR__ . '/Helpers/helpers.php';
     $this->registerTenant();
     if ($tenant = tenant()) {
         $directory = tenant_path($tenant);
         // Load views from the current tenant directory
         $this->app['view']->addLocation(realpath($directory . '/views'));
         // Load the tenant routes within the application controller namespace.
         if (file_exists($directory . '/routes.php')) {
             Route::group(['namespace' => 'App\\Http\\Controllers'], function () use($directory) {
                 require_once $directory . '/routes.php';
             });
         }
         // Set the tenant cache driver
         Cache::setDefaultDriver('friet-nl');
     }
     // Load base views, these will be overridden by tenant views with the same name
     $this->app['view']->addLocation(realpath(base_path('resources/views')));
     // Publish the tenant config, which will be overriden by local configuration
     $this->publishes([__DIR__ . '/../config/tenant.php' => config_path('tenant.php')], 'multi-tenant');
 }
Exemple #2
0
 /**
  * Get the current connection name for the model.
  *
  * @return string
  */
 public function getConnectionName()
 {
     $tenant = tenant();
     if (is_null($tenant)) {
         return parent::getConnectionName();
     }
     return $tenant['id'];
 }
Exemple #3
0
 /**
  * Get the current connection name for the model.
  *
  * @return string
  */
 public function getConnectionName()
 {
     $tenant = tenant();
     if (is_null($tenant)) {
         return parent::getConnectionName();
     }
     return array_get($tenant, 'id');
 }
Exemple #4
0
 /**
  * Get the route to retrieve the given tenant asset.
  *
  * Uses a fallback to load the asset from the default
  * directory in case the tenant asset doesn't exist.
  *
  * @param  string $path
  * @param  bool $secure
  * @return string
  */
 function tasset($path, $secure = null)
 {
     $tenant = tenant();
     $asset = tenant_path($tenant, '/assets/' . $path);
     if ($tenant && file_exists($asset)) {
         return route('asset', [$path]);
     }
     return asset($path, $secure);
 }
Exemple #5
0
<?php

/**
 * Load tenant assets outside the public folder with this route.
 */
Route::get('asset/{path}', ['as' => 'asset', function ($path) {
    $asset = tenant_path(tenant(), '/assets/' . $path);
    if (!file_exists($asset)) {
        abort(404);
    }
    $mime = File::mimeType($asset);
    if ($mime == 'text/plain' && File::extension($asset) == 'css') {
        $mime = 'text/css';
    }
    return response(file_get_contents($asset), 200, ['Content-Type' => $mime]);
}])->where('path', '(.*)');
Exemple #6
0
                            60050625977
                          </p>
                        </div>
                      </div>
                    </div>
                  </footer>
                </div>

              </div>

              <div class="row no-print">
                <div class="col-xs-12 align-center">
                  <a class="btn btn-default" href="#"  onclick=" window.print();" style="margin-right: 5px;"><i class="fa fa-print"></i> Print</a>
             {{--     <button class="btn btn-default" style="margin-right: 5px;"><i class="fa fa-credit-card"></i> Send an email</button>--}}
                  <a href="<?php 
echo tenant()->url('invoice/bill/' . $data['id'] . '/download');
?>
" style="margin-right: 5px;" class="btn btn-primary"><i class="fa fa-download"></i> Generate PDF</a>
                </div>
              </div>
  </div>
  </div>
<?php 
if (Input::get('print') == 'auto') {
    ?>
<script>
        $(function(){
                window.print();
        });
</script>
<?php 
 /**
  * Set Base Url
  */
 function setBaseUrl()
 {
     $this->baseUrl = tenant()->url() . $this->uploadRoot . '/' . $this->bucket . '/';
 }