<?php
 namespace App\Modules\Base; use Illuminate\Support\Facades\View; use TechOnline\Laravel\Dao\ModelUtil; use TechOnline\Utils\StrUtil; trait SettingBaseTrait { protected $setting = false; protected function settingSetUp() { if (false === $this->setting) { $this->setting = ModelUtil::get( 'module_' . StrUtil::uncamelize(self::MODULE) . '_setting', ['alias' => $this->alias] ); } if (empty($this->setting)) { header('Location: /'); exit(); } $this->memberUserId = $this->setting['memberUserId']; View::share('_setting', $this->setting); View::share('_base', '/m/' . StrUtil::uncamelize(self::MODULE) . '_' . $this->setting['alias']); } protected function _view($view, $viewData = []) { $mobileView = 'res::' . self::MODULE . '.' . $this->setting['template'] . '.mobile.' . $view; return view($mobileView, $viewData); } public function _viewRender($view, $viewData) { $mobileView = 'res::' . self::MODULE . '.' . $this->setting['template'] . '.mobile.' . $view; return View::make($mobileView, $viewData)->render(); } }