├── phpstan.neon.dist
├── resources
├── sass
│ ├── theme-managerarea.scss
│ └── theme-tenantarea.scss
├── views
│ ├── tenantarea
│ │ ├── partials
│ │ │ ├── footer.blade.php
│ │ │ ├── breadcrumbs.blade.php
│ │ │ ├── header.blade.php
│ │ │ ├── modal.blade.php
│ │ │ ├── actions.blade.php
│ │ │ ├── timestamps.blade.php
│ │ │ └── meta.blade.php
│ │ ├── errors
│ │ │ ├── 403.blade.php
│ │ │ ├── 404.blade.php
│ │ │ ├── 401.blade.php
│ │ │ ├── 419.blade.php
│ │ │ ├── 500.blade.php
│ │ │ ├── 429.blade.php
│ │ │ ├── 405.blade.php
│ │ │ └── 503.blade.php
│ │ ├── pages
│ │ │ ├── datatable-index.blade.php
│ │ │ ├── datatable-dropzone.blade.php
│ │ │ ├── datatable-tab.blade.php
│ │ │ └── index.blade.php
│ │ └── layouts
│ │ │ ├── error.blade.php
│ │ │ └── default.blade.php
│ └── managerarea
│ │ ├── errors
│ │ ├── 403.blade.php
│ │ ├── 404.blade.php
│ │ ├── 401.blade.php
│ │ ├── 419.blade.php
│ │ ├── 500.blade.php
│ │ ├── 405.blade.php
│ │ ├── 429.blade.php
│ │ └── 503.blade.php
│ │ ├── partials
│ │ ├── sidebar.blade.php
│ │ ├── footer.blade.php
│ │ ├── breadcrumbs.blade.php
│ │ ├── header.blade.php
│ │ ├── modal.blade.php
│ │ ├── actions.blade.php
│ │ ├── timestamps.blade.php
│ │ └── meta.blade.php
│ │ ├── pages
│ │ ├── index.blade.php
│ │ ├── import.blade.php
│ │ ├── datatable-logs.blade.php
│ │ ├── datatable-import-logs.blade.php
│ │ ├── datatable-index.blade.php
│ │ ├── datatable-tab.blade.php
│ │ ├── datatable-dropzone.blade.php
│ │ └── tenant.blade.php
│ │ └── layouts
│ │ ├── auth.blade.php
│ │ ├── default.blade.php
│ │ └── error.blade.php
├── js
│ └── webpack.mix.js
└── lang
│ └── en
│ └── common.php
├── config
└── config.php
├── routes
├── broadcasts
│ └── channels.php
├── breadcrumbs
│ ├── tenantarea.php
│ ├── managerarea.php
│ └── adminarea.php
├── web
│ ├── tenantarea.php
│ ├── managerarea.php
│ └── adminarea.php
└── menus
│ ├── managerarea.php
│ ├── tenantarea.php
│ └── adminarea.php
├── bootstrap
└── module.php
├── src
├── Http
│ ├── Controllers
│ │ ├── Managerarea
│ │ │ ├── GenericController.php
│ │ │ ├── HomeController.php
│ │ │ ├── TenantsMediaController.php
│ │ │ └── TenantsController.php
│ │ ├── Tenantarea
│ │ │ ├── GenericController.php
│ │ │ └── HomeController.php
│ │ └── Adminarea
│ │ │ ├── TenantsMediaController.php
│ │ │ └── TenantsController.php
│ └── Requests
│ │ ├── Managerarea
│ │ └── TenantFormRequest.php
│ │ └── Adminarea
│ │ └── TenantFormRequest.php
├── Providers
│ └── TenantsServiceProvider.php
├── Console
│ └── Commands
│ │ ├── SeedCommand.php
│ │ ├── InstallCommand.php
│ │ ├── PublishCommand.php
│ │ ├── RollbackCommand.php
│ │ └── MigrateCommand.php
├── Transformers
│ └── TenantTransformer.php
├── Events
│ ├── TenantCreated.php
│ ├── TenantDeleted.php
│ ├── TenantUpdated.php
│ └── TenantRestored.php
├── DataTables
│ └── Adminarea
│ │ └── TenantsDataTable.php
└── Models
│ └── Tenant.php
├── database
├── factories
│ └── TenantFactory.php
├── migrations
│ ├── 2021_01_01_000001_alter_tenants_table_add_auditable_columns.php
│ └── 2021_01_01_000001_alter_tenants_table_add_style_and_social_columns.php
└── seeders
│ └── CortexTenantsSeeder.php
├── LICENSE
├── CONTRIBUTING.md
├── README.md
├── CODE_OF_CONDUCT.md
├── composer.json
└── CHANGELOG.md
/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | includes:
2 | - ./vendor/nunomaduro/larastan/extension.neon
3 | parameters:
4 | level: 5
5 | paths:
6 | - src
7 |
--------------------------------------------------------------------------------
/resources/sass/theme-managerarea.scss:
--------------------------------------------------------------------------------
1 | @import '~admin-lte/dist/css/AdminLTE';
2 | @import '~admin-lte/dist/css/skins/skin-purple';
3 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/footer.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{!! config('app.copyright') !!}
4 |
5 |
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/403.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Forbidden'))
4 | @section('code', '403')
5 | @section('message', __('Forbidden'))
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/404.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Not Found'))
4 | @section('code', '404')
5 | @section('message', __('Not Found'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/403.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Forbidden'))
4 | @section('code', '403')
5 | @section('message', __('Forbidden'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/404.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Not Found'))
4 | @section('code', '404')
5 | @section('message', __('Not Found'))
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/401.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Unauthorized'))
4 | @section('code', '401')
5 | @section('message', __('Unauthorized'))
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/419.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Page Expired'))
4 | @section('code', '419')
5 | @section('message', __('Page Expired'))
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/500.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Server Error'))
4 | @section('code', '500')
5 | @section('message', __('Server Error'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/401.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Unauthorized'))
4 | @section('code', '401')
5 | @section('message', __('Unauthorized'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/419.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Page Expired'))
4 | @section('code', '419')
5 | @section('message', __('Page Expired'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/500.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Server Error'))
4 | @section('code', '500')
5 | @section('message', __('Server Error'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/sidebar.blade.php:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/429.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Too Many Requests'))
4 | @section('code', '429')
5 | @section('message', __('Too Many Requests'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/405.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Method not allowed'))
4 | @section('code', '405')
5 | @section('message', __('Method not allowed'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/429.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Too Many Requests'))
4 | @section('code', '429')
5 | @section('message', __('Too Many Requests'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/footer.blade.php:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/405.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Method not allowed'))
4 | @section('code', '405')
5 | @section('message', __('Method not allowed'))
6 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/errors/503.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::tenantarea.layouts.error')
2 |
3 | @section('title', __('Service Unavailable'))
4 | @section('code', '503')
5 | @section('message', __('Service Unavailable'))
6 |
--------------------------------------------------------------------------------
/resources/views/managerarea/errors/503.blade.php:
--------------------------------------------------------------------------------
1 | @extends('cortex/tenants::managerarea.layouts.error')
2 |
3 | @section('title', __('Service Unavailable'))
4 | @section('code', '503')
5 | @section('message', __('Service Unavailable'))
6 |
--------------------------------------------------------------------------------
/config/config.php:
--------------------------------------------------------------------------------
1 | true,
9 |
10 | // Tenants media storage disk
11 | 'media' => [
12 | 'disk' => 'public',
13 | ],
14 |
15 | ];
16 |
--------------------------------------------------------------------------------
/routes/broadcasts/channels.php:
--------------------------------------------------------------------------------
1 | can('list', app('rinvex.tenants.tenant'));
9 | });
10 |
--------------------------------------------------------------------------------
/routes/breadcrumbs/tenantarea.php:
--------------------------------------------------------------------------------
1 | push(' '.app('request.tenant')->name, route('tenantarea.home'));
10 | });
11 |
--------------------------------------------------------------------------------
/bootstrap/module.php:
--------------------------------------------------------------------------------
1 |
4 | @foreach ($breadcrumbs as $breadcrumb)
5 |
6 | @if ($breadcrumb->url && ! $loop->last)
7 | {!! $breadcrumb->title !!}
8 | @else
9 | {!! $breadcrumb->title !!}
10 | @endif
11 |
12 | @endforeach
13 |
14 |
15 | @endif
16 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/breadcrumbs.blade.php:
--------------------------------------------------------------------------------
1 | @if (count($breadcrumbs))
2 |
3 |
4 | @foreach ($breadcrumbs as $breadcrumb)
5 |
6 | @if ($breadcrumb->url && ! $loop->last)
7 | {!! $breadcrumb->title !!}
8 | @else
9 | {!! $breadcrumb->title !!}
10 | @endif
11 |
12 | @endforeach
13 |
14 |
15 | @endif
16 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Managerarea/GenericController.php:
--------------------------------------------------------------------------------
1 | getClientIp())->iso_code;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Tenantarea/GenericController.php:
--------------------------------------------------------------------------------
1 | getClientIp())->iso_code;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/resources/js/webpack.mix.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | scanForCssSelectors: [],
3 | webpackPlugins: [],
4 | safelist: [],
5 | install: [],
6 | copy: [],
7 | mix: {
8 | css: [
9 | {input: 'app/modules/cortex/tenants/resources/sass/theme-tenantarea.scss', output: 'public/css/theme-tenantarea.css'},
10 | {input: 'app/modules/cortex/tenants/resources/sass/theme-managerarea.scss', output: 'public/css/theme-managerarea.css'},
11 | ],
12 | js: [],
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Tenantarea/HomeController.php:
--------------------------------------------------------------------------------
1 | group(function () {
9 | Route::name('tenantarea.')
10 | ->middleware(['web'])
11 | ->prefix(route_prefix('tenantarea'))->group(function () {
12 | // Homepage Routes
13 | Route::get('/')->name('home')->uses([HomeController::class, 'index']);
14 | Route::post('country')->name('country')->uses([GenericController::class, 'country']);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/index.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
14 | {{-- Main content --}}
15 |
16 |
17 |
18 |
19 |
{{ trans('cortex/tenants::common.managerarea_welcome') }}
20 | {{ trans('cortex/tenants::common.managerarea_welcome_body') }}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection
29 |
--------------------------------------------------------------------------------
/src/Http/Requests/Managerarea/TenantFormRequest.php:
--------------------------------------------------------------------------------
1 | updateRulesUniques();
33 |
34 | return $tenant->getRules();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Http/Requests/Adminarea/TenantFormRequest.php:
--------------------------------------------------------------------------------
1 | route('tenant') ?? app('rinvex.tenants.tenant');
32 | $tenant->updateRulesUniques();
33 |
34 | return $tenant->getRules();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/factories/TenantFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->company,
28 | 'slug' => $this->faker->slug,
29 | 'email' => $this->faker->companyEmail,
30 | 'language_code' => $this->faker->languageCode,
31 | 'country_code' => $this->faker->countryCode,
32 | ];
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2021_01_01_000001_alter_tenants_table_add_auditable_columns.php:
--------------------------------------------------------------------------------
1 | auditable();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::table(config('rinvex.tenants.tables.tenants'), function (Blueprint $table) {
31 | $table->dropAuditable();
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Providers/TenantsServiceProvider.php:
--------------------------------------------------------------------------------
1 | registerModels([
28 | 'rinvex.tenants.tenant' => Tenant::class,
29 | ]);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/header.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 | {!! Menu::render('tenantarea.header.navigation') !!}
13 |
14 |
15 | {!! Menu::render('tenantarea.header.language') !!}
16 | {!! Menu::render('tenantarea.header.user') !!}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/header.blade.php:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/modal.blade.php:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/modal.blade.php:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/Console/Commands/SeedCommand.php:
--------------------------------------------------------------------------------
1 | alert($this->description);
36 |
37 | $this->call('db:seed', ['--class' => CortexTenantsSeeder::class]);
38 |
39 | $this->line('');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/routes/menus/managerarea.php:
--------------------------------------------------------------------------------
1 | dropdown(function (MenuItem $dropdown) {
10 | $dropdown->route(['managerarea.cortex.tenants.tenants.edit'], trans('cortex/auth::common.settings'), 10, 'fa fa-building-o')->ifCan('update', app('request.tenant'));
11 | }, app('request.tenant')->name, 9, 'fa fa-briefcase');
12 | });
13 |
14 | if (config('cortex.foundation.route.locale_prefix')) {
15 | Menu::register('managerarea.header.language', function (MenuGenerator $menu) {
16 | $menu->dropdown(function (MenuItem $dropdown) {
17 | foreach (app('laravellocalization')->getSupportedLocales() as $key => $locale) {
18 | $dropdown->url(app('laravellocalization')->localizeURL(request()->fullUrl(), $key), $locale['name']);
19 | }
20 | }, app('laravellocalization')->getCurrentLocaleNative(), 10, 'fa fa-globe');
21 | });
22 | }
23 |
--------------------------------------------------------------------------------
/routes/breadcrumbs/managerarea.php:
--------------------------------------------------------------------------------
1 | push(' '.app('request.tenant')->name, route('managerarea.home'));
11 | });
12 |
13 | Breadcrumbs::for('managerarea.cortex.tenants.tenants.edit', function (Generator $breadcrumbs) {
14 | $tenant = app('request.tenant');
15 | $breadcrumbs->parent('managerarea.home');
16 | $breadcrumbs->push(strip_tags($tenant->name), route('managerarea.cortex.tenants.tenants.edit', ['tenant' => $tenant]));
17 | });
18 |
19 | Breadcrumbs::for('managerarea.cortex.tenants.tenants.media.index', function (Generator $breadcrumbs, Tenant $tenant) {
20 | $breadcrumbs->parent('managerarea.cortex.tenants.tenants.edit', $tenant);
21 | $breadcrumbs->push(trans('cortex/tenants::common.media'), route('managerarea.cortex.tenants.tenants.media.index', ['tenant' => $tenant]));
22 | });
23 |
--------------------------------------------------------------------------------
/database/migrations/2021_01_01_000001_alter_tenants_table_add_style_and_social_columns.php:
--------------------------------------------------------------------------------
1 | schemalessAttributes('social')->after('currency');
20 | $table->string('style')->before('is_active')->nullable();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down(): void
30 | {
31 | Schema::table(config('rinvex.tenants.tables.tenants'), function (Blueprint $table) {
32 | $table->dropColumn('style');
33 | $table->dropColumn('social');
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016-2021, Rinvex LLC,
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/routes/menus/tenantarea.php:
--------------------------------------------------------------------------------
1 | dropdown(function (MenuItem $dropdown) {
11 | foreach (app('laravellocalization')->getSupportedLocales() as $key => $locale) {
12 | $dropdown->url(app('laravellocalization')->localizeURL(request()->fullUrl(), $key), $locale['name']);
13 | }
14 | }, app('laravellocalization')->getCurrentLocaleNative(), 10, 'fa fa-globe');
15 | });
16 | }
17 |
18 | Menu::register('tenantarea.header.navigation', function (MenuGenerator $menu) {
19 | $menu->url(route('tenantarea.home'), 'Home', null, null, ['class' => 'smothscroll'])->if(! Route::is('tenantarea.home'));
20 | $menu->url('#home', 'Home', null, null, ['class' => 'smothscroll'])->if(Route::is('tenantarea.home'));
21 | $menu->url('#desc', 'Description', null, null, ['class' => 'smothscroll'])->if(Route::is('tenantarea.home'));
22 | $menu->url('#contact', 'Contact', null, null, ['class' => 'smothscroll'])->if(Route::is('tenantarea.home'));
23 | });
24 |
--------------------------------------------------------------------------------
/src/Console/Commands/InstallCommand.php:
--------------------------------------------------------------------------------
1 | alert($this->description);
35 |
36 | ! $this->option('resource') || $this->call('cortex:publish:tenants', ['--force' => $this->option('force'), '--resource' => $this->option('resource')]);
37 |
38 | $this->call('cortex:migrate:tenants', ['--force' => $this->option('force')]);
39 | $this->call('cortex:seed:tenants');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Console/Commands/PublishCommand.php:
--------------------------------------------------------------------------------
1 | option('resource') ?: ['config', 'lang', 'views', 'migrations'])->each(function ($resource) {
37 | $this->call('vendor:publish', ['--tag' => "cortex/tenants::{$resource}", '--force' => $this->option('force')]);
38 | });
39 |
40 | $this->line('');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/import.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | {{ Form::open(['url' => $url, 'class' => 'dropzone', 'id' => "$id-dropzone", 'data-dz-accepted-files' => implode(',', config('cortex.foundation.datatables.imports'))]) }}
27 |
{{ trans('cortex/foundation::common.drop_to_import') }}
28 | {{ Form::close() }}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | @endsection
40 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/pages/datatable-index.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::tenantarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
14 |
15 |
16 | @include('cortex/auth::tenantarea.partials.sidebar')
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{ Breadcrumbs::render() }}
25 |
26 |
27 | @yield('datatable-filters')
28 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | @endsection
37 |
38 | @push('styles')
39 |
40 | @endpush
41 |
42 | @push('vendor-scripts')
43 |
44 | @endpush
45 |
46 | @push('inline-scripts')
47 | {!! $dataTable->scripts() !!}
48 | @endpush
49 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/datatable-logs.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | @endsection
38 |
39 | @push('styles')
40 |
41 | @endpush
42 |
43 | @push('vendor-scripts')
44 |
45 | @endpush
46 |
47 | @push('inline-scripts')
48 | {!! $dataTable->scripts() !!}
49 | @endpush
50 |
--------------------------------------------------------------------------------
/src/Transformers/TenantTransformer.php:
--------------------------------------------------------------------------------
1 | country_code ? country($tenant->country_code) : null;
27 | $language = $tenant->language_code ? language($tenant->language_code) : null;
28 |
29 | return $this->escape([
30 | 'id' => (string) $tenant->getRouteKey(),
31 | 'name' => (string) $tenant->name,
32 | 'email' => (string) $tenant->email,
33 | 'phone' => (string) $tenant->phone,
34 | 'country_code' => (string) $country?->getName(),
35 | 'country_emoji' => (string) $country?->getEmoji(),
36 | 'language_code' => (string) $language?->getName(),
37 | 'created_at' => (string) $tenant->created_at,
38 | 'updated_at' => (string) $tenant->updated_at,
39 | ]);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/datatable-import-logs.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | @endsection
38 |
39 | @push('styles')
40 |
41 | @endpush
42 |
43 | @push('vendor-scripts')
44 |
45 | @endpush
46 |
47 | @push('inline-scripts')
48 | {!! $dataTable->scripts() !!}
49 | @endpush
50 |
--------------------------------------------------------------------------------
/resources/views/managerarea/layouts/auth.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @yield('title', config('app.name'))
6 |
7 | {{-- Meta Data --}}
8 | @include('cortex/tenants::managerarea.partials.meta')
9 | @stack('head-elements')
10 |
11 | {{-- Styles --}}
12 |
13 |
14 |
15 | @stack('styles')
16 |
17 | {{-- Scripts --}}
18 |
22 |
23 |
24 | @stack('vendor-scripts')
25 |
26 |
27 |
28 |
29 | {{-- Main content --}}
30 |
31 |
32 | @yield('content')
33 |
34 |
35 |
36 | {{-- Scripts --}}
37 | @stack('inline-scripts')
38 |
39 | {{-- Alerts --}}
40 | @alerts('default')
41 |
42 |
43 |
--------------------------------------------------------------------------------
/routes/web/managerarea.php:
--------------------------------------------------------------------------------
1 | group(function () {
11 | Route::name('managerarea.')
12 | ->middleware(['web', 'nohttpcache', 'can:access-managerarea'])
13 | ->prefix(route_prefix('managerarea'))->group(function () {
14 | // Managerarea Home route
15 | Route::get('/')->name('home')->uses([HomeController::class, 'index']);
16 | Route::post('country')->name('country')->uses([GenericController::class, 'country']);
17 |
18 | // Managerarea edit tenant
19 | Route::name('cortex.tenants.tenants.')->prefix('tenants')->group(function () {
20 | Route::get('edit')->name('edit')->uses([TenantsController::class, 'edit']);
21 | Route::put('edit')->name('update')->uses([TenantsController::class, 'update']);
22 |
23 | Route::name('media.')->prefix('media')->group(function () {
24 | Route::delete('{media}')->name('destroy')->uses([TenantsMediaController::class, 'destroy']);
25 | });
26 | });
27 | });
28 | });
29 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/actions.blade.php:
--------------------------------------------------------------------------------
1 | @if(request()->user()->can('delete', $model) || request()->user()->can('create', $model))
2 |
19 | @endif
20 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/actions.blade.php:
--------------------------------------------------------------------------------
1 | @if(request()->user()->can('delete', $model) || request()->user()->can('create', $model))
2 |
19 | @endif
20 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/datatable-index.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | @yield('datatable-filters')
27 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | @endsection
40 |
41 | @push('styles')
42 |
43 | @endpush
44 |
45 | @push('vendor-scripts')
46 |
47 | @endpush
48 |
49 | @push('inline-scripts')
50 | {!! $dataTable->scripts() !!}
51 | @endpush
52 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/datatable-tab.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | @yield('datatable-filters')
27 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | @endsection
39 |
40 | @push('styles')
41 |
42 | @endpush
43 |
44 | @push('vendor-scripts')
45 |
46 | @endpush
47 |
48 | @push('inline-scripts')
49 | {!! $dataTable->scripts() !!}
50 | @endpush
51 |
--------------------------------------------------------------------------------
/src/Console/Commands/RollbackCommand.php:
--------------------------------------------------------------------------------
1 | laravel->databasePath('migrations/cortex/tenants');
37 |
38 | if (file_exists($path)) {
39 | $this->call('migrate:reset', [
40 | '--path' => $path,
41 | '--realpath' => true,
42 | '--force' => $this->option('force'),
43 | ]);
44 | } else {
45 | $this->warn('No migrations found! Consider publish them first: php artisan cortex:publish:tenants>');
46 | }
47 |
48 | parent::handle();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/resources/views/managerarea/layouts/default.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @yield('title', config('app.name'))
6 |
7 | {{-- Meta Data --}}
8 | @include('cortex/tenants::managerarea.partials.meta')
9 | @stack('head-elements')
10 |
11 | {{-- Styles --}}
12 |
13 |
14 |
15 | @stack('styles')
16 |
17 | {{-- Scripts --}}
18 |
22 |
23 |
24 | @stack('vendor-scripts')
25 |
26 |
27 |
28 |
29 | {{-- Main content --}}
30 |
31 |
32 | @include('cortex/tenants::managerarea.partials.header')
33 | @include('cortex/tenants::managerarea.partials.sidebar')
34 |
35 | @yield('content')
36 |
37 | @include('cortex/tenants::managerarea.partials.footer')
38 |
39 |
40 |
41 | {{-- Scripts --}}
42 | @stack('inline-scripts')
43 |
44 | {{-- Alerts --}}
45 | @alerts('default')
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/Console/Commands/MigrateCommand.php:
--------------------------------------------------------------------------------
1 | laravel->databasePath('migrations/cortex/tenants');
39 |
40 | if (file_exists($path)) {
41 | $this->call('migrate', [
42 | '--step' => true,
43 | '--path' => $path,
44 | '--realpath' => true,
45 | '--force' => $this->option('force'),
46 | ]);
47 | } else {
48 | $this->warn('No migrations found! Consider publish them first: php artisan cortex:publish:tenants>');
49 | }
50 |
51 | $this->line('');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/Events/TenantCreated.php:
--------------------------------------------------------------------------------
1 | model = $tenant;
42 | }
43 |
44 | /**
45 | * Get the channels the event should broadcast on.
46 | *
47 | * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]
48 | */
49 | public function broadcastOn()
50 | {
51 | return [
52 | new PrivateChannel('cortex.tenants.tenants.index'),
53 | ];
54 | }
55 |
56 | /**
57 | * The event's broadcast name.
58 | *
59 | * @return string
60 | */
61 | public function broadcastAs()
62 | {
63 | return 'tenant.created';
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/resources/views/managerarea/layouts/error.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | @yield('title')
8 |
9 | {{-- Fonts --}}
10 |
11 |
12 |
13 | {{-- Styles --}}
14 |
50 |
51 |
52 |
53 |
54 | @yield('code')
55 |
56 |
57 |
58 | @yield('message')
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/layouts/error.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | @yield('title')
8 |
9 | {{-- Fonts --}}
10 |
11 |
12 |
13 | {{-- Styles --}}
14 |
50 |
51 |
52 |
53 |
54 | @yield('code')
55 |
56 |
57 |
58 | @yield('message')
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/Events/TenantDeleted.php:
--------------------------------------------------------------------------------
1 | model = $tenant->withoutRelations();
40 | }
41 |
42 | /**
43 | * Get the channels the event should broadcast on.
44 | *
45 | * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]
46 | */
47 | public function broadcastOn()
48 | {
49 | return [
50 | new PrivateChannel('cortex.tenants.tenants.index'),
51 | new PrivateChannel("cortex.tenants.tenants.{$this->model->getRouteKey()}"),
52 | ];
53 | }
54 |
55 | /**
56 | * The event's broadcast name.
57 | *
58 | * @return string
59 | */
60 | public function broadcastAs()
61 | {
62 | return 'tenant.deleted';
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/resources/lang/en/common.php:
--------------------------------------------------------------------------------
1 | 'Name',
8 | 'slug' => 'Slug',
9 | 'email' => 'Email',
10 | 'website' => 'Website',
11 | 'description' => 'Description',
12 | 'phone' => 'Phone',
13 | 'address' => 'Address',
14 | 'state' => 'State',
15 | 'postal_code' => 'Postal Code',
16 | 'city' => 'City',
17 | 'currency' => 'Currency',
18 | 'select_currency' => 'Select Currency',
19 | 'launch_date' => 'Launch Date',
20 | 'country' => 'Country',
21 | 'language' => 'Language',
22 | 'created_at' => 'Created At',
23 | 'updated_at' => 'Updated At',
24 | 'details' => 'Details',
25 | 'logs' => 'Logs',
26 | 'social' => 'Social',
27 | 'yes' => 'Yes',
28 | 'no' => 'No',
29 | 'is_active' => 'Is Active',
30 | 'submit' => 'Submit',
31 | 'select_language' => 'Select Language',
32 | 'select_country' => 'Select Country',
33 | 'style' => 'Style',
34 | 'tenant_details' => 'Tenant Details',
35 | 'media' => 'Media',
36 | 'records' => 'Records',
37 | 'import' => 'Import',
38 | 'cover_photo' => 'Cover Photo',
39 | 'profile_picture' => 'Profile Picture',
40 | 'tags' => 'Tags',
41 | 'domain' => 'Domain',
42 | 'twitter' => 'Twitter',
43 | 'facebook' => 'Facebook',
44 | 'linkedin' => 'LinkedIn',
45 | 'browse' => 'Browse',
46 |
47 | // Tenants
48 | 'tenant' => 'Tenant',
49 | 'tenants' => 'Tenants',
50 | 'create_tenant' => 'Create New Tenant',
51 | 'managerarea_welcome' => 'Welcome to managerarea',
52 | 'managerarea_welcome_body' => 'This is your dashboard, a place with your taste to get a glimpse about system vitals, and data metrics in nice widgets.',
53 |
54 | ];
55 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/pages/datatable-dropzone.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::tenantarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | {{ Form::open(['url' => $url, 'class' => 'dropzone', 'id' => "$id-media-dropzone", 'data-dz-accepted-files' => implode(',', config('cortex.foundation.datatables.imports'))]) }}
27 |
{{ trans('cortex/foundation::common.drop_to_import') }}
28 | {{ Form::close() }}
29 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | @endsection
41 |
42 | @push('styles')
43 |
44 | @endpush
45 |
46 | @push('vendor-scripts')
47 |
48 | @endpush
49 |
50 | @push('inline-scripts')
51 | {!! $dataTable->scripts() !!}
52 | @endpush
53 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/datatable-dropzone.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
16 |
17 | {{-- Main content --}}
18 |
19 |
20 |
21 | {!! Menu::render($tabs, 'nav-tab') !!}
22 |
23 |
24 |
25 |
26 | {{ Form::open(['url' => $url, 'class' => 'dropzone', 'id' => "$id-media-dropzone", 'data-dz-accepted-files' => implode(',', config('cortex.foundation.datatables.imports'))]) }}
27 |
{{ trans('cortex/foundation::common.drop_to_import') }}
28 | {{ Form::close() }}
29 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | @endsection
41 |
42 | @push('styles')
43 |
44 | @endpush
45 |
46 | @push('vendor-scripts')
47 |
48 | @endpush
49 |
50 | @push('inline-scripts')
51 | {!! $dataTable->scripts() !!}
52 | @endpush
53 |
--------------------------------------------------------------------------------
/src/Events/TenantUpdated.php:
--------------------------------------------------------------------------------
1 | model = $tenant;
42 | }
43 |
44 | /**
45 | * Get the channels the event should broadcast on.
46 | *
47 | * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]
48 | */
49 | public function broadcastOn()
50 | {
51 | return [
52 | new PrivateChannel('cortex.tenants.tenants.index'),
53 | new PrivateChannel("cortex.tenants.tenants.{$this->model->getRouteKey()}"),
54 | ];
55 | }
56 |
57 | /**
58 | * The event's broadcast name.
59 | *
60 | * @return string
61 | */
62 | public function broadcastAs()
63 | {
64 | return 'tenant.updated';
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/Events/TenantRestored.php:
--------------------------------------------------------------------------------
1 | model = $tenant;
42 | }
43 |
44 | /**
45 | * Get the channels the event should broadcast on.
46 | *
47 | * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]
48 | */
49 | public function broadcastOn()
50 | {
51 | return [
52 | new PrivateChannel('cortex.tenants.tenants.index'),
53 | new PrivateChannel("cortex.tenants.tenants.{$this->model->getRouteKey()}"),
54 | ];
55 | }
56 |
57 | /**
58 | * The event's broadcast name.
59 | *
60 | * @return string
61 | */
62 | public function broadcastAs()
63 | {
64 | return 'tenant.restored';
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/layouts/default.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @yield('title', config('app.name'))
6 |
7 | {{-- Meta Data --}}
8 | @include('cortex/tenants::tenantarea.partials.meta')
9 | @stack('head-elements')
10 |
11 | {{-- Fonts --}}
12 |
13 |
14 |
15 | {{-- Styles --}}
16 |
17 |
18 |
19 | @stack('styles')
20 |
21 | {{-- Scripts --}}
22 |
26 |
27 |
28 | @stack('vendor-scripts')
29 |
30 |
31 |
32 |
33 |
34 |
35 | @include('cortex/tenants::tenantarea.partials.header')
36 |
37 | @yield('content')
38 |
39 | @include('cortex/tenants::tenantarea.partials.footer')
40 |
41 |
42 |
43 | {{-- Scripts --}}
44 | @stack('inline-scripts')
45 |
46 | {{-- Alerts --}}
47 | @alerts('default')
48 |
49 |
50 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/pages/datatable-tab.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::tenantarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | {{-- Main Content --}}
10 | @section('content')
11 |
12 |
13 |
14 |
15 |
16 | @include('cortex/auth::tenantarea.partials.sidebar')
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{ Breadcrumbs::render() }}
25 |
26 |
27 |
28 | {!! Menu::render("{$tabs}", 'nav-tab') !!}
29 |
30 |
31 |
32 |
33 |
34 | @yield('datatable-filters')
35 | {!! $dataTable->pusher($pusher ?? null)->routePrefix($routePrefix ?? null)->table(['id' => $id]) !!}
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | @endsection
52 |
53 | @push('styles')
54 |
55 | @endpush
56 |
57 | @push('vendor-scripts')
58 |
59 | @endpush
60 |
61 | @push('inline-scripts')
62 | {!! $dataTable->scripts() !!}
63 | @endpush
64 |
--------------------------------------------------------------------------------
/routes/menus/adminarea.php:
--------------------------------------------------------------------------------
1 | findByTitleOrAdd(trans('cortex/foundation::common.crm'), 50, 'fa fa-briefcase', 'header', [], [], function (MenuItem $dropdown) {
12 | $dropdown->route(['adminarea.cortex.tenants.tenants.index'], trans('cortex/tenants::common.tenants'), 20, 'fa fa-building-o')->ifCan('list', app('rinvex.tenants.tenant'))->activateOnRoute('adminarea.cortex.tenants.tenants');
13 | });
14 | });
15 |
16 | Menu::register('adminarea.cortex.tenants.tenants.tabs', function (MenuGenerator $menu, Tenant $tenant, Media $media) {
17 | $menu->route(['adminarea.cortex.tenants.tenants.import'], trans('cortex/tenants::common.records'))->ifCan('import', $tenant)->if(Route::is('adminarea.cortex.tenants.tenants.import*'));
18 | $menu->route(['adminarea.cortex.tenants.tenants.import.logs'], trans('cortex/tenants::common.logs'))->ifCan('audit', $tenant)->if(Route::is('adminarea.cortex.tenants.tenants.import*'));
19 | $menu->route(['adminarea.cortex.tenants.tenants.create'], trans('cortex/tenants::common.details'))->ifCan('create', $tenant)->if(Route::is('adminarea.cortex.tenants.tenants.create'));
20 | $menu->route(['adminarea.cortex.tenants.tenants.edit', ['tenant' => $tenant]], trans('cortex/tenants::common.details'))->ifCan('update', $tenant)->if($tenant->exists);
21 | $menu->route(['adminarea.cortex.tenants.tenants.logs', ['tenant' => $tenant]], trans('cortex/tenants::common.logs'))->ifCan('audit', $tenant)->if($tenant->exists);
22 | $menu->route(['adminarea.cortex.tenants.tenants.media.index', ['tenant' => $tenant]], trans('cortex/tenants::common.media'))->ifCan('update', $tenant)->ifCan('list', $media)->if($tenant->exists);
23 | });
24 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Managerarea/TenantsMediaController.php:
--------------------------------------------------------------------------------
1 | mapResourceAbilities() as $method => $ability) {
27 | $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter;
28 |
29 | $middleware["can:update,{$modelName}"][] = $method;
30 | $middleware["can:{$ability},media"][] = $method;
31 | }
32 |
33 | foreach ($middleware as $middlewareName => $methods) {
34 | $this->middleware($middlewareName, $options)->only($methods);
35 | }
36 | }
37 |
38 | /**
39 | * Destroy given tenant media.
40 | *
41 | * @param \Cortex\Foundation\Models\Media $media
42 | *
43 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
44 | */
45 | public function destroy(Media $media)
46 | {
47 | $tenant = app('request.tenant');
48 | $tenant->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
49 |
50 | return intend([
51 | 'back' => true,
52 | 'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/foundation::common.media'), 'identifier' => $media->getRouteKey()])],
53 | ]);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/routes/web/adminarea.php:
--------------------------------------------------------------------------------
1 | group(function () {
9 | Route::name('adminarea.')
10 | ->middleware(['web', 'nohttpcache', 'can:access-adminarea'])
11 | ->prefix(route_prefix('adminarea'))->group(function () {
12 | // Tenants Routes
13 | Route::name('cortex.tenants.tenants.')->prefix('tenants')->group(function () {
14 | Route::match(['get', 'post'], '/')->name('index')->uses([TenantsController::class, 'index']);
15 | Route::post('import')->name('import')->uses([TenantsController::class, 'import']);
16 | Route::get('create')->name('create')->uses([TenantsController::class, 'create']);
17 | Route::post('create')->name('store')->uses([TenantsController::class, 'store']);
18 | Route::get('{tenant}')->name('show')->uses([TenantsController::class, 'show']);
19 | Route::get('{tenant}/edit')->name('edit')->uses([TenantsController::class, 'edit']);
20 | Route::put('{tenant}/edit')->name('update')->uses([TenantsController::class, 'update']);
21 | Route::match(['get', 'post'], '{tenant}/logs')->name('logs')->uses([TenantsController::class, 'logs']);
22 | Route::delete('{tenant}')->name('destroy')->uses([TenantsController::class, 'destroy']);
23 |
24 | Route::name('media.')->prefix('{tenant}/media')->group(function () {
25 | Route::get('/')->name('index')->uses([TenantsMediaController::class, 'index']);
26 | Route::post('/')->name('store')->uses([TenantsMediaController::class, 'store']);
27 | Route::delete('{media}')->name('destroy')->uses([TenantsMediaController::class, 'destroy']);
28 | });
29 | });
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contribution Guide
2 |
3 | This project adheres to the following standards and practices.
4 |
5 |
6 | ## Versioning
7 |
8 | This project is versioned under the [Semantic Versioning](http://semver.org/) guidelines as much as possible.
9 |
10 | Releases will be numbered with the following format:
11 |
12 | - `..`
13 | - `..`
14 |
15 | And constructed with the following guidelines:
16 |
17 | - Breaking backward compatibility bumps the major and resets the minor and patch.
18 | - New additions without breaking backward compatibility bump the minor and reset the patch.
19 | - Bug fixes and misc changes bump the patch.
20 |
21 |
22 | ## Pull Requests
23 |
24 | The pull request process differs for new features and bugs.
25 |
26 | Pull requests for bugs may be sent without creating any proposal issue. If you believe that you know of a solution for a bug that has been filed, please leave a comment detailing your proposed fix or create a pull request with the fix mentioning that issue id.
27 |
28 |
29 | ## Coding Standards
30 |
31 | This project follows the FIG PHP Standards Recommendations compliant with the [PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/), [PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/) and [PSR-4: Autoloader](http://www.php-fig.org/psr/psr-4/) to ensure a high level of interoperability between shared PHP code. If you notice any compliance oversights, please send a patch via pull request.
32 |
33 |
34 | ## Feature Requests
35 |
36 | If you have a proposal or a feature request, you may create an issue with `[Proposal]` in the title.
37 |
38 | The proposal should also describe the new feature, as well as implementation ideas. The proposal will then be reviewed and either approved or denied. Once a proposal is approved, a pull request may be created implementing the new feature.
39 |
40 |
41 | ## Git Flow
42 |
43 | This project follows [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/), and as such has `master` (latest stable releases), `develop` (latest WIP development) and X.Y support branches (when there's multiple major versions).
44 |
45 | Accordingly all pull requests MUST be sent to the `develop` branch.
46 |
47 | > **Note:** Pull requests which do not follow these guidelines will be closed without any further notice.
48 |
--------------------------------------------------------------------------------
/routes/breadcrumbs/adminarea.php:
--------------------------------------------------------------------------------
1 | parent('adminarea.home');
11 | $breadcrumbs->push(trans('cortex/tenants::common.tenants'), route('adminarea.cortex.tenants.tenants.index'));
12 | });
13 |
14 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.import', function (Generator $breadcrumbs) {
15 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.index');
16 | $breadcrumbs->push(trans('cortex/tenants::common.import'), route('adminarea.cortex.tenants.tenants.import'));
17 | });
18 |
19 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.import.logs', function (Generator $breadcrumbs) {
20 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.import');
21 | $breadcrumbs->push(trans('cortex/tenants::common.logs'), route('adminarea.cortex.tenants.tenants.import.logs'));
22 | });
23 |
24 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.create', function (Generator $breadcrumbs) {
25 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.index');
26 | $breadcrumbs->push(trans('cortex/tenants::common.create_tenant'), route('adminarea.cortex.tenants.tenants.create'));
27 | });
28 |
29 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.edit', function (Generator $breadcrumbs, Tenant $tenant) {
30 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.index');
31 | $breadcrumbs->push(strip_tags($tenant->name), route('adminarea.cortex.tenants.tenants.edit', ['tenant' => $tenant]));
32 | });
33 |
34 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.logs', function (Generator $breadcrumbs, Tenant $tenant) {
35 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.edit', $tenant);
36 | $breadcrumbs->push(trans('cortex/tenants::common.logs'), route('adminarea.cortex.tenants.tenants.logs', ['tenant' => $tenant]));
37 | });
38 |
39 | Breadcrumbs::for('adminarea.cortex.tenants.tenants.media.index', function (Generator $breadcrumbs, Tenant $tenant) {
40 | $breadcrumbs->parent('adminarea.cortex.tenants.tenants.edit', $tenant);
41 | $breadcrumbs->push(trans('cortex/tenants::common.media'), route('adminarea.cortex.tenants.tenants.media.index', ['tenant' => $tenant]));
42 | });
43 |
--------------------------------------------------------------------------------
/database/seeders/CortexTenantsSeeder.php:
--------------------------------------------------------------------------------
1 | 'update-tenant', 'title' => 'Update Tenant'],
20 | ['name' => 'access-managerarea', 'title' => 'Access managerarea'],
21 | ];
22 |
23 | $abilities = [
24 | ['name' => 'list', 'title' => 'List tenants', 'entity_type' => 'tenant'],
25 | ['name' => 'view', 'title' => 'View tenants', 'entity_type' => 'tenant'],
26 | ['name' => 'import', 'title' => 'Import tenants', 'entity_type' => 'tenant'],
27 | ['name' => 'export', 'title' => 'Export tenants', 'entity_type' => 'tenant'],
28 | ['name' => 'create', 'title' => 'Create tenants', 'entity_type' => 'tenant'],
29 | ['name' => 'update', 'title' => 'Update tenants', 'entity_type' => 'tenant'],
30 | ['name' => 'delete', 'title' => 'Delete tenants', 'entity_type' => 'tenant'],
31 | ['name' => 'audit', 'title' => 'Audit tenants', 'entity_type' => 'tenant'],
32 | ];
33 |
34 | $accessareas = [
35 | ['name' => 'managerarea', 'slug' => 'managerarea', 'is_protected' => true, 'is_scoped' => false, 'is_indexable' => false, 'prefix' => 'managerarea'],
36 | ['name' => 'tenantarea', 'slug' => 'tenantarea', 'is_protected' => true],
37 | ];
38 |
39 | collect($accessAbilities)->each(function (array $ability) {
40 | app('cortex.auth.ability')->firstOrCreate([
41 | 'name' => $ability['name'],
42 | ], $ability);
43 | });
44 |
45 | collect($abilities)->each(function (array $ability) {
46 | app('cortex.auth.ability')->firstOrCreate([
47 | 'name' => $ability['name'],
48 | 'entity_type' => $ability['entity_type'],
49 | ], $ability);
50 | });
51 |
52 | collect($accessareas)->each(function (array $accessarea) {
53 | app('cortex.foundation.accessarea')->firstOrCreate([
54 | 'slug' => $accessarea['slug'],
55 | ], $accessarea);
56 | });
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/timestamps.blade.php:
--------------------------------------------------------------------------------
1 |
2 | @if($model->exists)
3 |
4 | {{ trans('cortex/foundation::common.id') }}: {{ $model->getRouteKey() }}
5 |
6 |
7 | @if($model->created_at || $model->updated_at) | @endif
8 |
9 | @if($model->created_at)
10 |
11 | {{ trans('cortex/foundation::common.created_at') }}:
12 | {{ $model->created_at->format(config('app.date_format')) }}
13 | @if($model->createdBy && request()->user()->can('update', $model->createdBy))
14 | {{ trans('cortex/foundation::common.by') }}
15 | @if(Route::has(request()->accessarea().'.cortex.auth.'.Str::plural($model->createdBy->getMorphClass()).'.edit'))
16 | {{ $model->createdBy->username }}
17 | @else
18 | {{ $model->createdBy->username }}
19 | @endif
20 | @endif
21 |
22 | @endif
23 |
24 | @if($model->created_at && $model->updated_at) | @endif
25 |
26 | @if($model->updated_at)
27 |
28 | {{ trans('cortex/foundation::common.updated_at') }}:
29 | {{ $model->updated_at->format(config('app.date_format')) }}
30 | @if($model->updatedBy && request()->user()->can('update', $model->updatedBy))
31 | {{ trans('cortex/foundation::common.by') }}
32 | @if(Route::has(request()->accessarea().'.cortex.auth.'.Str::plural($model->updatedBy->getMorphClass()).'.edit' ))
33 | {{ $model->updatedBy->username }}
34 | @else
35 | {{ $model->updatedBy->username }}
36 | @endif
37 | @endif
38 |
39 | @endif
40 | @endif
41 |
42 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/timestamps.blade.php:
--------------------------------------------------------------------------------
1 |
2 | @if($model->exists)
3 |
4 | {{ trans('cortex/foundation::common.id') }}: {{ $model->getRouteKey() }}
5 |
6 |
7 | @if($model->created_at || $model->updated_at) | @endif
8 |
9 | @if($model->created_at)
10 |
11 | {{ trans('cortex/foundation::common.created_at') }}:
12 | {{ $model->created_at->format(config('app.date_format')) }}
13 | @if($model->createdBy && request()->user()->can('update', $model->createdBy))
14 | {{ trans('cortex/foundation::common.by') }}
15 | @if(Route::has(request()->accessarea().'.cortex.auth.'.Str::plural($model->createdBy->getMorphClass()).'.edit'))
16 | {{ $model->createdBy->username }}
17 | @else
18 | {{ $model->createdBy->username }}
19 | @endif
20 | @endif
21 |
22 | @endif
23 |
24 | @if($model->created_at && $model->updated_at) | @endif
25 |
26 | @if($model->updated_at)
27 |
28 | {{ trans('cortex/foundation::common.updated_at') }}:
29 | {{ $model->updated_at->format(config('app.date_format')) }}
30 | @if($model->updatedBy && request()->user()->can('update', $model->updatedBy))
31 | {{ trans('cortex/foundation::common.by') }}
32 | @if(Route::has(request()->accessarea().'.cortex.auth.'.Str::plural($model->updatedBy->getMorphClass()).'.edit' ))
33 | {{ $model->updatedBy->username }}
34 | @else
35 | {{ $model->updatedBy->username }}
36 | @endif
37 | @endif
38 |
39 | @endif
40 | @endif
41 |
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Cortex Tenants
2 |
3 | **Cortex Tenants** is a frontend layer for the contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.
4 |
5 | [](https://packagist.org/packages/cortex/tenants)
6 | [](https://scrutinizer-ci.com/g/rinvex/cortex-tenants/)
7 | [](https://travis-ci.org/rinvex/cortex-tenants)
8 | [](https://styleci.io/repos/89985515)
9 | [](https://github.com/rinvex/cortex-tenants/blob/develop/LICENSE)
10 |
11 |
12 | ## Installation and Usage
13 |
14 | This is a **[Rinvex Cortex](https://github.com/rinvex/cortex)** module, that's still not yet documented, but you can use it on your own responsibility.
15 |
16 | To be documented soon..!
17 |
18 |
19 | ## Changelog
20 |
21 | Refer to the [Changelog](CHANGELOG.md) for a full history of the project.
22 |
23 |
24 | ## Support
25 |
26 | The following support channels are available at your fingertips:
27 |
28 | - [Chat on Slack](https://bit.ly/rinvex-slack)
29 | - [Help on Email](mailto:help@rinvex.com)
30 | - [Follow on Twitter](https://twitter.com/rinvex)
31 |
32 |
33 | ## Contributing & Protocols
34 |
35 | Thank you for considering contributing to this project! The contribution guide can be found in [CONTRIBUTING.md](CONTRIBUTING.md).
36 |
37 | Bug reports, feature requests, and pull requests are very welcome.
38 |
39 | - [Versioning](CONTRIBUTING.md#versioning)
40 | - [Pull Requests](CONTRIBUTING.md#pull-requests)
41 | - [Coding Standards](CONTRIBUTING.md#coding-standards)
42 | - [Feature Requests](CONTRIBUTING.md#feature-requests)
43 | - [Git Flow](CONTRIBUTING.md#git-flow)
44 |
45 |
46 | ## Security Vulnerabilities
47 |
48 | If you discover a security vulnerability within this project, please send an e-mail to [security@rinvex.com](security@rinvex.com). All security vulnerabilities will be promptly addressed.
49 |
50 |
51 | ## About Rinvex
52 |
53 | Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
54 |
55 |
56 | ## License
57 |
58 | This software is released under [The MIT License (MIT)](LICENSE).
59 |
60 | (c) 2016-2022 Rinvex LLC, Some rights reserved.
61 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of experience,
9 | nationality, personal appearance, race, religion, or sexual identity and
10 | orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at [help@rinvex.com](mailto:help@rinvex.com). All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at [http://contributor-covenant.org/version/1/4][version]
72 |
73 | [homepage]: http://contributor-covenant.org
74 | [version]: http://contributor-covenant.org/version/1/4/
75 |
--------------------------------------------------------------------------------
/src/DataTables/Adminarea/TenantsDataTable.php:
--------------------------------------------------------------------------------
1 | query())
33 | ->setTransformer(app($this->transformer))
34 | ->filterColumn('country_code', function (Builder $builder, $keyword) {
35 | $countryCode = collect(countries())->search(function ($country) use ($keyword) {
36 | return mb_strpos($country['name'], $keyword) !== false || mb_strpos($country['emoji'], $keyword) !== false;
37 | });
38 |
39 | ! $countryCode || $builder->where('country_code', $countryCode);
40 | })
41 | ->filterColumn('language_code', function (Builder $builder, $keyword) {
42 | $languageCode = collect(languages())->search(function ($language) use ($keyword) {
43 | return mb_strpos($language['name'], $keyword) !== false;
44 | });
45 |
46 | ! $languageCode || $builder->where('language_code', $languageCode);
47 | })
48 | ->orderColumn('name', 'name->"$.'.app()->getLocale().'" $1')
49 | ->whitelist(array_keys($this->getColumns()))
50 | ->make(true);
51 | }
52 |
53 | /**
54 | * Get columns.
55 | *
56 | * @return array
57 | */
58 | protected function getColumns(): array
59 | {
60 | $link = config('cortex.foundation.route.locale_prefix')
61 | ? '"request()->segment(1).'\'})+"\">"+data+" "'
62 | : '""+data+" "';
63 |
64 | return [
65 | 'id' => ['checkboxes' => json_decode('{"selectRow": true}'), 'exportable' => false, 'printable' => false],
66 | 'name' => ['title' => trans('cortex/tenants::common.name'), 'render' => $link.'+(full.is_active ? " " : " ")', 'responsivePriority' => 0],
67 | 'email' => ['title' => trans('cortex/tenants::common.email')],
68 | 'phone' => ['title' => trans('cortex/tenants::common.phone')],
69 | 'country_code' => ['title' => trans('cortex/tenants::common.country'), 'render' => 'full.country_emoji+" "+data'],
70 | 'language_code' => ['title' => trans('cortex/tenants::common.language')],
71 | 'created_at' => ['title' => trans('cortex/tenants::common.created_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
72 | 'updated_at' => ['title' => trans('cortex/tenants::common.updated_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
73 | ];
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Adminarea/TenantsMediaController.php:
--------------------------------------------------------------------------------
1 | mapResourceAbilities() as $method => $ability) {
30 | $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter;
31 |
32 | $middleware["can:update,{$modelName}"][] = $method;
33 | $middleware["can:{$ability},media"][] = $method;
34 | }
35 |
36 | foreach ($middleware as $middlewareName => $methods) {
37 | $this->middleware($middlewareName, $options)->only($methods);
38 | }
39 | }
40 |
41 | /**
42 | * List tenant media.
43 | *
44 | * @param \Cortex\Tenants\Models\Tenant $tenant
45 | * @param \Cortex\Foundation\DataTables\MediaDataTable $mediaDataTable
46 | *
47 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
48 | */
49 | public function index(Tenant $tenant, MediaDataTable $mediaDataTable)
50 | {
51 | return $mediaDataTable->with([
52 | 'resource' => $tenant,
53 | 'tabs' => 'adminarea.cortex.tenants.tenants.tabs',
54 | 'id' => "adminarea-cortex-tenants-tenants-{$tenant->getRouteKey()}-media",
55 | 'url' => route('adminarea.cortex.tenants.tenants.media.store', ['tenant' => $tenant]),
56 | ])->render('cortex/foundation::adminarea.pages.datatable-dropzone');
57 | }
58 |
59 | /**
60 | * Store new tenant media.
61 | *
62 | * @param \Cortex\Foundation\Http\Requests\ImageFormRequest $request
63 | * @param \Cortex\Tenants\Models\Tenant $tenant
64 | *
65 | * @return void
66 | */
67 | public function store(ImageFormRequest $request, Tenant $tenant): void
68 | {
69 | $tenant->addMediaFromRequest('file')
70 | ->sanitizingFileName(function ($fileName) {
71 | return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
72 | })
73 | ->toMediaCollection('default', config('cortex.tenants.media.disk'));
74 | }
75 |
76 | /**
77 | * Destroy given tenant media.
78 | *
79 | * @param \Cortex\Tenants\Models\Tenant $tenant
80 | * @param \Cortex\Foundation\Models\Media $media
81 | *
82 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
83 | */
84 | public function destroy(Tenant $tenant, Media $media)
85 | {
86 | $tenant->media()->where($media->getKeyName(), $media->getKey())->first()->delete();
87 |
88 | return intend([
89 | 'url' => route('adminarea.cortex.tenants.tenants.media.index', ['tenant' => $tenant]),
90 | 'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/foundation::common.media'), 'identifier' => $media->getRouteKey()])],
91 | ]);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Managerarea/TenantsController.php:
--------------------------------------------------------------------------------
1 | form($request, $tenant);
31 | }
32 |
33 | /**
34 | * Show tenant edit form.
35 | *
36 | * @param \Illuminate\Http\Request $request
37 | * @param \Cortex\Tenants\Models\Tenant $tenant
38 | *
39 | * @return \Illuminate\View\View
40 | */
41 | protected function form(Request $request, Tenant $tenant)
42 | {
43 | if (! $tenant->exists && $request->has('replicate') && $replicated = $tenant->resolveRouteBinding($request->input('replicate'))) {
44 | $tenant = $replicated->replicate();
45 | }
46 |
47 | $countries = collect(countries())->map(function ($country, $code) {
48 | return [
49 | 'id' => $code,
50 | 'text' => $country['name'],
51 | 'emoji' => $country['emoji'],
52 | ];
53 | })->values();
54 |
55 | $tags = app('rinvex.tags.tag')->pluck('name', 'id');
56 | $languages = collect(languages())->pluck('name', 'iso_639_1');
57 |
58 | return view('cortex/tenants::managerarea.pages.tenant', compact('tenant', 'countries', 'languages', 'tags'));
59 | }
60 |
61 | /**
62 | * Update given tenant.
63 | *
64 | * @param \Cortex\Tenants\Http\Requests\Managerarea\TenantFormRequest $request
65 | *
66 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
67 | */
68 | public function update(TenantFormRequest $request)
69 | {
70 | $tenant = app('request.tenant');
71 |
72 | return $this->process($request, $tenant);
73 | }
74 |
75 | /**
76 | * Process stored/updated tenant.
77 | *
78 | * @param \Illuminate\Http\Request $request
79 | * @param \Cortex\Tenants\Models\Tenant $tenant
80 | *
81 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
82 | */
83 | protected function process(Request $request, Tenant $tenant)
84 | {
85 | // Prepare required input fields
86 | $data = $request->validated();
87 |
88 | ! $request->hasFile('profile_picture')
89 | || $tenant->addMediaFromRequest('profile_picture')
90 | ->sanitizingFileName(function ($fileName) {
91 | return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
92 | })
93 | ->toMediaCollection('profile_picture', config('cortex.auth.media.disk'));
94 |
95 | ! $request->hasFile('cover_photo')
96 | || $tenant->addMediaFromRequest('cover_photo')
97 | ->sanitizingFileName(function ($fileName) {
98 | return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
99 | })
100 | ->toMediaCollection('cover_photo', config('cortex.auth.media.disk'));
101 |
102 | // Save tenant
103 | $tenant->fill($data)->save();
104 |
105 | return intend([
106 | 'back' => true,
107 | 'with' => ['success' => trans('cortex/foundation::messages.resource_saved', ['resource' => trans('cortex/tenants::common.tenant'), 'identifier' => $tenant->getRouteKey()])],
108 | ]);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cortex/tenants",
3 | "description": "Cortex Tenants is a frontend layer for the contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.",
4 | "type": "cortex-module",
5 | "keywords": [
6 | "model",
7 | "tenant",
8 | "laravel",
9 | "eloquent",
10 | "tenantable",
11 | "translatable",
12 | "polymorphic",
13 | "sluggable",
14 | "tenancy",
15 | "rinvex",
16 | "multi"
17 | ],
18 | "license": "MIT",
19 | "homepage": "https://rinvex.com",
20 | "support": {
21 | "email": "help@rinvex.com",
22 | "issues": "https://github.com/rinvex/cortex-tenants/issues",
23 | "source": "https://github.com/rinvex/cortex-tenants",
24 | "docs": "https://github.com/rinvex/cortex-tenants/README.md"
25 | },
26 | "authors": [
27 | {
28 | "name": "Rinvex LLC",
29 | "homepage": "https://rinvex.com",
30 | "email": "help@rinvex.com"
31 | },
32 | {
33 | "name": "Abdelrahman Omran",
34 | "homepage": "https://omranic.com",
35 | "email": "me@omranic.com",
36 | "role": "Project Lead"
37 | },
38 | {
39 | "name": "The Generous Laravel Community",
40 | "homepage": "https://github.com/rinvex/cortex-tenants/contributors"
41 | }
42 | ],
43 | "require": {
44 | "php": "^8.1.0",
45 | "illuminate/broadcasting": "^10.0.0 || ^11.0.0",
46 | "illuminate/console": "^10.0.0 || ^11.0.0",
47 | "illuminate/contracts": "^10.0.0 || ^11.0.0",
48 | "illuminate/database": "^10.0.0 || ^11.0.0",
49 | "illuminate/http": "^10.0.0 || ^11.0.0",
50 | "illuminate/queue": "^10.0.0 || ^11.0.0",
51 | "illuminate/routing": "^10.0.0 || ^11.0.0",
52 | "illuminate/support": "^10.0.0 || ^11.0.0",
53 | "cortex/auth": "^9.0.0",
54 | "cortex/foundation": "^8.0.0",
55 | "diglactic/laravel-breadcrumbs": "^8.0.0",
56 | "laravelcollective/html": "^6.3.0",
57 | "league/fractal": "^0.20.0",
58 | "proengsoft/laravel-jsvalidation": "^4.8.0",
59 | "propaganistas/laravel-phone": "^5.0.0",
60 | "rinvex/laravel-composer": "^7.0.0",
61 | "rinvex/countries": "^9.0.0",
62 | "rinvex/languages": "^7.0.0",
63 | "rinvex/laravel-tags": "^7.0.0",
64 | "rinvex/laravel-menus": "^7.0.0",
65 | "rinvex/laravel-support": "^7.0.0",
66 | "rinvex/laravel-tenants": "^8.0.0",
67 | "spatie/laravel-activitylog": "^4.7.0",
68 | "spatie/laravel-medialibrary": "^10.0.0",
69 | "spatie/laravel-schemaless-attributes": "^2.4.0",
70 | "yajra/laravel-datatables-buttons": "^10.0.0",
71 | "yajra/laravel-datatables-fractal": "^10.0.0",
72 | "yajra/laravel-datatables-html": "^10.0.0",
73 | "yajra/laravel-datatables-oracle": "^10.4.0",
74 | "symfony/console": "^6.2.0"
75 | },
76 | "require-dev": {
77 | "codedungeon/phpunit-result-printer": "^0.32.0",
78 | "phpunit/phpunit": "^10.1.0"
79 | },
80 | "autoload": {
81 | "psr-4": {
82 | "Cortex\\Tenants\\": "src/",
83 | "Cortex\\Tenants\\Database\\Factories\\": "database/factories/",
84 | "Cortex\\Tenants\\Database\\Seeders\\": "database/seeders/"
85 | }
86 | },
87 | "autoload-dev": {
88 | "psr-4": {
89 | "Cortex\\Tenants\\Tests\\": "tests"
90 | }
91 | },
92 | "scripts": {
93 | "test": "vendor/bin/phpunit"
94 | },
95 | "config": {
96 | "sort-packages": true,
97 | "preferred-install": "dist",
98 | "optimize-autoloader": true
99 | },
100 | "extra": {
101 | "laravel": {
102 | "providers": [
103 | "Cortex\\Tenants\\Providers\\TenantsServiceProvider"
104 | ]
105 | }
106 | },
107 | "minimum-stability": "dev",
108 | "prefer-stable": true
109 | }
110 |
--------------------------------------------------------------------------------
/resources/sass/theme-tenantarea.scss:
--------------------------------------------------------------------------------
1 | @import '~admin-lte/dist/css/AdminLTE';
2 |
3 | html {
4 | position: relative;
5 | min-height: 100%;
6 | }
7 |
8 | body {
9 | background-color: #f2f2f2;
10 | font-family: 'Lato';
11 | font-weight: 300;
12 | font-size: 16px;
13 | color: #555;
14 |
15 | -webkit-font-smoothing: antialiased;
16 | -webkit-overflow-scrolling: touch;
17 | }
18 |
19 | /* Titles */
20 | h1,
21 | h2,
22 | h3,
23 | h4,
24 | h5,
25 | h6 {
26 | font-family: 'Raleway';
27 | font-weight: 300;
28 | color: #333;
29 | }
30 |
31 | /* Paragraph & Typographic */
32 | p {
33 | line-height: 28px;
34 | margin-bottom: 25px;
35 | }
36 |
37 | .centered {
38 | text-align: center;
39 | }
40 |
41 | /* Links */
42 | a {
43 | color: #3bc492;
44 | word-wrap: break-word;
45 |
46 | -webkit-transition: color 0.1s ease-in, background 0.1s ease-in;
47 | -moz-transition: color 0.1s ease-in, background 0.1s ease-in;
48 | -ms-transition: color 0.1s ease-in, background 0.1s ease-in;
49 | -o-transition: color 0.1s ease-in, background 0.1s ease-in;
50 | transition: color 0.1s ease-in, background 0.1s ease-in;
51 | }
52 |
53 | a:hover,
54 | a:focus {
55 | color: #c0392b;
56 | text-decoration: none;
57 | outline: 0;
58 | }
59 |
60 | a:before,
61 | a:after {
62 | -webkit-transition: color 0.1s ease-in, background 0.1s ease-in;
63 | -moz-transition: color 0.1s ease-in, background 0.1s ease-in;
64 | -ms-transition: color 0.1s ease-in, background 0.1s ease-in;
65 | -o-transition: color 0.1s ease-in, background 0.1s ease-in;
66 | transition: color 0.1s ease-in, background 0.1s ease-in;
67 | }
68 |
69 | hr {
70 | display: block;
71 | height: 1px;
72 | border: 0;
73 | border-top: 1px solid #ccc;
74 | margin: 1em 0;
75 | padding: 0;
76 | }
77 |
78 | /* ==========================================================================
79 | Wrap Sections
80 | ========================================================================== */
81 |
82 | #headerwrap {
83 | background-color: #34495e;
84 | padding-top: 60px;
85 | }
86 |
87 | #headerwrap h1 {
88 | margin-top: 30px;
89 | color: white;
90 | font-size: 70px;
91 | }
92 |
93 | #headerwrap h3 {
94 | color: white;
95 | font-size: 30px;
96 | }
97 |
98 | #headerwrap h5 {
99 | color: white;
100 | font-weight: 700;
101 | text-align: left;
102 | }
103 |
104 | #headerwrap p {
105 | text-align: left;
106 | color: white;
107 | }
108 |
109 | /* intro Wrap */
110 | #intro {
111 | padding-top: 50px;
112 | border-top: #bdc3c7 solid 5px;
113 | }
114 |
115 | #features {
116 | padding-top: 50px;
117 | padding-bottom: 50px;
118 | }
119 |
120 | #features a[data-toggle='collapse'] {
121 | font-size: 20px;
122 | }
123 |
124 | #footerwrap {
125 | background-color: #2f2f2f;
126 | color: white;
127 | padding-top: 40px;
128 | padding-bottom: 80px;
129 | text-align: left;
130 | }
131 |
132 | #footerwrap h3 {
133 | font-size: 28px;
134 | color: white;
135 | }
136 |
137 | #footerwrap p {
138 | color: white;
139 | font-size: 18px;
140 | }
141 |
142 | /* Copyright Wrap */
143 | #copyright {
144 | bottom: 0;
145 | width: 100%;
146 | position: absolute;
147 | background: #222222;
148 | padding-top: 15px;
149 | text-align: right;
150 | }
151 |
152 | #copyright p {
153 | color: white;
154 | }
155 |
156 | .auth-page {
157 | background-color: #34495e;
158 | }
159 |
160 | .auth-form {
161 | margin-top: 25vh;
162 | margin-bottom: 25vh;
163 | }
164 |
165 | *[role='auth'] {
166 | color: #5d5d5d;
167 | background: #f2f2f2;
168 | padding: 23px;
169 | border-radius: 10px;
170 | -moz-border-radius: 10px;
171 | -webkit-border-radius: 10px;
172 | }
173 |
174 | *[role='auth'] input,
175 | *[role='auth'] button {
176 | margin: 16px 0;
177 | }
178 |
179 | *[role='auth'] label {
180 | margin: 16px 0 0 0;
181 | }
182 |
183 | *[role='auth'] > div {
184 | text-align: center;
185 | }
186 |
187 | .navbar-right {
188 | margin-right: 0;
189 | }
190 |
191 | /* Wizard */
192 | .wizard {
193 | border: 1px solid #eaefe9;
194 | font-size: 14px;
195 | margin-top: 10px;
196 | }
197 |
198 | .wizard .panel {
199 | margin-bottom: 0;
200 | }
201 |
202 | .wizard-step {
203 | border-top: 1px solid #f2f2f2;
204 | color: #666;
205 | font-size: 14px;
206 | padding-left: 15px;
207 | padding-right: 15px;
208 | }
209 |
210 | .wizard-step-number {
211 | border-radius: 50%;
212 | border: 1px solid #666;
213 | display: inline-block;
214 | font-size: 12px;
215 | height: 32px;
216 | margin-right: 26px;
217 | padding: 6px;
218 | text-align: center;
219 | width: 32px;
220 | }
221 |
222 | .wizard-step-title {
223 | padding: 10px;
224 | font-size: 18px;
225 | font-weight: 500;
226 | vertical-align: middle;
227 | display: inline-block;
228 | }
229 |
230 | /* Profile container */
231 | .profile {
232 | margin-top: 81px;
233 | margin-bottom: 98px;
234 | }
235 |
--------------------------------------------------------------------------------
/resources/views/managerarea/partials/meta.blade.php:
--------------------------------------------------------------------------------
1 | {{-- CSRF Token --}}
2 |
3 |
4 | {{-- Basic Meta --}}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | {{-- Vendor Meta --}}
31 |
32 |
33 |
34 |
35 |
36 | {{-- Favicon --}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | {{-- Open Graph --}}
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | {{-- Twitter Card --}}
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/partials/meta.blade.php:
--------------------------------------------------------------------------------
1 | {{-- CSRF Token --}}
2 |
3 |
4 | {{-- Basic Meta --}}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | {{-- Vendor Meta --}}
31 |
32 |
33 |
34 |
35 |
36 | {{-- Favicon --}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | {{-- Open Graph --}}
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | {{-- Twitter Card --}}
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/src/Models/Tenant.php:
--------------------------------------------------------------------------------
1 | TenantCreated::class,
95 | 'updated' => TenantUpdated::class,
96 | 'deleted' => TenantDeleted::class,
97 | 'restored' => TenantRestored::class,
98 | ];
99 |
100 | /**
101 | * Create a new Eloquent model instance.
102 | *
103 | * @param array $attributes
104 | */
105 | public function __construct(array $attributes = [])
106 | {
107 | $this->mergeFillable(['social', 'style']);
108 |
109 | $this->mergeCasts(['social' => SchemalessAttributes::class, 'style' => 'string']);
110 |
111 | $this->mergeRules([
112 | 'social' => 'nullable', 'style' => 'nullable|string|strip_tags|max:150', 'tags' => 'nullable|array',
113 | 'email' => ['required', ...config('validation.rules.email'), 'unique:'.config('rinvex.tenants.models.tenant').',email'],
114 | ]);
115 |
116 | parent::__construct($attributes);
117 | }
118 |
119 | /**
120 | * Set sensible Activity Log Options.
121 | *
122 | * @return \Spatie\Activitylog\LogOptions
123 | */
124 | public function getActivitylogOptions(): LogOptions
125 | {
126 | return LogOptions::defaults()
127 | ->logFillable()
128 | ->logOnlyDirty()
129 | ->dontSubmitEmptyLogs();
130 | }
131 |
132 | /**
133 | * Scope with social schemaless attributes.
134 | *
135 | * @return \Illuminate\Database\Eloquent\Builder
136 | */
137 | public function scopeWithSocial(): Builder
138 | {
139 | return $this->social->modelCast();
140 | }
141 |
142 | /**
143 | * Register media collections.
144 | *
145 | * @return void
146 | */
147 | public function registerMediaCollections(): void
148 | {
149 | $this->addMediaCollection('profile_picture')->singleFile();
150 | $this->addMediaCollection('cover_photo')->singleFile();
151 | }
152 |
153 | /**
154 | * Get all attached managers to tenant.
155 | *
156 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
157 | */
158 | public function managers(): MorphToMany
159 | {
160 | return $this->entries(config('cortex.auth.models.manager'));
161 | }
162 |
163 | /**
164 | * Get the route key for the model.
165 | *
166 | * @return string
167 | */
168 | public function getRouteKeyName()
169 | {
170 | return 'slug';
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/src/Http/Controllers/Adminarea/TenantsController.php:
--------------------------------------------------------------------------------
1 | with([
34 | 'id' => 'adminarea-cortex-tenants-tenants-index',
35 | 'routePrefix' => 'adminarea.cortex.tenants.tenants',
36 | 'pusher' => ['entity' => 'tenant', 'channel' => 'cortex.tenants.tenants.index'],
37 | ])->render('cortex/foundation::adminarea.pages.datatable-index');
38 | }
39 |
40 | /**
41 | * List tenant logs.
42 | *
43 | * @param \Cortex\Tenants\Models\Tenant $tenant
44 | * @param \Cortex\Foundation\DataTables\LogsDataTable $logsDataTable
45 | *
46 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
47 | */
48 | public function logs(Tenant $tenant, LogsDataTable $logsDataTable)
49 | {
50 | return $logsDataTable->with([
51 | 'resource' => $tenant,
52 | 'tabs' => 'adminarea.cortex.tenants.tenants.tabs',
53 | 'id' => "adminarea-cortex-tenants-tenants-{$tenant->getRouteKey()}-logs",
54 | ])->render('cortex/foundation::adminarea.pages.datatable-tab');
55 | }
56 |
57 | /**
58 | * Import pages.
59 | *
60 | * @param \Cortex\Foundation\Http\Requests\ImportFormRequest $request
61 | * @param \Cortex\Foundation\Importers\InsertImporter $importer
62 | * @param \Cortex\Tenants\Models\Tenant $tenant
63 | *
64 | * @return void
65 | */
66 | public function import(ImportFormRequest $request, InsertImporter $importer, Tenant $tenant)
67 | {
68 | $importer->withModel($tenant)->import($request->file('file'));
69 | }
70 |
71 | /**
72 | * Create new tenant.
73 | *
74 | * @param \Illuminate\Http\Request $request
75 | * @param \Cortex\Tenants\Models\Tenant $tenant
76 | *
77 | * @return \Illuminate\View\View
78 | */
79 | public function create(Request $request, Tenant $tenant)
80 | {
81 | return $this->form($request, $tenant);
82 | }
83 |
84 | /**
85 | * Edit given tenant.
86 | *
87 | * @param \Illuminate\Http\Request $request
88 | * @param \Cortex\Tenants\Models\Tenant $tenant
89 | *
90 | * @return \Illuminate\View\View
91 | */
92 | public function edit(Request $request, Tenant $tenant)
93 | {
94 | return $this->form($request, $tenant);
95 | }
96 |
97 | /**
98 | * Show tenant create/edit form.
99 | *
100 | * @param \Illuminate\Http\Request $request
101 | * @param \Cortex\Tenants\Models\Tenant $tenant
102 | *
103 | * @return \Illuminate\View\View
104 | */
105 | protected function form(Request $request, Tenant $tenant)
106 | {
107 | if (! $tenant->exists && $request->has('replicate') && $replicated = $tenant->resolveRouteBinding($request->input('replicate'))) {
108 | $tenant = $replicated->replicate();
109 | }
110 |
111 | $countries = collect(countries())->map(function ($country, $code) {
112 | return [
113 | 'id' => $code,
114 | 'text' => $country['name'],
115 | 'emoji' => $country['emoji'],
116 | ];
117 | })->values();
118 |
119 | $tags = app('rinvex.tags.tag')->pluck('name', 'id');
120 | $languages = collect(languages())->pluck('name', 'iso_639_1');
121 |
122 | return view('cortex/tenants::adminarea.pages.tenant', compact('tenant', 'countries', 'languages', 'tags'));
123 | }
124 |
125 | /**
126 | * Store new tenant.
127 | *
128 | * @param \Cortex\Tenants\Http\Requests\Adminarea\TenantFormRequest $request
129 | * @param \Cortex\Tenants\Models\Tenant $tenant
130 | *
131 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
132 | */
133 | public function store(TenantFormRequest $request, Tenant $tenant)
134 | {
135 | return $this->process($request, $tenant);
136 | }
137 |
138 | /**
139 | * Update given tenant.
140 | *
141 | * @param \Cortex\Tenants\Http\Requests\Adminarea\TenantFormRequest $request
142 | * @param \Cortex\Tenants\Models\Tenant $tenant
143 | *
144 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
145 | */
146 | public function update(TenantFormRequest $request, Tenant $tenant)
147 | {
148 | return $this->process($request, $tenant);
149 | }
150 |
151 | /**
152 | * Process stored/updated tenant.
153 | *
154 | * @param \Cortex\Foundation\Http\FormRequest $request
155 | * @param \Cortex\Tenants\Models\Tenant $tenant
156 | *
157 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
158 | */
159 | protected function process(FormRequest $request, Tenant $tenant)
160 | {
161 | // Prepare required input fields
162 | $data = $request->validated();
163 |
164 | ! $request->hasFile('profile_picture')
165 | || $tenant->addMediaFromRequest('profile_picture')
166 | ->sanitizingFileName(function ($fileName) {
167 | return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
168 | })
169 | ->toMediaCollection('profile_picture', config('cortex.foundation.media.disk'));
170 |
171 | ! $request->hasFile('cover_photo')
172 | || $tenant->addMediaFromRequest('cover_photo')
173 | ->sanitizingFileName(function ($fileName) {
174 | return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
175 | })
176 | ->toMediaCollection('cover_photo', config('cortex.foundation.media.disk'));
177 |
178 | // Save tenant
179 | $tenant->fill($data)->save();
180 |
181 | return intend([
182 | 'url' => route('adminarea.cortex.tenants.tenants.index'),
183 | 'with' => ['success' => trans('cortex/foundation::messages.resource_saved', ['resource' => trans('cortex/tenants::common.tenant'), 'identifier' => $tenant->name])],
184 | ]);
185 | }
186 |
187 | /**
188 | * Destroy given tenant.
189 | *
190 | * @param \Cortex\Tenants\Models\Tenant $tenant
191 | *
192 | * @throws \Exception
193 | *
194 | * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
195 | */
196 | public function destroy(Tenant $tenant)
197 | {
198 | $tenant->delete();
199 |
200 | return intend([
201 | 'url' => route('adminarea.cortex.tenants.tenants.index'),
202 | 'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/tenants::common.tenant'), 'identifier' => $tenant->name])],
203 | ]);
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/resources/views/tenantarea/pages/index.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::tenantarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | @section('body-attributes')data-spy="scroll" data-offset="0" data-target="#navigation"@endsection
10 |
11 | @section('meta-title', app('request.tenant')->name)
12 | @section('meta-description', strip_tags(app('request.tenant')->description))
13 |
14 | @if(app('request.tenant')->getFirstMediaUrl('cover_photo'))
15 | @section('meta-image', app('request.tenant')->getFirstMediaUrl('cover_photo'))
16 | @endif
17 |
18 |
19 | {{-- Main Content --}}
20 | @section('content')
21 |
22 |
23 |
49 |
50 |
51 |
52 |
53 |
54 |
Designed To Excel
55 |
56 |
57 |
58 |
59 |
Community
60 |
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
61 |
62 |
63 |
64 |
Schedule
65 |
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
66 |
67 |
68 |
69 |
Monitoring
70 |
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
What's New?
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
Some Features
91 |
92 |
93 |
94 |
99 |
100 |
101 |
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
102 |
103 |
104 |
105 |
106 |
107 |
108 |
113 |
114 |
115 |
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
127 |
128 |
129 |
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
130 |
131 |
132 |
133 |
134 |
135 |
136 |
141 |
142 |
143 |
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
190 |
191 | @endsection
192 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Cortex Tenants Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | This project adheres to [Semantic Versioning](CONTRIBUTING.md).
6 |
7 |
8 | ## [v8.3.2] - 2024-07-22
9 | - add blades for 405 error (#193)
10 | - fix cover photo name (#194)
11 |
12 | ## [v8.3.1] - 2023-08-17
13 | - Seed the new 'view' ability
14 | - Override email validation rule to follow the new configuration option
15 |
16 | ## [v8.3.0] - 2023-07-12
17 | - Drop using turbolinks
18 | - Drop using Livewire
19 |
20 | ## [v8.2.2] - 2023-07-03
21 | - Update composer dependencies
22 |
23 | ## [v8.2.1] - 2023-07-03
24 | - Fix migration paths
25 |
26 | ## [v8.2.0] - 2023-06-23
27 | - Fix cortex/auth::common.timezone language phrase namespace
28 | - Apply fixes from StyleCI (#188)
29 | - Move tenant features to cortex/tenants module from cortex/foundation
30 | - Improve eloquent models IoC container binding
31 | - Decoupling: Move global helpers, route patterns and middleware to cortex/foundation module
32 | - Fix changelog format
33 |
34 | ## [v8.1.0] - 2023-05-02
35 | - Add support for Laravel v11, and drop support for Laravel v9
36 | - Upgrade yajra/laravel-datatables-oracle to v10.4 from v10.0
37 | - Upgrade yajra/laravel-datatables-html to v10.0 from v9.0
38 | - Upgrade yajra/laravel-datatables-buttons to v10.0 from v9.0
39 | - Upgrade spatie/laravel-schemaless-attributes to v2.4 from v2.3
40 | - Upgrade spatie/laravel-activitylog to v4.7 from v4.4
41 | - Upgrade proengsoft/laravel-jsvalidation to v4.8 from v4.7
42 | - Update yajra/laravel-datatables-fractal to v10.0 from v9.0
43 | - Update propaganistas/laravel-phone to v5.0 from v4.4
44 | - Update phpunit to v10.1 from v9.5
45 | - fix edit tenant breadcrumbs (#160)
46 |
47 | ## [v8.0.0] - 2023-01-09
48 | - Drop PHP v8.0 support and update composer dependencies
49 | - Move Relation::morphMap to vendor core package
50 | - Utilize PHP 8.1 attributes feature for artisan commands
51 |
52 | ## [v7.2.7] - 2022-12-30
53 | - Whitelist datatable columns to avoid invalid columns sent from client-side which might be a security issue in some scenarios
54 | - Isolate login between all domains & subdomains by default and support tenant domains
55 | - exclude tenant domain if empty (#157)
56 |
57 | ## [v7.2.6] - 2022-08-30
58 | - Clean the breadcrumbs definition and utilize parent features
59 |
60 | ## [v7.2.5] - 2022-07-24
61 | - Fix datatables checkbox select-row options
62 | - Fix audit ability check for import logs
63 | - Add missing export ability
64 |
65 | ## [v7.2.4] - 2022-06-22
66 | - Fix datatables ajax method signature
67 |
68 | ## [v7.2.3] - 2022-06-20
69 | - Update composer dependencies
70 | - league/fractal to ^0.20.0 from ^0.19.0
71 | - yajra/laravel-datatables-html to ^9.0.0 from ^4.41.0
72 | - yajra/laravel-datatables-fractal to ^9.0.0 from ^1.6.0
73 | - yajra/laravel-datatables-buttons to ^9.0.0 from ^4.13.0
74 | - yajra/laravel-datatables-oracle to ^10.0.0 from ^9.19.0
75 |
76 | ## [v7.2.2] - 2022-05-17
77 | - Add support for menu list item attributes
78 | - Fix correct naming for daterangepicker from datepicker
79 | - Override Spatie Media model to support Hashids
80 | - fix edit tenants routes (#155)
81 |
82 | ## [v7.2.1] - 2022-03-12
83 | - Add global helper to get default_route_domains
84 | - Cache route_domains results to avoid many useless calls
85 | - WIP Refactor & Simplify datatables import functionality
86 | - Update composer dependency codedungeon/phpunit-result-printer
87 | - Enforce form actions routePrefix consistency
88 | - Add datatables routePrefix support
89 |
90 | ## [v7.2.0] - 2022-02-14
91 | - Update composer dependencies to Laravel v9
92 | - Use PHP v8 nullsafe operator
93 | - Move Relation::morphMap to module bootstrap
94 | - Fix broadcasts naming convensions
95 | - Update routes to use class based definitions
96 |
97 | ## [v7.1.4] - 2022-01-02
98 | - Update absentarea route domain pattern
99 | - Add support for centralarea & absentarea
100 | - Remove useless complex string variable from the regex
101 |
102 | ## [v7.1.3] - 2021-10-25
103 | - Escape Regex characters in domain names for route patterns
104 |
105 | ## [v7.1.2] - 2021-10-22
106 | - Refactor route domain variables to be accessarea specific
107 | - Update .styleci.yml fixers
108 |
109 | ## [v7.1.1] - 2021-10-11
110 | - Rename route parameter 'central_domain' to 'routeDomain'
111 | - Override app.url & session.domain config options
112 | - Register routeDomain pattern
113 | - Refactor global helpers route_domains & route_pattern
114 | - Rename variables for consistency
115 |
116 | ## [v7.1.0] - 2021-08-22
117 | - Drop PHP v7 support, and upgrade rinvex package dependencies to next major version
118 |
119 | ## [v7.0.2] - 2021-08-18
120 | - Update composer dependency cortex/foundation to v7
121 |
122 | ## [v7.0.1] - 2021-08-18
123 | - Update composer dependency cortex/auth to v8
124 |
125 | ## [v7.0.0] - 2021-08-18
126 | - Breaking Change: requires rinvex/laravel-tenants v7
127 | - Require rinvex/laravel-tenants v7
128 | - Add central_pattern() and tenant_pattern() global helpers
129 | - Add domain field to tenants
130 | - Move tenant retrieval and registration to rinvex/laravel-tenants responsibility
131 | - Remove useless Tenantable middleware, this is now the responsibility of rinvex/laravel-tenants
132 | - Register routes to either central or tenant domains
133 | - Move route binding, patterns, and middleware to module bootstrap
134 |
135 | ## [v6.0.17] - 2021-08-07
136 | - Upgrade spatie/laravel-activitylog to v4
137 |
138 | ## [v6.0.16] - 2021-08-06
139 | - Retrieve only active tenants
140 | - Simplify route prefixes
141 | - Fix wrong transformer PSR4 namespace
142 | - Update composer dependencies
143 |
144 | ## [v6.0.15] - 2021-05-25
145 | - Replace deprecated `Breadcrumbs::register` with `Breadcrumbs::for`
146 | - Update composer dependencies diglactic/laravel-breadcrumbs to v7
147 |
148 | ## [v6.0.14] - 2021-05-24
149 | - Fix datatables export issues
150 | - Drop common blade views in favor for accessarea specific views
151 |
152 | ## [v6.0.13] - 2021-05-11
153 | - Fix constructor initialization order (fill attributes should come next after merging fillables & rules)
154 |
155 | ## [v6.0.12] - 2021-05-07
156 | - Upgrade to GitHub-native Dependabot
157 | - Rename migrations to always run after rinvex core packages
158 |
159 | ## [v6.0.11] - 2021-05-04
160 | - Update spatie/laravel-schemaless-attributes package
161 | - Use app() method alias `has` instead of `bound` for better readability
162 |
163 | ## [v6.0.10] - 2021-03-02
164 | - Autoload artisan commands
165 |
166 | ## [v6.0.9] - 2021-02-28
167 | - Use overridden `FormRequest` instead of native class
168 | - Utilize IoC service container instead of hardcoded models for menu permissions
169 | - Use `request->input()` instead of `request->get()`
170 |
171 | ## [v6.0.8] - 2021-02-11
172 | - Replace form timestamps with common blade view
173 |
174 | ## [v6.0.7] - 2021-02-07
175 | - Replace silber/bouncer package with custom modified tmp version
176 |
177 | ## [v6.0.6] - 2021-02-06
178 | - Add support for runtime configurable model to allow model override (fix abilities/permission issues)
179 | - Skip publishing module resources unless explicitly specified, for simplicity
180 |
181 | ## [v6.0.5] - 2021-01-15
182 | - Add model replication feature
183 | - Remove duplicate `setTable` method call override as it's already called in parent class
184 |
185 | ## [v6.0.4] - 2021-01-02
186 | - Move cortex:autoload & cortex:activate commands to cortex/foundation module responsibility
187 |
188 | ## [v6.0.3] - 2021-01-01
189 | - Move cortex:autoload & cortex:activate commands to cortex/foundation module responsibility
190 | - This is because :autoload & :activate commands are registered only if the module already autoloaded, so there is no way we can execute commands of unloaded modules
191 | - cortex/foundation module is always autoloaded, so it's the logical and reasonable place to register these :autoload & :activate module commands and control other modules from outside
192 |
193 | ## [v6.0.2] - 2020-12-31
194 | - Rename seeders directory
195 | - Enable StyleCI risky mode
196 | - Add module activate, deactivate, autoload, unload artisan commands
197 |
198 | ## [v6.0.1] - 2020-12-25
199 | - Add support for PHP v8
200 |
201 | ## [v6.0.0] - 2020-12-22
202 | - Upgrade to Laravel v8
203 |
204 | ## [v5.1.4] - 2020-12-11
205 | - Move custom eloquent model events to module layer from core package layer
206 | - Rename broadcast channels file to avoid accessarea naming
207 | - Rename routes, channels, menus, breadcrumbs, datatable & form IDs to follow same modular naming conventions
208 | - Tweak datatables realtime
209 | - Move Eloquent Events to core package responsibility
210 | - Type hint Authorizable user parameter
211 | - Enforce consistent datatables request object usage
212 |
213 | ## [v5.1.3] - 2020-09-26
214 | - Fix managerarea update-tenant ability
215 |
216 | ## [v5.1.2] - 2020-09-19
217 | - Update currency field to dropdown menu
218 | - Enforce controller API consistency
219 |
220 | ## [v5.1.1] - 2020-08-25
221 | - Enforce controller API consistency
222 | - Merge pull request #107 from mohamed-hendawy/develop
223 | - apply authorization on tenant actions in managerarea
224 | - Activate module after installation
225 |
226 | ## [v5.1.0] - 2020-07-16
227 | - Utilize timezones
228 | - Use app('request.user') instead of $currentUser
229 |
230 | ## [v5.0.2] - 2020-06-21
231 | - Automatically redirect www. subdomain to homepage without error message.
232 | - Only query the tenant if we have a subdomain
233 |
234 | ## [v5.0.1] - 2020-06-20
235 | - Add macroable support for Tenant model
236 |
237 | ## [v5.0.0] - 2020-06-19
238 | - Update composer dependencies
239 | - Refactor route parameters to container service binding
240 | - Exclude www subdomain from not found thrown exception
241 | - Move active tenant activation to module bootstrapping (in service provider boot stage)
242 | - Move unbinding route parameters to UnbindRouteParameters middleware
243 | - Add missing FormRequest import
244 | - Refactor active tenant to container service binding, instead of runtime config value
245 | - Introducing module early bootstrapping feature
246 | - Stick to composer version constraints recommendations and ease minimum required version of modules
247 |
248 | ## [v4.2.0] - 2020-06-15
249 | - Autoload config, views, language, menus, breadcrumbs, and migrations
250 | - This is now done automatically through cortex/foundation, so no need to manually wire it here anymore
251 | - Merge additional fillable, casts, and rules instead of overriding
252 | - Only display tenant edit menu if manager has permission to update
253 | - Move tenant edit link to header menu
254 | - Drop PHP 7.2 & 7.3 support from travis
255 |
256 | ## [v4.1.1] - 2020-05-30
257 | - Update composer dependencies
258 |
259 | ## [v4.1.0] - 2020-05-30
260 | - With the significance of recent updates, new minor release required
261 |
262 | ## [v4.0.8] - 2020-05-30
263 | - Add datatables checkbox column for bulk actions
264 | - Use getRouteKey() attribute for all redirect identifiers
265 | - Drop useless datatable query() method override
266 | - Drop using strip_tags on redirect identifiers as they will use ->getRouteKey() which is already safe
267 | - Add support for datatable listing get and post requests
268 | - Refactor model CRUD dispatched events
269 | - Remove useless "DT_RowId" fielld from transformers
270 | - Register channel broadcasting routes
271 | - Fire custom model events from CRUD actions
272 | - Rename datatables container names
273 | - Load module routes automatically
274 | - Strip tags breadcrumbs of potential user inputs
275 | - Strip tags of language phrase parameters with potential user inputs
276 | - Escape language phrases
277 | - Update model validation rules
278 | - Add strip_tags validation rule to string fields
279 | - Remove default indent size config
280 | - Fix compatibility with recent rinvex/laravel-menus package update
281 |
282 | ## [v4.0.7] - 2020-04-12
283 | - Fix ServiceProvider registerCommands method compatibility
284 |
285 | ## [v4.0.6] - 2020-04-09
286 | - Tweak artisan command registration
287 | - Add missing config publishing command
288 | - Refactor publish command and allow multiple resource values
289 |
290 | ## [v4.0.5] - 2020-04-04
291 | - Enforce consistent artisan command tag namespacing
292 | - Enforce consistent package namespace
293 | - Drop laravel/helpers usage as it's no longer used
294 | - Upgrade silber/bouncer composer package
295 |
296 | ## [v4.0.4] - 2020-03-20
297 | - Add shortcut -f (force) for artisan publish commands
298 | - Fix migrations path condition
299 | - Convert database int fields into bigInteger
300 | - Upgrade spatie/laravel-medialibrary to v8.x
301 | - Fix couple issues and enforce consistency
302 |
303 | ## [v4.0.3] - 2020-03-16
304 | - Update proengsoft/laravel-jsvalidation composer package
305 |
306 | ## [v4.0.2] - 2020-03-15
307 | - Fix incompatible package version league/fractal
308 |
309 | ## [v4.0.1] - 2020-03-15
310 | - Fix wrong package version laravelcollective/html
311 |
312 | ## [v4.0.0] - 2020-03-15
313 | - Upgrade to Laravel v7.1.x & PHP v7.4.x
314 |
315 | ## [v3.1.2] - 2020-03-13
316 | - Tweak TravisCI config
317 | - Add migrations autoload option to the package
318 | - Tweak service provider `publishesResources` & `autoloadMigrations`
319 | - Update StyleCI config
320 | - Drop using global helpers
321 | - Check if ability exists before seeding
322 |
323 | ## [v3.1.1] - 2019-12-18
324 | - Add DT_RowId field to datatables
325 | - Fix route regex pattern to include underscores
326 | - This way it's compatible with validation rule `alpha_dash`
327 | - Fix `migrate:reset` args as it doesn't accept --step
328 |
329 | ## [v3.1.0] - 2019-11-23
330 | - Allow manager to edit his tenant details
331 |
332 | ## [v3.0.4] - 2019-10-14
333 | - Update menus & breadcrumbs event listener to accessarea.ready
334 | - Fix wrong dependencies letter case
335 |
336 | ## [v3.0.3] - 2019-10-06
337 | - Refactor menus and breadcrumb bindings to utilize event dispatcher
338 |
339 | ## [v3.0.2] - 2019-09-24
340 | - Add missing laravel/helpers composer package
341 |
342 | ## [v3.0.1] - 2019-09-23
343 | - Fix outdated package version
344 |
345 | ## [v3.0.0] - 2019-09-23
346 | - Upgrade to Laravel v6 and update dependencies
347 |
348 | ## [v2.2.5] - 2019-09-03
349 | - Skip Javascrip validation for file input fields to avoid size validation conflict with jquery.validator
350 |
351 | ## [v2.2.4] - 2019-09-03
352 | - Fix middleware injection issue with console
353 |
354 | ## [v2.2.3] - 2019-09-03
355 | - Update media config options
356 | - Use $_SERVER instead of $_ENV for PHPUnit
357 |
358 | ## [v2.2.2] - 2019-08-03
359 | - Tweak menus & breadcrumbs performance
360 |
361 | ## [v2.2.1] - 2019-08-03
362 | - Update composer dependencies
363 |
364 | ## [v2.2.0] - 2019-08-03
365 | - Upgrade composer dependencies
366 |
367 | ## [v2.1.3] - 2019-06-03
368 | - Enforce latest composer package versions
369 |
370 | ## [v2.1.2] - 2019-06-03
371 | - Update publish commands to support both packages and modules natively
372 |
373 | ## [v2.1.1] - 2019-06-02
374 | - Fix yajra/laravel-datatables-fractal and league/fractal compatibility
375 |
376 | ## [v2.1.0] - 2019-06-02
377 | - Update composer deps
378 | - Drop PHP 7.1 travis test
379 | - Refactor migrations and artisan commands, and tweak service provider publishes functionality
380 |
381 | ## [v2.0.0] - 2019-03-03
382 | - Require PHP 7.2 & Laravel 5.8
383 | - Utilize includeWhen blade directive
384 | - Refactor abilities seeding
385 | - Add files option to the form to allow file upload
386 | - Drop ownership feature of tenants
387 |
388 | ## [v1.0.2] - 2019-01-03
389 | - Rename environment variable QUEUE_DRIVER to QUEUE_CONNECTION
390 | - Fix wrong media destroy route
391 | - Add missing language phrase
392 | - Simplify and flatten create & edit form controller actions
393 | - Tweak and simplify FormRequest validations
394 | - Enable tinymce on all description and text area fields
395 |
396 | ## [v1.0.1] - 2018-12-22
397 | - Update composer dependencies
398 | - Add PHP 7.3 support to travis
399 | - Utilize @json() blade directive
400 |
401 | ## [v1.0.0] - 2018-10-01
402 | - Support Laravel v5.7, bump versions and enforce consistency
403 |
404 | ## [v0.0.2] - 2018-09-22
405 | - Too much changes to list here!!
406 |
407 | ## v0.0.1 - 2017-09-09
408 | - Tag first release
409 |
410 | [v8.3.2]: https://github.com/rinvex/cortex-tenants/compare/v8.3.1...v8.3.2
411 | [v8.3.1]: https://github.com/rinvex/cortex-tenants/compare/v8.3.0...v8.3.1
412 | [v8.3.0]: https://github.com/rinvex/cortex-tenants/compare/v8.2.2...v8.3.0
413 | [v8.2.2]: https://github.com/rinvex/cortex-tenants/compare/v8.2.1...v8.2.2
414 | [v8.2.1]: https://github.com/rinvex/cortex-tenants/compare/v8.2.0...v8.2.1
415 | [v8.2.0]: https://github.com/rinvex/cortex-tenants/compare/v8.1.0...v8.2.0
416 | [v8.1.0]: https://github.com/rinvex/cortex-tenants/compare/v8.0.0...v8.1.0
417 | [v8.0.0]: https://github.com/rinvex/cortex-tenants/compare/v7.2.7...v8.0.0
418 | [v7.2.7]: https://github.com/rinvex/cortex-tenants/compare/v7.2.6...v7.2.7
419 | [v7.2.6]: https://github.com/rinvex/cortex-tenants/compare/v7.2.5...v7.2.6
420 | [v7.2.5]: https://github.com/rinvex/cortex-tenants/compare/v7.2.4...v7.2.5
421 | [v7.2.4]: https://github.com/rinvex/cortex-tenants/compare/v7.2.3...v7.2.4
422 | [v7.2.3]: https://github.com/rinvex/cortex-tenants/compare/v7.2.2...v7.2.3
423 | [v7.2.2]: https://github.com/rinvex/cortex-tenants/compare/v7.2.1...v7.2.2
424 | [v7.2.1]: https://github.com/rinvex/cortex-tenants/compare/v7.2.0...v7.2.1
425 | [v7.2.0]: https://github.com/rinvex/cortex-tenants/compare/v7.1.4...v7.2.0
426 | [v7.1.4]: https://github.com/rinvex/cortex-tenants/compare/v7.1.3...v7.1.4
427 | [v7.1.3]: https://github.com/rinvex/cortex-tenants/compare/v7.1.2...v7.1.3
428 | [v7.1.2]: https://github.com/rinvex/cortex-tenants/compare/v7.1.1...v7.1.2
429 | [v7.1.1]: https://github.com/rinvex/cortex-tenants/compare/v7.1.0...v7.1.1
430 | [v7.1.0]: https://github.com/rinvex/cortex-tenants/compare/v7.0.2...v7.1.0
431 | [v7.0.2]: https://github.com/rinvex/cortex-tenants/compare/v7.0.1...v7.0.2
432 | [v7.0.1]: https://github.com/rinvex/cortex-tenants/compare/v7.0.0...v7.0.1
433 | [v7.0.0]: https://github.com/rinvex/cortex-tenants/compare/v6.0.17...v7.0.0
434 | [v6.0.17]: https://github.com/rinvex/cortex-tenants/compare/v6.0.16...v6.0.17
435 | [v6.0.16]: https://github.com/rinvex/cortex-tenants/compare/v6.0.15...v6.0.16
436 | [v6.0.15]: https://github.com/rinvex/cortex-tenants/compare/v6.0.14...v6.0.15
437 | [v6.0.14]: https://github.com/rinvex/cortex-tenants/compare/v6.0.13...v6.0.14
438 | [v6.0.13]: https://github.com/rinvex/cortex-tenants/compare/v6.0.12...v6.0.13
439 | [v6.0.12]: https://github.com/rinvex/cortex-tenants/compare/v6.0.11...v6.0.12
440 | [v6.0.11]: https://github.com/rinvex/cortex-tenants/compare/v6.0.10...v6.0.11
441 | [v6.0.10]: https://github.com/rinvex/cortex-tenants/compare/v6.0.9...v6.0.10
442 | [v6.0.9]: https://github.com/rinvex/cortex-tenants/compare/v6.0.8...v6.0.9
443 | [v6.0.8]: https://github.com/rinvex/cortex-tenants/compare/v6.0.7...v6.0.8
444 | [v6.0.7]: https://github.com/rinvex/cortex-tenants/compare/v6.0.6...v6.0.7
445 | [v6.0.6]: https://github.com/rinvex/cortex-tenants/compare/v6.0.5...v6.0.6
446 | [v6.0.5]: https://github.com/rinvex/cortex-tenants/compare/v6.0.4...v6.0.5
447 | [v6.0.4]: https://github.com/rinvex/cortex-tenants/compare/v6.0.3...v6.0.4
448 | [v6.0.3]: https://github.com/rinvex/cortex-tenants/compare/v6.0.2...v6.0.3
449 | [v6.0.2]: https://github.com/rinvex/cortex-tenants/compare/v6.0.1...v6.0.2
450 | [v6.0.1]: https://github.com/rinvex/cortex-tenants/compare/v6.0.0...v6.0.1
451 | [v6.0.0]: https://github.com/rinvex/cortex-tenants/compare/v5.1.4...v6.0.0
452 | [v5.1.4]: https://github.com/rinvex/cortex-tenants/compare/v5.1.3...v5.1.4
453 | [v5.1.3]: https://github.com/rinvex/cortex-tenants/compare/v5.1.2...v5.1.3
454 | [v5.1.2]: https://github.com/rinvex/cortex-tenants/compare/v5.1.1...v5.1.2
455 | [v5.1.1]: https://github.com/rinvex/cortex-tenants/compare/v5.1.0...v5.1.1
456 | [v5.1.0]: https://github.com/rinvex/cortex-tenants/compare/v5.0.2...v5.1.0
457 | [v5.0.2]: https://github.com/rinvex/cortex-tenants/compare/v5.0.1...v5.0.2
458 | [v5.0.1]: https://github.com/rinvex/cortex-tenants/compare/v5.0.0...v5.0.1
459 | [v5.0.0]: https://github.com/rinvex/cortex-tenants/compare/v4.2.0...v5.0.0
460 | [v4.2.0]: https://github.com/rinvex/cortex-tenants/compare/v4.1.1...v4.2.0
461 | [v4.1.1]: https://github.com/rinvex/cortex-tenants/compare/v4.1.0...v4.1.1
462 | [v4.1.0]: https://github.com/rinvex/cortex-tenants/compare/v4.0.8...v4.1.0
463 | [v4.0.8]: https://github.com/rinvex/cortex-tenants/compare/v4.0.7...v4.0.8
464 | [v4.0.7]: https://github.com/rinvex/cortex-tenants/compare/v4.0.6...v4.0.7
465 | [v4.0.6]: https://github.com/rinvex/cortex-tenants/compare/v4.0.5...v4.0.6
466 | [v4.0.5]: https://github.com/rinvex/cortex-tenants/compare/v4.0.4...v4.0.5
467 | [v4.0.4]: https://github.com/rinvex/cortex-tenants/compare/v4.0.3...v4.0.4
468 | [v4.0.3]: https://github.com/rinvex/cortex-tenants/compare/v4.0.2...v4.0.3
469 | [v4.0.2]: https://github.com/rinvex/cortex-tenants/compare/v4.0.1...v4.0.2
470 | [v4.0.1]: https://github.com/rinvex/cortex-tenants/compare/v4.0.0...v4.0.1
471 | [v4.0.0]: https://github.com/rinvex/cortex-tenants/compare/v3.1.2...v4.0.0
472 | [v3.1.2]: https://github.com/rinvex/cortex-tenants/compare/v3.1.1...v3.1.2
473 | [v3.1.1]: https://github.com/rinvex/cortex-tenants/compare/v3.1.0...v3.1.1
474 | [v3.1.0]: https://github.com/rinvex/cortex-tenants/compare/v3.0.4...v3.1.0
475 | [v3.0.4]: https://github.com/rinvex/cortex-tenants/compare/v3.0.3...v3.0.4
476 | [v3.0.3]: https://github.com/rinvex/cortex-tenants/compare/v3.0.2...v3.0.3
477 | [v3.0.2]: https://github.com/rinvex/cortex-tenants/compare/v3.0.1...v3.0.2
478 | [v3.0.1]: https://github.com/rinvex/cortex-tenants/compare/v3.0.0...v3.0.1
479 | [v3.0.0]: https://github.com/rinvex/cortex-tenants/compare/v2.2.5...v3.0.0
480 | [v2.2.5]: https://github.com/rinvex/cortex-tenants/compare/v2.2.4...v2.2.5
481 | [v2.2.4]: https://github.com/rinvex/cortex-tenants/compare/v2.2.3...v2.2.4
482 | [v2.2.3]: https://github.com/rinvex/cortex-tenants/compare/v2.2.2...v2.2.3
483 | [v2.2.2]: https://github.com/rinvex/cortex-tenants/compare/v2.2.1...v2.2.2
484 | [v2.2.1]: https://github.com/rinvex/cortex-tenants/compare/v2.2.0...v2.2.1
485 | [v2.2.0]: https://github.com/rinvex/cortex-tenants/compare/v2.1.2...v2.2.0
486 | [v2.1.2]: https://github.com/rinvex/cortex-tenants/compare/v2.1.1...v2.1.2
487 | [v2.1.1]: https://github.com/rinvex/cortex-tenants/compare/v2.1.0...v2.1.1
488 | [v2.1.0]: https://github.com/rinvex/cortex-tenants/compare/v2.0.0...v2.1.0
489 | [v2.0.0]: https://github.com/rinvex/cortex-tenants/compare/v1.0.2...v2.0.0
490 | [v1.0.2]: https://github.com/rinvex/cortex-tenants/compare/v1.0.1...v1.0.2
491 | [v1.0.1]: https://github.com/rinvex/cortex-tenants/compare/v1.0.0...v1.0.1
492 | [v1.0.0]: https://github.com/rinvex/cortex-tenants/compare/v0.0.2...v1.0.0
493 | [v0.0.2]: https://github.com/rinvex/cortex-tenants/compare/v0.0.1...v0.0.2
494 |
--------------------------------------------------------------------------------
/resources/views/managerarea/pages/tenant.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Master Layout --}}
2 | @extends('cortex/tenants::managerarea.layouts.default')
3 |
4 | {{-- Page Title --}}
5 | @section('title')
6 | {{ extract_title(Breadcrumbs::render()) }}
7 | @endsection
8 |
9 | @push('inline-scripts')
10 | {!! JsValidator::formRequest(Cortex\Tenants\Http\Requests\Managerarea\TenantFormRequest::class)->selector("#managerarea-cortex-tenants-tenants-create-form, #managerarea-cortex-tenants-tenants-{$tenant->getRouteKey()}-update-form")->ignore('.skip-validation') !!}
11 |
12 |
16 | @endpush
17 |
18 | {{-- Main Content --}}
19 | @section('content')
20 |
21 | @includeWhen($tenant->exists, 'cortex/tenants::managerarea.partials.modal', ['id' => 'delete-confirmation'])
22 |
23 |
24 |
27 |
28 | {{-- Main content --}}
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{ Form::model($tenant, ['url' => route('managerarea.cortex.tenants.tenants.update', ['tenant' => $tenant]), 'method' => 'put', 'id' => "managerarea-cortex-tenants-tenants-{$tenant->getRouteKey()}-update-form", 'files' => true]) }}
36 |
37 |
38 |
39 | {{-- Name --}}
40 |
41 | {{ Form::label('name', trans('cortex/tenants::common.name'), ['class' => 'control-label']) }}
42 | {{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.name'), 'data-slugify' => '[name="slug"]', 'required' => 'required', 'autofocus' => 'autofocus']) }}
43 |
44 | @if ($errors->has('name'))
45 | {{ $errors->first('name') }}
46 | @endif
47 |
48 |
49 |
50 |
51 |
52 |
53 | {{-- Slug --}}
54 |
55 | {{ Form::label('slug', trans('cortex/tenants::common.slug'), ['class' => 'control-label']) }}
56 | {{ Form::text('slug', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.slug'), 'required' => 'required']) }}
57 |
58 | @if ($errors->has('slug'))
59 | {{ $errors->first('slug') }}
60 | @endif
61 |
62 |
63 |
64 |
65 |
66 |
67 | {{-- Is Active --}}
68 |
69 | {{ Form::label('is_active', trans('cortex/tenants::common.is_active'), ['class' => 'control-label']) }}
70 | {{ Form::select('is_active', [1 => trans('cortex/tenants::common.yes'), 0 => trans('cortex/tenants::common.no')], null, ['class' => 'form-control select2', 'data-minimum-results-for-search' => 'Infinity', 'data-width' => '100%', 'required' => 'required']) }}
71 |
72 | @if ($errors->has('is_active'))
73 | {{ $errors->first('is_active') }}
74 | @endif
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | {{-- Email --}}
86 |
87 | {{ Form::label('email', trans('cortex/tenants::common.email'), ['class' => 'control-label']) }}
88 | {{ Form::email('email', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.email'), 'required' => 'required']) }}
89 |
90 | @if ($errors->has('email'))
91 | {{ $errors->first('email') }}
92 | @endif
93 |
94 |
95 |
96 |
97 |
98 |
99 | {{-- Website --}}
100 |
101 | {{ Form::label('website', trans('cortex/tenants::common.website'), ['class' => 'control-label']) }}
102 | {{ Form::text('website', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.website')]) }}
103 |
104 | @if ($errors->has('website'))
105 | {{ $errors->first('website') }}
106 | @endif
107 |
108 |
109 |
110 |
111 |
112 |
113 | {{-- Phone --}}
114 |
115 | {{ Form::label('phone', trans('cortex/tenants::common.phone'), ['class' => 'control-label']) }}
116 | {{ Form::tel('phone_input', $tenant->phone, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.phone'), 'required' => 'required']) }}
117 |
118 | {{ trans('cortex/foundation::messages.invalid_phone') }}
119 | @if ($errors->has('phone'))
120 | {{ $errors->first('phone') }}
121 | @endif
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | {{-- Language Code --}}
133 |
134 | {{ Form::label('language_code', trans('cortex/tenants::common.language'), ['class' => 'control-label']) }}
135 | {{ Form::hidden('language_code', '', ['class' => 'skip-validation', 'id' => 'language_code_hidden']) }}
136 | {{ Form::select('language_code', $languages, null, ['class' => 'form-control select2', 'placeholder' => trans('cortex/tenants::common.select_language'), 'data-allow-clear' => 'true', 'data-width' => '100%']) }}
137 |
138 | @if ($errors->has('language_code'))
139 | {{ $errors->first('language_code') }}
140 | @endif
141 |
142 |
143 |
144 |
145 |
146 |
147 | {{-- Country Code --}}
148 |
149 | {{ Form::label('country_code', trans('cortex/tenants::common.country'), ['class' => 'control-label']) }}
150 | {{ Form::hidden('country_code', '', ['class' => 'skip-validation', 'id' => 'country_code_hidden']) }}
151 | {{ Form::select('country_code', [], null, ['class' => 'form-control select2', 'placeholder' => trans('cortex/tenants::common.select_country'), 'required' => 'required', 'data-allow-clear' => 'true', 'data-width' => '100%']) }}
152 |
153 | @if ($errors->has('country_code'))
154 | {{ $errors->first('country_code') }}
155 | @endif
156 |
157 |
158 |
159 |
160 |
161 |
162 | {{-- State --}}
163 |
164 | {{ Form::label('state', trans('cortex/tenants::common.state'), ['class' => 'control-label']) }}
165 | {{ Form::text('state', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.state')]) }}
166 |
167 | @if ($errors->has('state'))
168 | {{ $errors->first('state') }}
169 | @endif
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 | {{-- City --}}
181 |
182 | {{ Form::label('city', trans('cortex/tenants::common.city'), ['class' => 'control-label']) }}
183 | {{ Form::text('city', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.city')]) }}
184 |
185 | @if ($errors->has('city'))
186 | {{ $errors->first('city') }}
187 | @endif
188 |
189 |
190 |
191 |
192 |
193 |
194 | {{-- Postal Code --}}
195 |
196 | {{ Form::label('postal_code', trans('cortex/tenants::common.postal_code'), ['class' => 'control-label']) }}
197 | {{ Form::text('postal_code', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.postal_code')]) }}
198 |
199 | @if ($errors->has('postal_code'))
200 | {{ $errors->first('postal_code') }}
201 | @endif
202 |
203 |
204 |
205 |
206 |
207 |
208 | {{-- Timezone --}}
209 |
210 | {{ Form::label('timezone', trans('cortex/auth::common.timezone'), ['class' => 'control-label']) }}
211 | {{ Form::hidden('timezone', '', ['class' => 'skip-validation', 'id' => 'timezone_hidden']) }}
212 | {{ Form::select('timezone', timezones(), null, ['class' => 'form-control select2', 'placeholder' => trans('cortex/auth::common.select_timezone'), 'data-allow-clear' => 'true', 'data-width' => '100%']) }}
213 |
214 | @if ($errors->has('timezone'))
215 | {{ $errors->first('timezone') }}
216 | @endif
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 | {{-- Launch Date --}}
228 |
229 | {{ Form::label('launch_date', trans('cortex/tenants::common.launch_date'), ['class' => 'control-label']) }}
230 | {{ Form::text('launch_date', null, ['class' => 'form-control daterangepicker', 'data-locale' => '{"format": "YYYY-MM-DD"}', 'data-single-date-picker' => 'true', 'data-show-dropdowns' => 'true', 'data-auto-apply' => 'true']) }}
231 |
232 |
233 | @if ($errors->has('launch_date'))
234 | {{ $errors->first('launch_date') }}
235 | @endif
236 |
237 |
238 |
239 |
240 |
241 |
242 | {{-- Style --}}
243 |
244 | {{ Form::label('style', trans('cortex/tenants::common.style'), ['class' => 'control-label']) }}
245 | {{ Form::text('style', null, ['class' => 'form-control style-picker', 'placeholder' => trans('cortex/tenants::common.style'), 'data-placement' => 'bottomRight', 'readonly' => 'readonly']) }}
246 |
247 | @if ($errors->has('style'))
248 | {{ $errors->first('style') }}
249 | @endif
250 |
251 |
252 |
253 |
254 |
255 |
256 | {{-- Tags --}}
257 |
258 | {{ Form::label('tags[]', trans('cortex/tenants::common.tags'), ['class' => 'control-label']) }}
259 | {{ Form::hidden('tags', '', ['class' => 'skip-validation']) }}
260 | {{ Form::select('tags[]', $tags, null, ['class' => 'form-control select2', 'multiple' => 'multiple', 'data-width' => '100%', 'data-tags' => 'true']) }}
261 |
262 | @if ($errors->has('tags'))
263 | {{ $errors->first('tags') }}
264 | @endif
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 | {{-- Profile Picture --}}
276 |
306 |
307 |
308 |
309 |
310 |
311 | {{-- Cover Photo --}}
312 |
342 |
343 |
344 |
345 |
346 |
347 | {{-- Currency --}}
348 |
349 | {{ Form::label('currency', trans('cortex/tenants::common.currency'), ['class' => 'control-label']) }}
350 | {{ Form::hidden('currency', '', ['class' => 'skip-validation', 'id' => 'currency_hidden']) }}
351 | {{ Form::select('currency', currencies(), null, ['class' => 'form-control select2', 'placeholder' => trans('cortex/tenants::common.select_currency'), 'data-allow-clear' => 'true', 'data-width' => '100%']) }}
352 |
353 | @if ($errors->has('currency'))
354 | {{ $errors->first('currency') }}
355 | @endif
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 | {{-- Twitter --}}
367 |
375 |
376 |
377 |
378 |
379 |
380 | {{-- Facebook --}}
381 |
382 | {{ Form::label('social[facebook]', trans('cortex/tenants::common.facebook'), ['class' => 'control-label']) }}
383 | {{ Form::text('social[facebook]', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.facebook')]) }}
384 |
385 | @if ($errors->has('social.facebook'))
386 | {{ $errors->first('social.facebook') }}
387 | @endif
388 |
389 |
390 |
391 |
392 |
393 |
394 | {{-- Linkedin --}}
395 |
396 | {{ Form::label('social[linkedin]', trans('cortex/tenants::common.linkedin'), ['class' => 'control-label']) }}
397 | {{ Form::text('social[linkedin]', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.linkedin')]) }}
398 |
399 | @if ($errors->has('social.linkedin'))
400 | {{ $errors->first('social.linkedin') }}
401 | @endif
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 | {{-- Address --}}
413 |
414 | {{ Form::label('address', trans('cortex/tenants::common.address'), ['class' => 'control-label']) }}
415 | {{ Form::text('address', null, ['class' => 'form-control', 'placeholder' => trans('cortex/tenants::common.address')]) }}
416 |
417 | @if ($errors->has('address'))
418 | {{ $errors->first('address') }}
419 | @endif
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 | {{-- Description --}}
431 |
432 | {{ Form::label('description', trans('cortex/tenants::common.description'), ['class' => 'control-label']) }}
433 | {{ Form::textarea('description', null, ['class' => 'form-control tinymce', 'placeholder' => trans('cortex/tenants::common.description'), 'rows' => 3]) }}
434 |
435 | @if ($errors->has('description'))
436 | {{ $errors->first('description') }}
437 | @endif
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 | {{ Form::button(trans('cortex/tenants::common.submit'), ['class' => 'btn btn-primary btn-flat', 'type' => 'submit']) }}
449 |
450 |
451 | @include('cortex/tenants::managerarea.partials.timestamps', ['model' => $tenant])
452 |
453 |
454 |
455 |
456 |
457 | {{ Form::close() }}
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 | @endsection
470 |
--------------------------------------------------------------------------------