{"id":6064,"date":"2020-03-09T17:54:16","date_gmt":"2020-03-09T08:54:16","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=6064"},"modified":"2020-03-09T17:54:16","modified_gmt":"2020-03-09T08:54:16","slug":"laravel-7-x%e3%81%ae%e6%96%b0%e3%81%97%e3%81%84%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0stub%ef%bc%88%e9%9b%9b%e5%bd%a2%ef%bc%89%e6%a9%9f%e8%83%bd%ef%bc%81%e5%ae%9f%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=6064","title":{"rendered":"Laravel 7.x\u306e\u65b0\u3057\u3044\u30ab\u30b9\u30bf\u30e0stub\uff08\u96db\u5f62\uff09\u6a5f\u80fd\uff01\u5b9f\u4f8b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u3053\u6570\u56de\u304a\u5c4a\u3051\u3057\u3066\u3044\u308bLaravel 7.x\u306e\u65b0\u6a5f\u80fd\u3067\u3059\u304c\u3001\u5c0f\u3055\u306a\u3082\u306e\u3092\u542b\u3081\u308b\u3068\u307e\u3060\u307e\u3060\u4fbf\u5229\u306a\u3082\u306e\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u3093\u306a\u4e2d\u304b\u3089\u300c<strong>\u3053\u308c\u306f\u3044\u3044\uff01<\/strong>\u300d\u3068\u601d\u3063\u305f\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u30ab\u30b9\u30bf\u30e0stub\uff08\u96db\u5f62\uff09\u6a5f\u80fd<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001<code>stub<\/code>\u3068\u306f\u4f55\u304b\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u6b21\u306e\u3088\u3046\u306a<code>artisan<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u3092\u30a4\u30e1\u30fc\u30b8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:model Post<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a<code>Model<\/code>\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3088\u306d\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Post extends Model\r\n{\r\n    \/\/\r\n}<\/pre>\n<p>\u3053\u308c\u306f\u5143\u3005\u3069\u3053\u304b\u3089\u6765\u3066\u3044\u308b\u304b\u3068\u3044\u3046\u3068\u3001<\/p>\n<p><code>\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Console\/stubs\/model.stub<\/code><\/p>\n<p>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3067\u3001\u4e2d\u8eab\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace {{ namespace }};\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass {{ class }} extends Model\r\n{\r\n    \/\/\r\n}<\/pre>\n<p>\u3064\u307e\u308a\u3001\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3055\u308c\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u3082\u3068\u306b\u306a\u308b\u3082\u306e\u304c\u300c<strong>stub<\/strong>\u300d\u3068\u547c\u3070\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067<strong>stub\u3092\u81ea\u5206\u7528\u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/strong>\u3068\u3044\u3046\u6a5f\u80fd\u304c\u8ffd\u52a0\u306b\u306a\u3063\u305f\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3053\u306e\u30ab\u30b9\u30bf\u30e0<code>stub<\/code>\u3092\u4f5c\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\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<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6067 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_19.png\" alt=\"\" width=\"314\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_19.png 314w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_19-294x300.png 294w\" sizes=\"auto, (max-width: 314px) 100vw, 314px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 7.x<\/p>\n<h1>\u30ab\u30b9\u30bf\u30e0 stub \u306e\u4f7f\u3044\u65b9<\/h1>\n<p>\u307e\u305a\u3001\u65b0\u3057\u304f\u8ffd\u52a0\u3055\u308c\u305f<code>stub:publish<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan stub:publish<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>stubs<\/code>\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u304c\u4f5c\u6210\u3055\u308c\u3001\u4e2d\u306b<code>stub<\/code>\u30d5\u30a1\u30a4\u30eb\u304c\u8a2d\u7f6e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6078\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/laravel_new_custom_stub_1.png\" alt=\"\" width=\"285\" height=\"674\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/laravel_new_custom_stub_1.png 285w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/laravel_new_custom_stub_1-127x300.png 127w\" sizes=\"auto, (max-width: 285px) 100vw, 285px\" \/><\/p>\n<p>\u5f8c\u306f\u3001\u3053\u306e<code>stub<\/code>\u3092\u597d\u304d\u306b\u5909\u66f4\u3059\u308c\u3070<code>artisan make:*****<\/code>\u3067\u4f5c\u6210\u3055\u308c\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u9069\u7528\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u3069\u3093\u306a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u8003\u3048\u3089\u308c\u308b\u304b\uff1f<\/h1>\n<p>\u30ab\u30b9\u30bf\u30e0<code>stub<\/code>\u306f\u3001\u4fbf\u5229\u3067\u3059\u304c\u30b7\u30f3\u30d7\u30eb\u306a\u6a5f\u80fd\u306a\u306e\u3067\u4f7f\u3044\u65b9\u306f\u3053\u3053\u307e\u3067\u3067\u304a\u3057\u307e\u3044\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u305d\u308c\u3060\u3051\u3067\u306f\u8a18\u4e8b\u3068\u3057\u3066\u306f\u9762\u767d\u304f\u306a\u3044\u306e\u3067\u3053\u3053\u304b\u3089\u306f\u300c<strong>\u3069\u3093\u306a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u8003\u3048\u3089\u308c\u308b\u304b\uff1f<\/strong>\u300d\u3068\u3044\u3046\u30c6\u30fc\u30de\u3067\u3044\u304f\u3064\u304b\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u53c2\u8003\u306b\u306a\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\u3002<\/p>\n<h1>\u30e2\u30c7\u30eb\u7de8<\/h1>\n<h3>MassAssignmentException\u5bfe\u7b56<\/h3>\n<p>Laravel\u3067DB\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u306b\u305f\u307e\u306b\u906d\u9047\u3059\u308b\u306e\u304c<code>MassAssignmentException<\/code>\u3067\u3059\u304c\u3001\u3053\u308c\u306f\u30e2\u30c7\u30eb\u306b\u3001<\/p>\n<ul>\n<li>\u3069\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u5b88\u308b\u304b<\/li>\n<li>\u3082\u3057\u304f\u306f\u3001\u3069\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u66f8\u304d\u8fbc\u307f\u3092\u8a31\u53ef\u3059\u308b\u304b<\/li>\n<\/ul>\n<p>\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u89e3\u6c7a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u308c\u3092\u898b\u8d8a\u3057\u305f<code>stub<\/code>\u304c\u3053\u3061\u3089\u3067\u3059\u3002\uff08<code>id<\/code>\u3092\u66f8\u304d\u8fbc\u307f\u4e0d\u53ef\u306b\u3059\u308b\u3053\u3068\u304c\u5927\u591a\u6570\u3060\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3053\u308c\u3067\u3082\u3044\u3044\u3088\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u306d\ud83d\ude0a\uff09<\/p>\n<pre>&lt;?php\r\n\r\nnamespace {{ namespace }};\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass {{ class }} extends Model\r\n{\r\n    <strong>protected $guarded = ['id'];<\/strong>\r\n}<\/pre>\n<h3>\u5404\u30d6\u30ed\u30c3\u30af\u306b\u8aac\u660e\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p><code>Laravel<\/code>\u306e\u30e2\u30c7\u30eb\u306f\u591a\u6570\u306e\u6a5f\u80fd\u3092\u5099\u3048\u3066\u3044\u308b\u306e\u3067\u3001\u3068\u304d\u306b\u306f\u305f\u304f\u3055\u3093\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3067\u66f8\u304d\u8fbc\u3080\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u30b3\u30fc\u30c9\u91cf\u304c\u5897\u3048\u308b\u3068\u3055\u3059\u304c\u306b\u4fdd\u5b88\u7ba1\u7406\u3057\u306b\u304f\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u305b\u3081\u3066\u6a5f\u80fd\u3054\u3068\u306b\u30d6\u30ed\u30c3\u30af\u5206\u3051\u3057\u3066\u8a18\u8ff0\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3093\u306a\u3068\u304d\u306b\u5f79\u7acb\u3064<code>stub<\/code>\u3067\u3059\u3002\uff08\u5171\u540c\u3067\u4f5c\u696d\u3059\u308b\u5834\u5408\u306b\u66f8\u304f\u5834\u6240\u304c\u5171\u901a\u306b\u306a\u3063\u3066\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff09<\/p>\n<pre>&lt;?php\r\n\r\nnamespace {{ namespace }};\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass {{ class }} extends Model\r\n{\r\n    <strong>\/\/ \u30b3\u30f3\u30d5\u30a3\u30b0<\/strong>\r\n\r\n<strong>    \/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u30fb\u30b9\u30b3\u30fc\u30d7<\/strong>\r\n\r\n<strong>    \/\/ \u30ea\u30ec\u30fc\u30b7\u30e7\u30f3<\/strong>\r\n\r\n<strong>    \/\/ Accessor<\/strong>\r\n\r\n<strong>    \/\/ Mutator<\/strong>\r\n\r\n<strong>    \/\/ \u30ed\u30fc\u30ab\u30eb\u30fb\u30b9\u30b3\u30fc\u30d7<\/strong>\r\n\r\n<strong>    \/\/ \u305d\u306e\u4ed6<\/strong>\r\n}<\/pre>\n<h3>Laravel\u958b\u767a\u30fb\u30d3\u30ae\u30ca\u30fc\u7528stub<\/h3>\n<p>\u3082\u3057\u304f\u306f\u3001\u958b\u767a\u8005\u306e\u4e2d\u306b<code>Laravel<\/code>\u306e\u30d3\u30ae\u30ca\u30fc\u304c\u3044\u308b\u5834\u5408\u306f\u6b21\u306e\u3088\u3046\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<code>URL<\/code>\u3092\u8ffd\u52a0\u3057\u3066\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace {{ namespace }};\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass {{ class }} extends Model\r\n{\r\n    <strong>\/*<\/strong>\r\n<strong>    * \u30b3\u30f3\u30d5\u30a3\u30b0<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent#eloquent-model-conventions<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * \u30b0\u30ed\u30fc\u30d0\u30eb\u30fb\u30b9\u30b3\u30fc\u30d7<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent#global-scopes<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * \u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u30b7\u30c3\u30d7<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent-relationships<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * Accessor<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent-mutators#defining-an-accessor<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * Mutator<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent-mutators#defining-a-mutator<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * \u30ed\u30fc\u30ab\u30eb\u30fb\u30b9\u30b3\u30fc\u30d7<\/strong>\r\n<strong>    * https:\/\/laravel.com\/docs\/7.x\/eloquent#local-scopes<\/strong>\r\n<strong>    *\/<\/strong>\r\n\r\n<strong>    \/*<\/strong>\r\n<strong>    * \u305d\u306e\u4ed6<\/strong>\r\n<strong>    * https:\/\/laravel.com\/<\/strong>\r\n<strong>    *\/<\/strong>\r\n}<\/pre>\n<h2>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u7de8<\/h2>\n<h3>\u4f7f\u3046\u983b\u5ea6\u304c\u9ad8\u3044\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304f<\/h3>\n<p>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u304d\u306b\u3088\u304f\u4f7f\u3046\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u3063\u3066\u304a\u3051\u3070\u3001\u30b3\u30d4\u30fc\u3059\u308b\u3060\u3051\u3067\u4f7f\u3048\u307e\u3059\u3057\u3001\u4e0d\u8981\u306a\u3089\u7c21\u5358\u306b\u524a\u9664\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nuse Illuminate\\Database\\Migrations\\Migration;\r\nuse Illuminate\\Database\\Schema\\Blueprint;\r\nuse Illuminate\\Support\\Facades\\Schema;\r\n\r\nclass {{ class }} extends Migration\r\n{\r\n    \/**\r\n     * Run the migrations.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function up()\r\n    {\r\n        Schema::create('{{ table }}', function (Blueprint $table) {\r\n            $table-&gt;id();\r\n<strong>\/\/            $table-&gt;string('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;text('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;integer('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;boolean('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;date('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;dateTime('*****');<\/strong>\r\n<strong>\/\/            $table-&gt;time('*****');<\/strong>\r\n            $table-&gt;timestamps();\r\n        });\r\n    }\r\n\r\n    \/**\r\n     * Reverse the migrations.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function down()\r\n    {\r\n        Schema::dropIfExists('{{ table }}');\r\n    }\r\n}<\/pre>\n<h3>\u4f7f\u3046\u983b\u5ea6\u304c\u9ad8\u3044\u305d\u306e\u4ed6\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304f<\/h3>\n<p>\u79c1\u306e\u5834\u5408\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u66f8\u304f\u6642\u3001\u7279\u306b\u300c\u5916\u90e8\u30ad\u30fc\u300d\u306e\u66f8\u304d\u65b9\u3092\u5fd8\u308c\u3066\u3057\u307e\u3044\u304c\u3061\u306a\u306e\u3067\u3001\u305d\u308c\u306b\u52a0\u3048\u3066\u3001\u4f7f\u3046\u983b\u5ea6\u304c\u9ad8\u3044\u30b3\u30fc\u30c9\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u5148\u306b\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre>&lt;?php\r\n\r\nuse Illuminate\\Database\\Migrations\\Migration;\r\nuse Illuminate\\Database\\Schema\\Blueprint;\r\nuse Illuminate\\Support\\Facades\\Schema;\r\n\r\nclass {{ class }} extends Migration\r\n{\r\n    \/**\r\n     * Run the migrations.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function up()\r\n    {\r\n        Schema::create('{{ table }}', function (Blueprint $table) {\r\n            $table-&gt;id();\r\n            $table-&gt;timestamps();\r\n\r\n<strong>\/\/            $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');<\/strong>\r\n<strong>\/\/            $table-&gt;index('user_id');<\/strong>\r\n<strong>\/\/            $table-&gt;unique('email');<\/strong>\r\n        });\r\n    }\r\n\r\n    \/**\r\n     * Reverse the migrations.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function down()\r\n    {\r\n        Schema::dropIfExists('{{ table }}');\r\n    }\r\n}<\/pre>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u7de8<\/h2>\n<h2>\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f<\/h2>\n<p>\u500b\u4eba\u7684\u306b\u306f\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306f\u30eb\u30fc\u30c8\u3067\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3059\u304c\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u8a2d\u5b9a\u3057\u305f\u3044\u65b9\u306f\u4ee5\u4e0b\u306e<code>stub<\/code>\u304c\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace {{ namespace }};\r\n\r\nuse {{ rootNamespace }}Http\\Controllers\\Controller;\r\nuse Illuminate\\Http\\Request;\r\n\r\nclass {{ class }} extends Controller\r\n{\r\n    public function __construct()\r\n    {\r\n        <strong>$this-&gt;middleware('auth');<\/strong>\r\n<strong>\/\/        $this-&gt;middleware('log')-&gt;only('index');<\/strong>\r\n<strong>\/\/        $this-&gt;middleware('subscribed')-&gt;except('store');<\/strong>\r\n    }\r\n}<\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel 7.x<\/code>\u3067\u65b0\u3057\u304f\u8ffd\u52a0\u3055\u308c\u305f\u300c<strong>\u30ab\u30b9\u30bf\u30e0stub<\/strong>\u300d\u6a5f\u80fd\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u304a\u305d\u3089\u304f\u3001\u958b\u767a\u74b0\u5883\u3084\u30c1\u30fc\u30e0\u5185\u3067\u500b\u3005\u306b\u8a18\u8ff0\u306e\u30eb\u30fc\u30eb\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067<code>stub<\/code>\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u3067\u3082\u5bfe\u5fdc\u304c\u3067\u304d\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6069 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20.png\" alt=\"\" width=\"326\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20.png 326w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_20-300x294.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u3053\u6570\u56de\u304a\u5c4a\u3051\u3057\u3066\u3044\u308bLaravel 7.x\u306e\u65b0\u6a5f\u80fd\u3067\u3059\u304c\u3001\u5c0f\u3055\u306a\u3082\u306e\u3092\u542b\u3081\u308b\u3068\u307e\u3060\u307e\u3060\u4fbf\u5229\u306a\u3082\u306e\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002 \u305d\u3057\u3066\u3001\u305d\u3093\u306a\u4e2d\u304b\u3089\u300c\u3053\u308c\u306f\u3044\u3044 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=6064\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel 7.x\u306e\u65b0\u3057\u3044\u30ab\u30b9\u30bf\u30e0stub\uff08\u96db\u5f62\uff09\u6a5f\u80fd\uff01\u5b9f\u4f8b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6081,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6064","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6064","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=6064"}],"version-history":[{"count":7,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6064\/revisions"}],"predecessor-version":[{"id":6082,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6064\/revisions\/6082"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/6081"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}