0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

laravel auth 管理者権限追加

Posted at

備忘録です。
laravel 6 + auth で特定ユーザーに何らかの権限(例えば管理者)を与えて区別したい場合
usersテーブルに例えば admin(boolean)とかの列を加えて、特定ユーザーは true その他は falseとしておいて
Auth::user()->admin で真偽値が戻ります。
Auth::user() が何をやっているのか分かっている方には既知なのでしょうけど。
user()->なんとか はそのuser のその列を返すのですね。
あまりに簡単にカスタマイズできるので驚いてしまいました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?