Download the PHP package zh-mead/laravel-admin-ext-wechat without Composer
On this page you can find all versions of the php package zh-mead/laravel-admin-ext-wechat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download zh-mead/laravel-admin-ext-wechat
More information about zh-mead/laravel-admin-ext-wechat
Files in zh-mead/laravel-admin-ext-wechat
Download zh-mead/laravel-admin-ext-wechat
More information about zh-mead/laravel-admin-ext-wechat
Files in zh-mead/laravel-admin-ext-wechat
Vendor zh-mead
Package laravel-admin-ext-wechat
Short Description laravel-admin-ext-wechat
License MIT
Homepage https://github.com/laravel-admin-ext/wechat
Package laravel-admin-ext-wechat
Short Description laravel-admin-ext-wechat
License MIT
Homepage https://github.com/laravel-admin-ext/wechat
Please rate this library. Is it a good library?
Informations about the package laravel-admin-ext-wechat
Laravel-admin-wechat 安装手册
简介
测试版本为:laravel5.5 + laravel-admin1.6 (安装前请先安装好 laravel-admin)
步骤
- 安装 Wechat 扩展包
$ composer require zh-mead/laravel-admin-ext-wechat
- 发布静态资源
$ php artisan vendor:publish --tag=laravel-admin-wechat
- 创建数据表
$ php artisan migrate
- 添加菜单
$ php artisan admin:import wechat
- 安装完成,配置 env 文件
.....
WECHAT_DEBUG = false //线下配置,上线的话请配置true(可省略)
- 添加 CSRF 白名单
// app/Http/Middleware/VerifyCsrfToken.php
protected $except = [
......
'wechat',
'admin/wechat*',
.....
];
微信网页授权用法
- 添加中间件 Kernel.php
// app/Http/Kernel.php
protected $routeMiddleware = [
......
'wechat.auth' => \ZhMead\WeChat\Middleware\WeChatAuthenticate::class,
];
- 配置 config下的 auth.php 文件
....
// config/auth.php
'guards' => [
......
'wechat' => [
'driver' => 'session',
'provider' => 'fans',
],
],
....
'providers' => [
.....
'fans' => [
'driver' => 'eloquent',
'model' => \ZhMead\WeChat\Models\Fan::class,
],
],
- 配置注册事件
// app/Providers/EventServiceProvider.php
use ZhMead\WeChat\Events\Subscribe;
use ZhMead\WeChat\Events\WebAuthenticate;
use ZhMead\WeChat\Listeners\RegisterWeChatFan;
......
protected $listen = [
.....
Subscribe::class => [
RegisterWeChatFan::class
],
WebAuthenticate::class => [
RegisterWeChatFan::class
],
.....
];
- 路由的使用 web.php
// routes/web.php
Route::group(['middleware' => ['web', 'wechat.auth']], function () {
//这里写需要微信网页授权的路由
});
- 获取登录用户
use Illuminate\Support\Facades\Auth;
.....
Auth::guard('wechat')->user()//获取用户信息All versions of laravel-admin-ext-wechat with dependencies
PHP Build Version
Package Version
The package zh-mead/laravel-admin-ext-wechat contains the following files
Loading the files please wait ...