improved tenant identification
This commit is contained in:
@ -9,6 +9,16 @@ use Illuminate\View\Factory as ViewFactory;
|
||||
|
||||
class Macro extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
@ -24,6 +34,59 @@ class Macro extends ServiceProvider
|
||||
return !$this->isApi();
|
||||
});
|
||||
|
||||
Request::macro('isAuth', function () {
|
||||
return $this->is('auth/*');
|
||||
});
|
||||
|
||||
Request::macro('isNotAuth', function () {
|
||||
return !$this->isAuth();
|
||||
});
|
||||
|
||||
Request::macro('isInstall', function () {
|
||||
return $this->is('install/*');
|
||||
});
|
||||
|
||||
Request::macro('isNotInstall', function () {
|
||||
return !$this->isInstall();
|
||||
});
|
||||
|
||||
Request::macro('isSigned', function ($company_id) {
|
||||
return $this->is($company_id . '/signed/*');
|
||||
});
|
||||
|
||||
Request::macro('isNotSigned', function ($company_id) {
|
||||
return !$this->isSigned($company_id);
|
||||
});
|
||||
|
||||
Request::macro('isPortal', function ($company_id) {
|
||||
return $this->is($company_id . '/portal') || $this->is($company_id . '/portal/*');
|
||||
});
|
||||
|
||||
Request::macro('isNotPortal', function ($company_id) {
|
||||
return !$this->isPortal($company_id);
|
||||
});
|
||||
|
||||
Request::macro('isWizard', function ($company_id) {
|
||||
return $this->is($company_id . '/wizard') || $this->is($company_id . '/wizard/*');
|
||||
});
|
||||
|
||||
Request::macro('isNotWizard', function ($company_id) {
|
||||
return !$this->isWizard($company_id);
|
||||
});
|
||||
|
||||
Request::macro('isAdmin', function ($company_id) {
|
||||
return $this->isNotApi()
|
||||
&& $this->isNotAuth()
|
||||
&& $this->isNotInstall()
|
||||
&& $this->isNotSigned($company_id)
|
||||
&& $this->isNotPortal($company_id)
|
||||
&& $this->isNotWizard($company_id);
|
||||
});
|
||||
|
||||
Request::macro('isNotAdmin', function ($company_id) {
|
||||
return !$this->isAdmin($company_id);
|
||||
});
|
||||
|
||||
Str::macro('filename', function ($string, $separator = '-') {
|
||||
// Replace @ with the word 'at'
|
||||
$string = str_replace('@', $separator.'at'.$separator, $string);
|
||||
@ -47,14 +110,4 @@ class Macro extends ServiceProvider
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user