Kantai235 / kaobei.opendata

純靠北工程師 資料開放平臺
18 stars 5 forks source link

使用者新增 TOKEN、使用 API TOKEN #9

Open Kantai235 opened 5 years ago

Kantai235 commented 5 years ago

使用者資料表新增 api_token(64) 新增 API TOKEN,以便後續 API 的介接

Kantai235 commented 5 years ago

建議執行步驟:

  1. 瞭解 Laravel 的 資料庫遷移 這件事,並且嘗試讓 users 這張資料表新增 api_token 這個欄位,欄位的屬性為 string(64)
  2. 使用者在註冊會員時,要賦予使用者預設的 API TOKEN,所以要去了解一下 Repository 這件事,建議可以閱讀 這篇文章,或者 這篇文章
  3. 修改 UserRepository,讓使用者在註冊會員時能擁有預設的 API TOKEN
  4. Repository 新增更新 API TOKEN 的方法
  5. 使用者前台修改資訊的地方,提供使用者更新 API TOKEN,但不是給使用者輸入,而是 str_random 亂數產生
  6. 後台使用者的部分,提供管理員更新使用者的 API TOKEN,並且提供管理者輸入,或是 str_random 亂數產生
LowDensity commented 5 years ago

看起來很可以,我這周末來看看