{"id":8159,"date":"2020-10-26T07:00:26","date_gmt":"2020-10-25T22:00:26","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=8159"},"modified":"2020-10-24T17:07:45","modified_gmt":"2020-10-24T08:07:45","slug":"%e3%80%90laravel-jetstream%e3%80%91%e8%a4%87%e6%95%b0%e3%83%a2%e3%83%87%e3%83%ab%e3%81%a7%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%a7%e3%81%8d%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=8159","title":{"rendered":"\u3010Laravel Jetstream\u3011\u8907\u6570\u30e2\u30c7\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\uff08Multi Auth\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001<code>Laravel 8.x<\/code>\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3057\u3070\u3089\u304f\u7d4c\u3061\u307e\u3057\u305f\u304c\u3001\u3084\u306f\u308a\u9a5a\u304d\u3068\u3068\u3082\u306b\u8fce\u3048\u3089\u308c\u305f\u306e\u304c\u30ed\u30b0\u30a4\u30f3\u30d1\u30c3\u30b1\u30fc\u30b8<code>Jetstream<\/code>\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001<code>Jetstream<\/code>\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3060\u3051\u3067\u30b9\u30de\u30db\u306e\u30a2\u30d7\u30ea\u3068\u9023\u643a\u3057\u305f\uff12\u6bb5\u968e\u8a8d\u8a3c\u3092\u5b9f\u88c5\u3057\u3066\u3044\u305f\u308a\u3068\u3001\u3068\u3066\u3082\u591a\u6a5f\u80fd\u3060\u304b\u3089\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306e\u8a18\u4e8b\u306f\u3053\u306e<code>Jetstream<\/code>\u306b\u3042\u308b\u6a5f\u80fd\u3092\u3064\u3051\u3066\u307f\u305f\u304f\u306a\u3063\u305f\u3053\u3068\u304c\u59cb\u307e\u308a\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u30de\u30eb\u30c1\u8a8d\u8a3c<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u8a00\u3046\u30de\u30eb\u30c1\u8a8d\u8a3c\u3068\u306f\u3001\u4e00\u822c\u7684\u306a<code>users<\/code>\u30c6\u30fc\u30d6\u30eb\u306b<code>role<\/code>\u30c7\u30fc\u30bf\u3082\u305f\u305b\u305f\u3082\u306e\u3067\u306f\u306a\u304f\u3001<strong>\u5168\u304f\u5225\u306e\u30e2\u30c7\u30eb\u3092\u3044\u304f\u3064\u304b\u4f7f\u3063\u305f\u300c\u672c\u683c\u7684\u306a\u300d\u30de\u30eb\u30c1\u8a8d\u8a3c<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u65b9\u5f0f\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u306f\u3001<strong>\u5404\u30e2\u30c7\u30eb\u3067\u4fdd\u6301\u3059\u308b\u30c7\u30fc\u30bf\u304c\u5225\u3067\u3082OK<\/strong>\u3068\u3044\u3046\u70b9\u3067\u3059\u3002\uff08\u4f8b\u3048\u3070\u3001\u82b8\u4eba\u30e6\u30fc\u30b6\u30fc\u306a\u3089\u300c\u5e2b\u5320\u306e\u540d\u524d\u300d\u3001\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u306a\u3089\u300c\u62c5\u5f53\u30d1\u30fc\u30c8\u300d\u3068\u3044\u3046\u5177\u5408\u306b\u5c02\u7528\u306e\u30c7\u30fc\u30bf\u3092\u6301\u305f\u305b\u3066\u3044\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u8907\u6570\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u305f\u30de\u30eb\u30c1\u8a8d\u8a3c\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<br \/>\n\uff08\u6700\u5f8c\u306b\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3088\ud83d\udc4d\uff09<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6071 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u898b\u3089\u308c\u308b\u3068\u7dca\u5f35\u3059\u308b\u306e\u3067\u3001<br \/>\n\u64ae\u5f71\u3057\u306a\u304c\u3089\u30d4\u30a2\u30ce\u7df4\u7fd2\u4e2d\uff01\u300d<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u3059\u3067\u306b<code>Laravel<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd<code>Jetstream<\/code>\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<br \/>\n\u307e\u3060\u306e\u65b9\u306f\u4ee5\u4e0b\u306eURL\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\ud83d\udcdd\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=7827\">Laravel8.x\u4ee5\u964d\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u5c11\u3057\u3067\u3082\u30a4\u30e1\u30fc\u30b8\u3057\u3084\u3059\u304f\u3057\u305f\u3044\u306e\u3067\u3001\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\uff13\u3064\u306e\u30e2\u30c7\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<ul>\n<li>Comedian\uff1a \u82b8\u4eba<\/li>\n<li>Musician\uff1a \u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3<\/li>\n<li>Athlete\uff1a \u30a2\u30b9\u30ea\u30fc\u30c8<\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<h1>\u30e2\u30c7\u30eb\uff06\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305a\u306f\u3058\u3081\u306b\u3001\u5148\u307b\u3069\u7d39\u4ecb\u3057\u305f\uff13\u30bf\u30a4\u30d7\u306e\u30e6\u30fc\u30b6\u30fc\uff08\u82b8\u4eba\u3001\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u3001\u30a2\u30b9\u30ea\u30fc\u30c8\uff09\u306e\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:model Comedian -m<\/strong><\/pre>\n<pre><strong>php artisan make:model Musician -m<\/strong><\/pre>\n<pre><strong>php artisan make:model Athlete -m<\/strong><\/pre>\n<h2>\u30e2\u30c7\u30eb\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u306b\u5bfe\u5fdc\u3055\u305b\u308b\u305f\u3081\u3001\u305d\u308c\u305e\u308c<code>Authenticatable<\/code>\u3092<code>extends<\/code>\uff08\u7d99\u627f\uff09\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Models\/Comedian.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\n<strong>use Illuminate\\Foundation\\Auth\\User as Authenticatable; \/\/ \ud83d\udc48\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\nclass Comedian extends <strong>Authenticatable \/\/ \ud83d\udc48\u3053\u3053\u3092\u5909\u66f4\u3057\u307e\u3057\u305f<\/strong>\r\n{\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p><strong>app\/Models\/Musician.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n<strong>use Illuminate\\Foundation\\Auth\\User as Authenticatable; \/\/ \ud83d\udc48\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\nclass Musician extends <strong>Authenticatable \/\/ \ud83d\udc48\u3053\u3053\u3092\u5909\u66f4\u3057\u307e\u3057\u305f<\/strong>\r\n{\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p><strong>app\/Models\/Athlete.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n<strong>use Illuminate\\Foundation\\Auth\\User as Authenticatable; \/\/ \ud83d\udc48\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n\r\nclass Athlete extends <strong>Authenticatable \/\/ \ud83d\udc48\u3053\u3053\u3092\u5909\u66f4\u3057\u307e\u3057\u305f<\/strong>\r\n{\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<h2>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h2>\n<p>\u5148\u307b\u3069\u306e\u30b3\u30de\u30f3\u30c9\u3067\u540c\u6642\u306b\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3082\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\uff08<code>-m<\/code>\u3092\u3064\u3051\u305f\u304b\u3089\u3067\u3059\ud83d\udc4d\uff09\u306e\u3067\u3001\u3053\u3061\u3089\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>\u3010\u82b8\u4eba\u3055\u3093\u306e\u30c6\u30fc\u30d6\u30eb\u3011<\/strong><\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_comedians_table.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass CreateComediansTable extends Migration\r\n{\r\n    public function up()\r\n    {\r\n<strong>        Schema::create('comedians', function (Blueprint $table) {<\/strong>\r\n<strong>            $table-&gt;id();<\/strong>\r\n<strong>            $table-&gt;string('name')-&gt;comment('\u540d\u524d');<\/strong>\r\n<strong>            $table-&gt;string('email')-&gt;unique()-&gt;comment('\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9');<\/strong>\r\n<strong>            $table-&gt;timestamp('email_verified_at')-&gt;nullable()-&gt;comment('\u30e1\u30fc\u30eb\u8a8d\u8a3c\u65e5\u6642');<\/strong>\r\n<strong>            $table-&gt;string('password')-&gt;comment('\u30d1\u30b9\u30ef\u30fc\u30c9');<\/strong>\r\n<strong>            $table-&gt;rememberToken()-&gt;comment('\u30ed\u30b0\u30a4\u30f3\u7701\u7565\u30c8\u30fc\u30af\u30f3');<\/strong>\r\n\r\n<strong>            \/\/ \u82b8\u4eba\u3055\u3093\u306e\u5c02\u7528\u30c7\u30fc\u30bf<\/strong>\r\n<strong>            $table-&gt;string('tv_programs')-&gt;nullable()-&gt;comment('\u4ee3\u8868\u7684\u306a\u30c6\u30ec\u30d3\u756a\u7d44');<\/strong>\r\n<strong>            $table-&gt;string('master')-&gt;nullable()-&gt;comment('\u5e2b\u5320');<\/strong>\r\n\r\n<strong>            $table-&gt;timestamps();<\/strong>\r\n<strong>        });<\/strong>\r\n    }<\/pre>\n<p><strong><br \/>\n\u3010\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u306e\u30c6\u30fc\u30d6\u30eb\u3011<\/strong><\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_musicians_table.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass CreateMusiciansTable extends Migration\r\n{\r\n    public function up()\r\n    {\r\n<strong>        Schema::create('musicians', function (Blueprint $table) {<\/strong>\r\n<strong>            $table-&gt;id();<\/strong>\r\n<strong>            $table-&gt;string('name')-&gt;comment('\u540d\u524d');<\/strong>\r\n<strong>            $table-&gt;string('email')-&gt;unique()-&gt;comment('\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9');<\/strong>\r\n<strong>            $table-&gt;timestamp('email_verified_at')-&gt;nullable()-&gt;comment('\u30e1\u30fc\u30eb\u8a8d\u8a3c\u65e5\u6642');<\/strong>\r\n<strong>            $table-&gt;string('password')-&gt;comment('\u30d1\u30b9\u30ef\u30fc\u30c9');<\/strong>\r\n<strong>            $table-&gt;rememberToken()-&gt;comment('\u30ed\u30b0\u30a4\u30f3\u7701\u7565\u30c8\u30fc\u30af\u30f3');<\/strong>\r\n\r\n<strong>            \/\/ \u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u5c02\u7528\u30c7\u30fc\u30bf<\/strong>\r\n<strong>            $table-&gt;string('instruments')-&gt;comment('\u697d\u5668');<\/strong>\r\n<strong>            $table-&gt;string('genre')-&gt;comment('\u97f3\u697d\u30b8\u30e3\u30f3\u30eb');<\/strong>\r\n\r\n<strong>            $table-&gt;timestamps();<\/strong>\r\n<strong>        });<\/strong>\r\n    }<\/pre>\n<p><strong><br \/>\n\u3010\u30a2\u30b9\u30ea\u30fc\u30c8\u306e\u30c6\u30fc\u30d6\u30eb\u3011<\/strong><\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_athletes_table.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass CreateAthletesTable extends Migration\r\n{\r\n    public function up()\r\n    {\r\n        <strong>Schema::create('athletes', function (Blueprint $table) {<\/strong>\r\n<strong>            $table-&gt;id();<\/strong>\r\n<strong>            $table-&gt;string('name')-&gt;comment('\u540d\u524d');<\/strong>\r\n<strong>            $table-&gt;string('email')-&gt;unique()-&gt;comment('\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9');<\/strong>\r\n<strong>            $table-&gt;timestamp('email_verified_at')-&gt;nullable()-&gt;comment('\u30e1\u30fc\u30eb\u8a8d\u8a3c\u65e5\u6642');<\/strong>\r\n<strong>            $table-&gt;string('password')-&gt;comment('\u30d1\u30b9\u30ef\u30fc\u30c9');<\/strong>\r\n<strong>            $table-&gt;rememberToken()-&gt;comment('\u30ed\u30b0\u30a4\u30f3\u7701\u7565\u30c8\u30fc\u30af\u30f3');<\/strong>\r\n\r\n<strong>            \/\/ \u30a2\u30b9\u30ea\u30fc\u30c8\u5c02\u7528\u30c7\u30fc\u30bf<\/strong>\r\n<strong>            $table-&gt;string('sports_type')-&gt;comment('\u30b9\u30dd\u30fc\u30c4\u306e\u7a2e\u985e');<\/strong>\r\n<strong>            $table-&gt;boolean('is_active')-&gt;comment('\u73fe\u5f79 or \u5f15\u9000\u6e08\u307f');<\/strong>\r\n\r\n<strong>            $table-&gt;timestamps();<\/strong>\r\n<strong>        });<\/strong>\r\n    }<\/pre>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067\u4e00\u65e6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066DB\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8165\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_1.png\" alt=\"\" width=\"412\" height=\"357\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_1.png 412w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_1-300x260.png 300w\" sizes=\"auto, (max-width: 412px) 100vw, 412px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8164\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_2.png\" alt=\"\" width=\"413\" height=\"359\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_2.png 413w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_2-300x261.png 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8163\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_3.png\" alt=\"\" width=\"410\" height=\"356\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_3.png 410w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_3-300x260.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/p>\n<p>\u3053\u3053\u3067\u304a\u6c17\u3065\u304d\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u308c\u3089\u306e\u30c6\u30fc\u30d6\u30eb\u69cb\u6210\u306f\uff13\u3064<strong>\u5168\u3066\u540c\u3058\u306b\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/strong>\uff08\u305f\u3060\u3057\u3001\u30ed\u30b0\u30a4\u30f3\u306b\u5fc5\u8981\u306a\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u7528\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u3053\u3053\u304c\u5192\u982d\u3067\u3082\u66f8\u3044\u305f\u30de\u30eb\u30c1\u8a8d\u8a3c\u306e\u30e1\u30ea\u30c3\u30c8\u3067\u3059\ud83d\udc4d<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u901a\u5e38\u3069\u304a\u308a<code>User<\/code>\u30e2\u30c7\u30eb\u3060\u3051\u3092\u4f7f\u3044\u3001<code>role<\/code>\u306e\u4e2d\u8eab\u3067\u30e6\u30fc\u30b6\u30fc\u30bf\u30a4\u30d7\u3092\u5206\u3051\u308b\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u306e\u5834\u5408\u306f<strong>\u4fdd\u5b58\u3059\u308b\u5185\u5bb9\u304c\u540c\u3058\u304b\u4f3c\u3066\u3044\u308b\u5834\u5408\u306b\u5411\u3044\u3066\u3044\u308b<\/strong>\u306e\u3067\u3001\u3069\u3061\u3089\u3092\u9078\u629e\u3059\u308b\u304b\u306f\u4fdd\u5b58\u3059\u308b\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u3067\u6c7a\u3081\u308b\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u307e\u3060\uff13\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u7a7a\u306e\u307e\u307e\u3067\u3059\u306e\u3067\u3001\u4f5c\u696d\u3092\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u305d\u308c\u305e\u308c\uff11\u4ef6\u305a\u3064\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:seed MultiAuthTableSeeder<\/strong><\/pre>\n<p>\u3059\u308b\u3068<code>Seeder\u30d5\u30a1\u30a4\u30eb<\/code>\uff08\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\uff09\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>database\/seeders\/MultiAuthTableSeeder.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace Database\\Seeders;\r\n\r\n<strong>use App\\Models\\Athlete;<\/strong>\r\n<strong>use App\\Models\\Comedian;<\/strong>\r\n<strong>use App\\Models\\Musician;<\/strong>\r\nuse Illuminate\\Database\\Seeder;\r\nuse Illuminate\\Support\\Facades\\Hash;\r\n\r\nclass MultiAuthTableSeeder extends Seeder\r\n{\r\n    \/**\r\n     * Run the database seeds.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function run()\r\n    {\r\n        \/\/ \u82b8\u4eba\r\n        <strong>$init_comedians = [<\/strong>\r\n<strong>            [<\/strong>\r\n<strong>                'name' =&gt; '\u660e\u77f3\u5bb6\u3055\u3093\u307e',<\/strong>\r\n<strong>                'email' =&gt; 'sanma@example.com',<\/strong>\r\n<strong>                'password' =&gt; 'secret',<\/strong>\r\n<strong>                'tv_programs' =&gt; '\u30db\u30f3\u30de\u3067\u3063\u304bTV\u3001\u304a\u7b11\u3044\u5411\u4e0a\u59d4\u54e1\u4f1a',<\/strong>\r\n<strong>                'master' =&gt; '\u7b11\u798f\u4ead\u677e\u4e4b\u52a9'<\/strong>\r\n<strong>            ],<\/strong>\r\n\r\n<strong>            \/\/ \u3053\u3053\u306b\u8ffd\u52a0\u3067\u304d\u307e\u3059<\/strong>\r\n<strong>        ];<\/strong>\r\n\r\n<strong>        foreach($init_comedians as $init_comedian) {<\/strong>\r\n\r\n<strong>            $comedian = new Comedian();<\/strong>\r\n<strong>            $comedian-&gt;name = $init_comedian['name'];<\/strong>\r\n<strong>            $comedian-&gt;email = $init_comedian['email'];<\/strong>\r\n<strong>            $comedian-&gt;password = Hash::make($init_comedian['password']);<\/strong>\r\n<strong>            $comedian-&gt;tv_programs = $init_comedian['tv_programs'];<\/strong>\r\n<strong>            $comedian-&gt;master = $init_comedian['master'];<\/strong>\r\n<strong>            $comedian-&gt;save();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n        \/\/ \u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\r\n        <strong>$init_musicians = [<\/strong>\r\n<strong>            [<\/strong>\r\n<strong>                'name' =&gt; 'Yoshiki',<\/strong>\r\n<strong>                'email' =&gt; 'yoshiki@example.com',<\/strong>\r\n<strong>                'password' =&gt; 'secret',<\/strong>\r\n<strong>                'instruments' =&gt; '\u30d4\u30a2\u30ce\u3001\u30c9\u30e9\u30e0',<\/strong>\r\n<strong>                'genre' =&gt; '\u30ed\u30c3\u30af\u3001\u30af\u30e9\u30b7\u30c3\u30af'<\/strong>\r\n<strong>            ],<\/strong>\r\n\r\n<strong>            \/\/ \u3053\u3053\u306b\u8ffd\u52a0\u3067\u304d\u307e\u3059<\/strong>\r\n<strong>        ];<\/strong>\r\n\r\n<strong>        foreach($init_musicians as $init_musician) {<\/strong>\r\n\r\n<strong>            $musician = new Musician();<\/strong>\r\n<strong>            $musician-&gt;name = $init_musician['name'];<\/strong>\r\n<strong>            $musician-&gt;email = $init_musician['email'];<\/strong>\r\n<strong>            $musician-&gt;password = Hash::make($init_musician['password']);<\/strong>\r\n<strong>            $musician-&gt;instruments = $init_musician['instruments'];<\/strong>\r\n<strong>            $musician-&gt;genre = $init_musician['genre'];<\/strong>\r\n<strong>            $musician-&gt;save();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n        \/\/ \u30a2\u30b9\u30ea\u30fc\u30c8\r\n        <strong>$init_athletes = [<\/strong>\r\n<strong>            [<\/strong>\r\n<strong>                'name' =&gt; '\u30d2\u30af\u30bd\u30f3\u30fb\u30b0\u30ec\u30a4\u30b7\u30fc',<\/strong>\r\n<strong>                'email' =&gt; 'rickson@example.com',<\/strong>\r\n<strong>                'password' =&gt; 'secret',<\/strong>\r\n<strong>                'sports_type' =&gt; '\u67d4\u8853',<\/strong>\r\n<strong>                'is_active' =&gt; false<\/strong>\r\n<strong>            ],<\/strong>\r\n\r\n<strong>            \/\/ \u3053\u3053\u306b\u8ffd\u52a0\u3067\u304d\u307e\u3059<\/strong>\r\n<strong>        ];<\/strong>\r\n\r\n<strong>        foreach($init_athletes as $init_athlete) {<\/strong>\r\n\r\n<strong>            $athlete = new Athlete();<\/strong>\r\n<strong>            $athlete-&gt;name = $init_athlete['name'];<\/strong>\r\n<strong>            $athlete-&gt;email = $init_athlete['email'];<\/strong>\r\n<strong>            $athlete-&gt;password = Hash::make($init_athlete['password']);<\/strong>\r\n<strong>            $athlete-&gt;sports_type = $init_athlete['sports_type'];<\/strong>\r\n<strong>            $athlete-&gt;is_active = $init_athlete['is_active'];<\/strong>\r\n<strong>            $athlete-&gt;save();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n    }\r\n}<\/pre>\n<p>\u203b \u308f\u304b\u308a\u306b\u304f\u304f\u306a\u308b\u306e\u3067\u656c\u79f0\u3092\u7701\u7565\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002\uff08\u898b\u3066\u306a\u3044\u3067\u3057\u3087\u3046\u304c\u3001\uff09\u3054\u672c\u4eba\u69d8\u3001\u30d5\u30a1\u30f3\u306e\u65b9\u3005\u3069\u3046\u305e\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u3001\u5e74\u4ee3\u304c\u30d0\u30ec\u3066\u3057\u307e\u3046\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3067\u3059\u307f\u307e\u305b\u3093\ud83d\ude02<\/p>\n<p>\u203b \u306a\u304a\u3001\u901a\u5e38\u306f<code>Comedian<\/code>\u3001<code>Musician<\/code>\u3001<code>Athlete<\/code>\u3054\u3068\u306b<code>Seeder\u30d5\u30a1\u30a4\u30eb<\/code>\u3092\u3064\u304f\u308b\u65b9\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u306a\u306e\u3067\uff11\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u307e\u305f\u3001<code>Laravel 8.x<\/code>\u304b\u3089\u306f<code>factory<\/code>\u304c\u4f7f\u3044\u3084\u3059\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u304c\u6c17\u306b\u306a\u308b\u65b9\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3082\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\ud83d\udcdd <a href=\"https:\/\/blog.capilano-fw.com\/?p=7799#Factory\">Laravel 8.x \u306e\u65b0\u6a5f\u80fd\u30fb\u5909\u66f4\u70b9\u306e\u307e\u3068\u3081 \uff1a Factory \u306e\u69cb\u9020\u304c\u5909\u66f4\u306b\u306a\u308b<\/a><\/p>\n<p>\u3067\u306f\u3001\u3053\u306e<code>Seeder\u30d5\u30a1\u30a4\u30eb<\/code>\u3092\u767b\u9332\u3057\u3066\u6709\u52b9\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>database\/seeders\/DatabaseSeeder.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass DatabaseSeeder extends Seeder\r\n{\r\n    public function run()\r\n    {\r\n        <strong>$this-&gt;call(MultiAuthTableSeeder::class);<\/strong> \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\r\n    }\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u306e\u4e2d\u8eab\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8167\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_4.png\" alt=\"\" width=\"640\" height=\"273\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_4.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_4-300x128.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8168\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_5.png\" alt=\"\" width=\"640\" height=\"274\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_5.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_5-300x128.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8169\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_6.png\" alt=\"\" width=\"640\" height=\"272\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_6.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_6-300x128.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h1>\u5404\u30e2\u30c7\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u4ee5\u4e0b\uff13\u3064\u306e\u30e2\u30c7\u30eb\u3092\u5b9f\u969b\u306b\u30ed\u30b0\u30a4\u30f3\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u30b3\u30f3\u30d5\u30a3\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u3059\u308b<\/h2>\n<p>\u30b3\u30f3\u30d5\u30a3\u30b0\u30d5\u30a1\u30a4\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>config\/auth.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nreturn [\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    'guards' =&gt; [\r\n        'web' =&gt; [\r\n            'driver' =&gt; 'session',\r\n            'provider' =&gt; 'users',\r\n        ],\r\n\r\n        'api' =&gt; [\r\n            'driver' =&gt; 'token',\r\n            'provider' =&gt; 'users',\r\n            'hash' =&gt; false,\r\n        ],\r\n\r\n<strong>        \/\/ \ud83d\udc47\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n<strong>        'comedians' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'session',<\/strong>\r\n<strong>            'provider' =&gt; 'comedians',<\/strong>\r\n<strong>        ],<\/strong>\r\n<strong>        'musicians' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'session',<\/strong>\r\n<strong>            'provider' =&gt; 'musicians',<\/strong>\r\n<strong>        ],<\/strong>\r\n<strong>        'athletes' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'session',<\/strong>\r\n<strong>            'provider' =&gt; 'athletes',<\/strong>\r\n<strong>        ]<\/strong>\r\n\r\n    ],\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    'providers' =&gt; [\r\n        'users' =&gt; [\r\n            'driver' =&gt; 'eloquent',\r\n            'model' =&gt; App\\Models\\User::class,\r\n        ],\r\n        <strong>\/\/ \ud83d\udc47\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n<strong>        'comedians' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'eloquent',<\/strong>\r\n<strong>            'model' =&gt; App\\Models\\Comedian::class,<\/strong>\r\n<strong>        ],<\/strong>\r\n<strong>        'musicians' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'eloquent',<\/strong>\r\n<strong>            'model' =&gt; App\\Models\\Musician::class,<\/strong>\r\n<strong>        ],<\/strong>\r\n<strong>        'athletes' =&gt; [<\/strong>\r\n<strong>            'driver' =&gt; 'eloquent',<\/strong>\r\n<strong>            'model' =&gt; App\\Models\\Athlete::class,<\/strong>\r\n<strong>        ]<\/strong>\r\n        \/\/ 'users' =&gt; [\r\n        \/\/     'driver' =&gt; 'database',\r\n        \/\/     'table' =&gt; 'users',\r\n        \/\/ ],\r\n    ],\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u6b21\u306b\u30de\u30eb\u30c1\u8a8d\u8a3c\u306e\u305f\u3081\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>artisan make:controller MultiAuthController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/MultiAuthController.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\n\r\nclass MultiAuthController extends Controller\r\n{\r\n    <strong>public function showLoginForm() {<\/strong>\r\n\r\n<strong>        return view('multi_auth.login');<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function login(Request $request) {<\/strong>\r\n\r\n<strong>        $credentials = $request-&gt;only(['email', 'password']);<\/strong>\r\n<strong>        $guard = $request-&gt;guard;<\/strong>\r\n\r\n<strong>        if(\\Auth::guard($guard)-&gt;attempt($credentials)) {<\/strong>\r\n\r\n<strong>            return redirect($guard .'\/dashboard'); \/\/ \u30ed\u30b0\u30a4\u30f3\u3057\u305f\u3089\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return back()-&gt;withErrors([<\/strong>\r\n<strong>            'auth' =&gt; ['\u8a8d\u8a3c\u306b\u5931\u6557\u3057\u307e\u3057\u305f']<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u4e2d\u8eab\u3068\u3057\u3066\u306f\u3001<code>showLoginForm()<\/code>\u304c\u30d6\u30e9\u30a6\u30b6\u3067\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3084\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u30da\u30fc\u30b8\u3001\u305d\u3057\u3066\u3001<code>login()<\/code>\u306f\u305d\u306e\u9001\u4fe1\u5148\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u5148\u307b\u3069\u306e<code>showLoginForm()<\/code>\u306e\u4e2d\u3067\u6307\u5b9a\u3057\u305f\u30d3\u30e5\u30fc\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>resources\/views\/multi_auth\/login.blade.php<\/strong><\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    <strong>&lt;link href=\"https:\/\/unpkg.com\/tailwindcss@^1.0\/dist\/tailwind.min.css\" rel=\"stylesheet\"&gt;<\/strong>\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    <strong>&lt;form method=\"POST\" action=\"multi_login\"&gt;<\/strong>\r\n<strong>        @csrf<\/strong>\r\n<strong>        &lt;div class=\"p-3\"&gt;<\/strong>\r\n<strong>            @error('auth')<\/strong>\r\n<strong>            &lt;div class=\"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-3\"&gt;<\/strong>\r\n<strong>                &amp;#x26A0; {{ $message }}<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n<strong>            @enderror<\/strong>\r\n<strong>            &lt;label class=\"block\"&gt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&lt;\/label&gt;<\/strong>\r\n<strong>            &lt;input class=\"border rounded mb-3 px-2 py-1\" type=\"text\" name=\"email\"&gt;<\/strong>\r\n<strong>            &lt;label class=\"block\"&gt;\u30d1\u30b9\u30ef\u30fc\u30c9&lt;\/label&gt;<\/strong>\r\n<strong>            &lt;input class=\"border rounded mb-3 px-2 py-1\" type=\"password\" name=\"password\"&gt;<\/strong>\r\n<strong>            &lt;label class=\"block\"&gt;\u30e6\u30fc\u30b6\u30fc\u30bf\u30a4\u30d7&lt;\/label&gt;<\/strong>\r\n<strong>            &lt;select name=\"guard\" class=\"border rounded px-2 py-1 mb-5\"&gt;<\/strong>\r\n<strong>                &lt;option value=\"\"&gt;\u25bc\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044&lt;\/option&gt;<\/strong>\r\n<strong>                &lt;option value=\"comedians\"&gt;\u82b8\u4eba&lt;\/option&gt;<\/strong>\r\n<strong>                &lt;option value=\"musicians\"&gt;\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3&lt;\/option&gt;<\/strong>\r\n<strong>                &lt;option value=\"athletes\"&gt;\u30a2\u30b9\u30ea\u30fc\u30c8&lt;\/option&gt;<\/strong>\r\n<strong>            &lt;\/select&gt;<\/strong>\r\n<strong>            &lt;br&gt;<\/strong>\r\n<strong>            &lt;button class=\"bg-blue-500 text-white rounded px-3 py-2\" type=\"submit\"&gt;\u30ed\u30b0\u30a4\u30f3&lt;\/button&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    &lt;\/form&gt;<\/strong>\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u203b\u306a\u304a\u3001<code>CSS<\/code>\u306f\u3044\u307e\u52e2\u3044\u304c\u3042\u308b\uff08\u3068\u601d\u308f\u308c\u308b\uff09<code>Tailwind CSS<\/code>\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\ud83d\udc4d<\/p>\n<h2>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u30eb\u30fc\u30c8\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u884c\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\n\/\/ \u30de\u30eb\u30c1\u8a8d\u8a3c\r\n\/\/ \u30ed\u30b0\u30a4\u30f3\r\n<strong>Route::get('multi_login', [\\App\\Http\\Controllers\\MultiAuthController::class, 'showLoginForm']);<\/strong>\r\n<strong>Route::post('multi_login', [\\App\\Http\\Controllers\\MultiAuthController::class, 'login']);<\/strong>\r\n\r\n\/\/ \u30ed\u30b0\u30a2\u30a6\u30c8\r\n<strong>Route::get('multi_login\/logout', [\\App\\Http\\Controllers\\MultiAuthController::class, 'logout']);<\/strong>\r\n\r\n\/\/ \u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30da\u30fc\u30b8\r\n<strong>Route::prefix('comedians')-&gt;middleware('auth:comedians')-&gt;group(function(){<\/strong>\r\n\r\n<strong> Route::get('dashboard', function(){ return '\u82b8\u4eba\u3067\u30ed\u30b0\u30a4\u30f3\u5b8c\u4e86'; });<\/strong>\r\n\r\n<strong>});<\/strong>\r\n<strong>Route::prefix('musicians')-&gt;middleware('auth:musicians')-&gt;group(function(){<\/strong>\r\n\r\n<strong> Route::get('dashboard', function(){ return '\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u3067\u30ed\u30b0\u30a4\u30f3\u5b8c\u4e86'; });<\/strong>\r\n\r\n<strong>});<\/strong>\r\n<strong>Route::prefix('athletes')-&gt;middleware('auth:athletes')-&gt;group(function(){<\/strong>\r\n\r\n<strong> Route::get('dashboard', function(){ return '\u30a2\u30b9\u30ea\u30fc\u30c8\u3067\u30ed\u30b0\u30a4\u30f3\u5b8c\u4e86'; });<\/strong>\r\n\r\n<strong>});<\/strong><\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306e<code>auth<\/code>\u306f<code>:<\/code>\u306b\u7d9a\u3051\u3066\u30b3\u30f3\u30d5\u30a3\u30b0\u3067\u8a2d\u5b9a\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u540d\u3092\u66f8\u304f\u3068\u3001\u81ea\u52d5\u7684\u306b\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u5224\u5225\u3057\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u3068\u304d\u306e\u5f37\u5236\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u73fe\u6642\u70b9\u3067\u3082\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u304c\u52b9\u3044\u3066\u3044\u308b\u306e\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u306e\u306b\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u5f37\u5236\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u305f\u3060\u3001\u79fb\u52d5\u5148\u304c\u901a\u5e38\u306e\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Middleware\/Authenticate.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Middleware;\r\n\r\nuse Illuminate\\Auth\\Middleware\\Authenticate as Middleware;\r\n<strong>use Illuminate\\Support\\Str;<\/strong>\r\n\r\nclass Authenticate extends Middleware\r\n{\r\n    protected function redirectTo($request)\r\n    {\r\n        if (! $request-&gt;expectsJson()) {\r\n\r\n            <strong>$uri = $request-&gt;path();<\/strong>\r\n\r\n            \/\/ URI\u304c\u4ee5\u4e0b\uff13\u3064\u304b\u3089\u59cb\u307e\u308b\u5834\u5408\r\n<strong>            if(Str::startsWith($uri, ['comedians\/', 'musicians\/', 'athletes\/'])) {<\/strong>\r\n\r\n<strong>                return 'multi_login';<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n            return route('login');\r\n        }\r\n    }\r\n}<\/pre>\n<p>\u3053\u308c\u3067\u5168\u3066\u5b8c\u4e86\u3067\u3059\uff01<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u307e\u305a\u306f\u3001\u79c1\u306e\u5927\u597d\u304d\u306a\u82b8\u4eba\u3055\u3093\u306e\u300c<strong>\u660e\u77f3\u5bb6\u3055\u3093\u307e<\/strong>\u300d\u3055\u3093\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u3059\u3002<\/p>\n<p>\u300c<strong>http:\/\/******\/multi_login<\/strong>\u300d\u306b\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3001\u305d\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u30bf\u30a4\u30d7\u3092\u300c\u82b8\u4eba\u300d\u306b\u3057\u3066\u9001\u4fe1\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8178\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_7.png\" alt=\"\" width=\"292\" height=\"281\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8179\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_8.png\" alt=\"\" width=\"167\" height=\"43\" \/><\/p>\n<p>\u3046\u307e\u304f\u30ed\u30b0\u30a4\u30f3\u304c\u3067\u304d\u307e\u3057\u305f\ud83d\udc4d<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\uff08\u5b9f\u969b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\uff09\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u306e\u30da\u30fc\u30b8\u300c<strong>http:\/\/******\/musicians\/dashboard<\/strong>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8180\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_9.png\" alt=\"\" width=\"389\" height=\"129\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_9.png 389w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_9-300x99.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8181\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_10.png\" alt=\"\" width=\"295\" height=\"285\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u30df\u30e5\u30fc\u30b8\u30b7\u30e3\u30f3\u3068\u3057\u3066\u306f\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u5f37\u5236\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u6700\u5f8c\u306b\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff06\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u6b63\u3057\u3044\u3051\u308c\u3069\u3001<strong>\u30e6\u30fc\u30b6\u30fc\u30bf\u30a4\u30d7\u3092\u308f\u3056\u3068\u9593\u9055\u3048\u3066<\/strong>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8182\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_11.png\" alt=\"\" width=\"301\" height=\"284\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8183\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_12.png\" alt=\"\" width=\"299\" height=\"343\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_12.png 299w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/10\/laravel_multi_auth_12-262x300.png 262w\" sizes=\"auto, (max-width: 299px) 100vw, 299px\" \/><\/p>\n<p>\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u5185\u5bb9\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=8185&amp;tmstv=1777342393\" rel=\"nofollow\" id=\"download-link-8185\" data-redirect=\"false\" >\n\t\u3010Laravel Jetstream\u3011\u8907\u6570\u30e2\u30c7\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/a>\n\n<p>\u203b\u305f\u3060\u3057\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306a\u3069\u306f\u3054\u81ea\u8eab\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f<code>Laravel 8.x<\/code>\u306e\u30ed\u30b0\u30a4\u30f3\u30d1\u30c3\u30b1\u30fc\u30b8<code>Jetstream<\/code>\u3092\u4f7f\u3063\u3066\u30de\u30eb\u30c1\u8a8d\u8a3c\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3053\u308d\u3069\u3053\u308d<code>Laravel 8.x<\/code>\u306e\u66f8\u304d\u65b9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u6839\u672c\u306f\u3053\u308c\u307e\u3067\u3068\u540c\u3058\u3067\u3059\u306e\u3067\u5fdc\u7528\u3059\u308c\u3070\u904e\u53bb\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3082\u53c2\u8003\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u5192\u982d\u3067\u66f8\u3044\u305f<code>role<\/code>\u3092\u4f7f\u3063\u305f\u30ed\u30b0\u30a4\u30f3\u306f\u4ee5\u4e0b\u306eURL\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\ud83d\udcdd\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=420\">\u30b7\u30f3\u30d7\u30eb\uff01Laravel5.6\u3067\u300c\u6a29\u9650\u3064\u304d\u300d\u30ed\u30b0\u30a4\u30f3\u3055\u305b\u308b\u65b9\u6cd5<\/a><\/p>\n<p>\u3069\u3061\u3089\u304b\u3068\u8a00\u3048\u3070\u3001\u79c1\u306f\u3053\u3061\u3089\u306e\u65b9\u304c\u597d\u304d\u3067\u3059\u304c\u958b\u767a\u3059\u308b\u5185\u5bb9\u306b\u3088\u3063\u3066\u306f\u4f7f\u3044\u5206\u3051\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6068\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png\" alt=\"\" width=\"226\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png 226w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12-212x300.png 212w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/><br \/>\n\u300c\u96fb\u5b50\u30ec\u30f3\u30b8\u3067\u30d1\u30b9\u30bf\u304c<br \/>\n\u8339\u3067\u3089\u308c\u308b\u3063\u3066\u611f\u52d5\u3067\u3059\u306d\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel 8.x\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3057\u3070\u3089\u304f\u7d4c\u3061\u307e\u3057\u305f\u304c\u3001\u3084\u306f\u308a\u9a5a\u304d\u3068\u3068\u3082\u306b\u8fce\u3048\u3089\u308c\u305f\u306e\u304c\u30ed\u30b0\u30a4\u30f3\u30d1\u30c3\u30b1\u30fc\u30b8Jetstream\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=8159\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel Jetstream\u3011\u8907\u6570\u30e2\u30c7\u30eb\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\uff08Multi Auth\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":8191,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,97],"tags":[],"class_list":["post-8159","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-97"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8159"}],"version-history":[{"count":10,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8159\/revisions"}],"predecessor-version":[{"id":8192,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/8159\/revisions\/8192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/8191"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}