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