In the base class FastAdmin provided Frontend
, Backend
, Api
in both provide access to the current administrator or user login information method
In the back office of the controller can $this->auth->id
be obtained administrator ID, $this->auth->字段名
for additional information administrator, if needs to obtain the administrator ID currently logged in the background Model can be acquired in two ways:
First, use the Session to Obtain Administrator Information
\think\Session::get('admin');
Second, to obtain using a single Example
$auth = \app\admin\library\Auth::instance();
The controller or the front desk of the API can be $this->auth->id
used to get the currently logged membership ID, $this->auth->字段员
for additional information logon members, if the user needs to obtain information about the currently logged in at the front desk Model, and may be able to get the following ways:
//获取Auth对象
$auth = \app\common\library\Auth::install();
//获取会员模型
$user = $auth->getUser();