sebwas/multi-model-authentication
Composer 安装命令:
composer require sebwas/multi-model-authentication
包简介
An alteration of the authentication methods by laravel to support multi model authentication
README 文档
README
An approach to enable multi model authentication, which means that from a derived base class used for authentication there are certain decorating classes.
Usage
The usage is relatively easy and basically means to active the correct Service Provider and setup the base model.
Activation
In config/app.php setup up the \SebWas\MultiModelAuthentication\AuthServiceProvider instead of the default one, and also setup the right alias of Auth => SebWas\MultiModelAuthentication\Facades\Auth::class.
Model
All models derived that should be user have to implement the \SebWas\MultiModelAuthentication\ConsumingModel interface to set everything up. You can also use the \SebWas\MultiModelAuthentication\ConsumesModel trait which gives you some handy functionality as well.
The model under $this->app['config']['auth.model'] must implement the \SebWas\MultiModelAuthentication\ProvidingModel interface, which makes it obligatory to have the method modelColumn() defined which is supposed to tell the driver which column of the DB to use to get the right model.
Alternatively, the base model can implement the \SebWas\MultiModelAuthentication\ProvidingModelAndAlias interface which makes it, in addition to the first one, obligatory to implement a modelAlias() method which can then return an array with aliases that the value of modelColumn() should use to determine which Model to use.
As a third option you can use the \SebWas\MultiModelAuthentication\SelfResolvingModel interface, which then needs to implement a resolveModel() method that, itself, returns a valid fully qualified class name.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-07