最近需要實作一項JWT身份驗證的功能,同時在有他人登入時將其他client登出
這邊我使用了一項開源的套件tymondesigns/jwt-auth來實作JWT的部分,
正常使用下的安裝說明作者都有寫清楚,
但是!!文件超爛啊...
文件跟實際上的套件功能缺失了70%左右,慢慢爬程式碼才發現文件跟程式差很多
接下來說說單一登入的部分
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique (email))[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
<input type="text" name="vat" value="">套用前
dd(request('vat')); // ''套用後
dd(request('vat')); // null
Route::get('/api/posts/{post}', function(Post $post) { return $post; });
Post::findOrFail($post) 並且將它注入到 $post 這個變數。對於有經驗的Laravel開發者,這個功能就很像是已經存在的 路由模型綁定 ,但現在移除了手動綁定它。