add: full multi-tenancy control
This commit is contained in:
40
packages/Webkul/Core/src/Http/Controllers/CoreController.php
Normal file
40
packages/Webkul/Core/src/Http/Controllers/CoreController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class CoreController extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view'], $this->_config);
|
||||
}
|
||||
}
|
||||
74
packages/Webkul/Core/src/Http/helpers.php
Executable file
74
packages/Webkul/Core/src/Http/helpers.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
use Webkul\Core\Acl;
|
||||
use Webkul\Core\Core;
|
||||
use Webkul\Core\Menu;
|
||||
use Webkul\Core\SystemConfig;
|
||||
use Webkul\Core\ViewRenderEventManager;
|
||||
use Webkul\Core\Vite;
|
||||
|
||||
if (! function_exists('core')) {
|
||||
/**
|
||||
* Core helper.
|
||||
*/
|
||||
function core(): Core
|
||||
{
|
||||
return app('core');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('menu')) {
|
||||
/**
|
||||
* Menu helper.
|
||||
*/
|
||||
function menu(): Menu
|
||||
{
|
||||
return app('menu');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('acl')) {
|
||||
/**
|
||||
* Acl helper.
|
||||
*/
|
||||
function acl(): Acl
|
||||
{
|
||||
return app('acl');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('system_config')) {
|
||||
/**
|
||||
* System Config helper.
|
||||
*/
|
||||
function system_config(): SystemConfig
|
||||
{
|
||||
return app('system_config');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('view_render_event')) {
|
||||
/**
|
||||
* View render event helper.
|
||||
*/
|
||||
function view_render_event($eventName, $params = null)
|
||||
{
|
||||
app()->singleton(ViewRenderEventManager::class);
|
||||
|
||||
$viewEventManager = app()->make(ViewRenderEventManager::class);
|
||||
|
||||
$viewEventManager->handleRenderEvent($eventName, $params);
|
||||
|
||||
return $viewEventManager->render();
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('vite')) {
|
||||
/**
|
||||
* Vite helper.
|
||||
*/
|
||||
function vite(): Vite
|
||||
{
|
||||
return app(Vite::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user