1. 新建個(gè) laravel 項(xiàng)目
2. 執(zhí)行命令運(yùn)行起站點(diǎn)來(lái)
3. 登錄裝著 mysql 服務(wù)的遠(yuǎn)程服務(wù)器,創(chuàng)建數(shù)據(jù)庫(kù)及用戶名
(1)登錄 ssh root@218.45.23.456
(2)登錄 mysql 輸入命令 mysql -u root -p,輸入密碼登錄成功顯示 mysql>
(3)創(chuàng)建數(shù)據(jù)庫(kù) create database aaaaaaaa charset utf8mb4;
(4)創(chuàng)建遠(yuǎn)程用戶 create user aaaa@‘%' identified by ‘密碼';
(5)賦權(quán) grant all privileges on aaaaaaaa.* to aaaa@“%”;
4. 改下 database/migrations 目錄下的 **users_table.php 文件,添加上微信開放的字段
//微信資料
$table->string(‘weapp_openid')->nullable()->comment(‘微信開放id');
$table->string(‘weapp_session_key')->nullable()->comment(‘微信session_key');
$table->string(‘nickname')->nullable()->comment(‘昵稱');
$table->string(‘weapp_avatar')->nullable()->comment(‘微信頭像');
$table->string(‘country')->nullable()->comment(‘國(guó)家');
$table->string(‘province')->nullable()->comment(‘省份');
$table->string(‘city')->nullable()->comment(‘所在城市');
$table->string(‘language')->nullable()->comment(‘語(yǔ)言');
$table->json(‘location')->nullable()->comment(‘當(dāng)前地理信息');
$table->enum(‘gender', [‘1', ‘2'])->default(‘1')->comment(‘性別默認(rèn)男');
$table->string(‘phone')->nullable()->unique();
5. 打開 config/app.php 把時(shí)區(qū)、語(yǔ)言換下
‘timezone' => ‘Asia/Shanghai',
‘locale' => ‘zh-CN',
‘fallback_locale' => ‘zh-CN',
‘faker_locale' => ‘zh-CN',
6. 打開 composer.json
require 里添加下面幾個(gè)包
“require”: {
“php”: “^7.1.3”,
“fideloper/proxy”: “^4.0”,
“l(fā)aravel/framework”: “5.8.*”,
“l(fā)aravel/tinker”: “^1.0”,
“jellybool/flysystem-upyun”: “^1.0”,
“l(fā)aravel/passport”: “^7.2”,
“overtrue/laravel-wechat”: “~5.0”
},
7. 命令行執(zhí)行 composer update
打開參照鏈接配置下
(1)又拍云參照配置 https://github.com/JellyBool/flysystem-upyun
(2)easywechart 參照配置 GitHub - overtrue/laravel-wechat: 微信 SDK for Laravel, 基于 overtrue/wechat
8.app/Http/Kernel.php 接口設(shè)置次數(shù)多些
‘a(chǎn)pi' => [
‘throttle:60000,1',
‘bindings',
],
9. 打開.env 文件,配置好數(shù)據(jù)庫(kù)和小程序、又拍云的保密信息
DB_CONNECTION=mysql
DB_HOST=218.45.23.456
DB_PORT=3306
DB_DATABASE=aaaaaaaa
DB_USERNAME=aaaa
DB_PASSWORD=密碼
UP_OPERATOR_NAME=又拍云ftp用戶名
UP_OPERATOR_PASSWORD=又拍云ftp密碼
WECHAT_MINI_PROGRAM_APPID=小程序APPID
WECHAT_MINI_PROGRAM_SECRET=小程序SECRET
10. 執(zhí)行 php artisan migrate,生成數(shù)據(jù)庫(kù)表 7 張表
Migration table created successfully.
Migrated: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrated: 2016_06_01_000001_create_oauth_auth_codes_table
Migrated: 2016_06_01_000002_create_oauth_access_tokens_table
Migrated: 2016_06_01_000003_create_oauth_refresh_tokens_table
Migrated: 2016_06_01_000004_create_oauth_clients_table
Migrated: 000005_create_oauth_personal_access_clients_table
11. 執(zhí)行命令 php artisan passport:install
Client ID: 1
Client secret:
Password grant client created successfully.
Client ID: 2
Client secret:
12.config/auth.php,API 的 dirver 改成 passport
'api' => [
'driver' => 'passport',
'provider' => 'users',
'hash' => false,
],
一開始差不多就這些吧
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- 利用Homestead快速運(yùn)行一個(gè)Laravel項(xiàng)目的方法詳解
- Laravel搭建后臺(tái)登錄系統(tǒng)步驟詳解
- Laravel框架學(xué)習(xí)筆記(一)環(huán)境搭建
- laravel開發(fā)環(huán)境homestead搭建過(guò)程詳解