{"id":4128,"date":"2019-07-15T00:51:19","date_gmt":"2019-07-14T15:51:19","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4128"},"modified":"2019-07-15T00:51:19","modified_gmt":"2019-07-14T15:51:19","slug":"laravel%e3%81%a7%e9%9d%99%e7%9a%84html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e9%ab%98%e9%80%9f%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4128","title":{"rendered":"Laravel\u3067\u9759\u7684HTML\u30da\u30fc\u30b8\u3092\u4f5c\u3063\u3066\u9ad8\u901f\u8868\u793a\u3055\u305b\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001<code>Laravel<\/code>\u3084<code>PHP<\/code>\u306b\u9650\u3089\u305a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3068\u304d\u306b\u306f\u3044\u3064\u3082<strong>\u300c\u8868\u793a\u901f\u5ea6\u300d<\/strong>\u304c\u30c6\u30fc\u30de\u306e\u3072\u3068\u3064\u3068\u3057\u3066\u3064\u3044\u3066\u307e\u308f\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u6700\u8fd1\u306f\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067\u3082\u30d6\u30ed\u30fc\u30c9\u30d0\u30f3\u30c9\u5316\u3057\u3066\u307e\u3059\u3057\u3001\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3084\u30c7\u30d0\u30a4\u30b9\u304c\u9ad8\u6027\u80fd\u306b\u306a\u3063\u305f\u3053\u3068\u3082\u3042\u3063\u3066\u3001\u6614\u307b\u3069\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306e\u8868\u793a\u304c\u9045\u304f\u611f\u3058\u3089\u308c\u308b\u3053\u3068\u306f\u5c11\u306a\u304f\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u3084\u306f\u308a\u9ad8\u901f\u8868\u793a\u3068\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u591a\u6a5f\u80fd\u5316\u306f\u76f8\u5bb9\u308c\u306a\u3044\u95a2\u4fc2\u306b\u3042\u308b\u306e\u3082\u4e8b\u5b9f\u3067\u3001<code>Laravel<\/code>\u306e\u30d0\u30fc\u30b8\u30e7\u30f35\u304c\u516c\u958b\u3055\u308c\u305f\u3068\u304d\u306f\u300c4.2\u3088\u308a\u8868\u793a\u901f\u5ea6\u304c\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\ud83d\ude2b\u300d\u3068\u3044\u3046\u3088\u3046\u306a\u8a55\u4fa1\u304c\u3042\u3063\u305f\u308a\u3082\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Laravel\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3<code>Blade<\/code>\u306f\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308b\u305f\u3073\u306b<code>\/storage\/framework\/views<\/code>\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f5c\u6210\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u3088\u308a\u9ad8\u901f\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u3067\u3082PHP\u30b3\u30fc\u30c9\u304c\u4e2d\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u72b6\u614b\u3067\u3059\u306e\u3067\u3001\u3084\u306f\u308a\u9759\u7684\u306aHTML\u3068\u6bd4\u3079\u308b\u8868\u793a\u304c\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3088\u308a\u9ad8\u901f\u8868\u793a\u3092\u3081\u3056\u3059\u305f\u3081\u306b\u3001<code>Laravel<\/code> + <code>Blade<\/code>\u3067\u9759\u7684\u306aHTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u76f4\u63a5\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u9ad8\u901f\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\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-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>\n<h1>\u6e96\u5099\u3059\u308b<\/h1>\n<h2>\u5c02\u7528\u30d5\u30a9\u30eb\u30c0\u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u306f\u9759\u7684\u306aHTML\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u5834\u6240\u306f\u3001<code>\/public\/statics<\/code>\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4129\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_1.png\" alt=\"\" width=\"286\" height=\"110\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u306e\u307e\u307e\u3067\u306f\u30d5\u30a9\u30eb\u30c0\u306b\u66f8\u304d\u8fbc\u307f\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u306e\u3067<code>Laravel<\/code>\u304c\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u6a29\u9650\u3092\u3064\u3051\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>sudo chmod 707 statics -R<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u3001\u3053\u306e\u30d5\u30a9\u30eb\u30c0\u306bHTML\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u3068\u3001<code>https:\/\/example.com\/statics\/********.html<\/code>\u3067\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u9759\u7684HTML\u3092\u4f5c\u6210\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001<code>Laravel<\/code>\u5074\u3067\u9759\u7684HTML\u3092\u3064\u304f\u308b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001\u4eca\u56de\u306f\u30e6\u30fc\u30b6\u30fc\u306e\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u3092\u8868\u793a\u3059\u308b\u9759\u7684HTML\u4f5c\u6210\u306e\u30b5\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u306f\u30eb\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<code>routes\/web.php<\/code>\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>Route::get('generate_static\/{mode}', 'HomeController@generate_static');<\/strong><\/pre>\n<p>\u203b <code>mode<\/code>\u306f\u300c\u3069\u3053\u306e\u9759\u7684HTML\u3092\u4f5c\u6210\u3059\u308b\u304b\u300d\u3092\u533a\u5225\u3059\u308b\u6587\u5b57\u5217\uff08\u4f8b\u3048\u3070\u3001<code>user<\/code>\u3084<code>product<\/code>\u306a\u3069\uff09\u3092\u60f3\u5b9a\u3057\u305f\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u3066\u3001\u305d\u306e\u4ed6\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f<code>Request<\/code>\u3067\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u30d3\u30e5\u30fc\u3067\u3059\u3002<br \/>\n\u3068\u3044\u3063\u3066\u3082\u3001\u3053\u3053\u306f\u901a\u5e38\u306e<code>Blade<\/code>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u308b\u306e\u3068\u5168\u304f\u540c\u3058\u3067\u3059\u306e\u3067\u3001<code>\/resources\/views\/user\/profile.blade.php<\/code>\u3067\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n    &lt;ul&gt;\r\n        <strong>&lt;li&gt;\u540d\u524d: {{ $user-&gt;name }}&lt;\/li&gt;<\/strong>\r\n<strong>        &lt;li&gt;Email: {{ $user-&gt;email }}&lt;\/li&gt;<\/strong>\r\n<strong>        &lt;li&gt;\u767b\u9332\u65e5: {{ $user-&gt;created_at-&gt;format('Y\/m\/d') }}&lt;\/li&gt;<\/strong>\r\n    &lt;\/ul&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u4e2d\u8eab\u306f\u30b7\u30f3\u30d7\u30eb\u306b\u3001<\/p>\n<ul>\n<li>\u30e6\u30fc\u30b6\u30fc\u540d<\/li>\n<li>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9<\/li>\n<li>\u767b\u9332\u65e5<\/li>\n<\/ul>\n<p>\u306e\uff13\u3064\u3092\u8868\u793a\u3059\u308b\u3060\u3051\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30e2\u30c7\u30eb\u306b\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n<p>\u3069\u3053\u304b\u3089\u3067\u3082\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u308b\u306b\u3057\u3066\u304a\u304d\u305f\u3044\u306e\u3067\u3001\u4eca\u56de\u306f<code>User<\/code>\u30e2\u30c7\u30eb\u306e\u4e2d\u306b<code>generate_static()<\/code>\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass User extends Authenticatable\r\n{\r\n    \/\/ \u7701\u7565\r\n\r\n    \/\/ Accessor\r\n    <strong>public function getStaticUriAttribute() {<\/strong>\r\n\r\n<strong>        \/\/ \u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u306eURI<\/strong>\r\n<strong>        return '\/statics\/user_profile_'. $this-&gt;id .'.html';<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n    \/\/ Others\r\n    <strong>public function generate_static() {<\/strong>\r\n\r\n<strong>        \/\/ \u9759\u7684HTML\u306e\u30c7\u30fc\u30bf\u3092\u4f5c\u6210<\/strong>\r\n<strong>        $path = public_path($this-&gt;uri);<\/strong>\r\n<strong>        $html = view('user.profile')<\/strong>\r\n<strong>            -&gt;with('user', $this)<\/strong>\r\n<strong>            -&gt;render();\r\n        return file_put_contents($path, $html);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u307e\u305f\u3001<code>getStaticUriAttribute()<\/code>\u306f<code>$user-&gt;static_uri;<\/code>\u3068\u3059\u308b\u3060\u3051\u3067\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u306e<code>URI<\/code>\u3092\u53d6\u5f97\u3067\u304d\u308b<code>Accessor<\/code>\u3067\u3059\u3002<\/p>\n<h2>\u30a4\u30d9\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u524d\u9805\u76ee\u3067\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u30c7\u30fc\u30bf\u66f4\u65b0\u3084\u524a\u9664\u3092\u3059\u308b\u305f\u3073\u306b<code>generate_static()<\/code>\u3092\u5b9f\u884c\u3059\u308b\u306e\u306f\u3081\u3093\u3069\u3046\u3067\u3059\u3057\u3001\u3082\u3057\u304b\u3059\u308b\u3068\u5b9f\u884c\u3092\u5fd8\u308c\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\uff0f\u524a\u9664\u3055\u308c\u305f\u5834\u5408\u306f\u5fc5\u305a\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u7684\u306b\u64cd\u4f5c\u3059\u308b\u3088\u3046\u306b\u30a4\u30d9\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u66f4\u65b0\u3057\u305f\u3068\u304d<\/h3>\n<p>\u307e\u305a\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067<code>UserSaved<\/code>\u30a4\u30d9\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan make:event UserSaved<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>\/app\/Events\/UserSaved.php<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u5185\u5bb9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Events;\r\n\r\nuse App\\User;\r\nuse Illuminate\\Broadcasting\\Channel;\r\nuse Illuminate\\Queue\\SerializesModels;\r\nuse Illuminate\\Broadcasting\\PrivateChannel;\r\nuse Illuminate\\Broadcasting\\PresenceChannel;\r\nuse Illuminate\\Foundation\\Events\\Dispatchable;\r\nuse Illuminate\\Broadcasting\\InteractsWithSockets;\r\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\r\n\r\nclass <strong>UserSaved<\/strong>\r\n{\r\n    use Dispatchable, InteractsWithSockets, SerializesModels;\r\n\r\n<strong>    public function __construct(User $user)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $user-&gt;generate_static();<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n    \/\/ \u7701\u7565<\/pre>\n<p>\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u5148\u307b\u3069<code>User<\/code>\u30e2\u30c7\u30eb\u306b\u8ffd\u52a0\u3057\u305f<code>generate_static()<\/code>\u3092\u5b9f\u884c\u3057\u3066\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u524a\u9664\u3057\u305f\u3068\u304d<\/h3>\n<p>\u3067\u306f\u3001\u7d9a\u3044\u3066\u30c7\u30fc\u30bf\u524a\u9664\u3055\u308c\u305f\u3068\u304d\u306e\u30a4\u30d9\u30f3\u30c8<code>UserDeleted<\/code>\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:event UserDeleted<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001<code>\/app\/Events\/UserDeleted.php<\/code>\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Events;\r\n\r\nuse App\\User;\r\nuse Illuminate\\Broadcasting\\Channel;\r\nuse Illuminate\\Queue\\SerializesModels;\r\nuse Illuminate\\Broadcasting\\PrivateChannel;\r\nuse Illuminate\\Broadcasting\\PresenceChannel;\r\nuse Illuminate\\Foundation\\Events\\Dispatchable;\r\nuse Illuminate\\Broadcasting\\InteractsWithSockets;\r\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\r\n\r\nclass <strong>UserDeleted<\/strong>\r\n{\r\n    use Dispatchable, InteractsWithSockets, SerializesModels;\r\n\r\n    <strong>public function __construct(User $user)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $path = public_path($user-&gt;static_uri);<\/strong>\r\n<strong>        @unlink($path);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n    \/\/ \u7701\u7565<\/pre>\n<p>\u306a\u304a\u3001\u30a4\u30d9\u30f3\u30c8\u306f\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3060\u3051\u3067\u306f\u5b9f\u884c\u306f\u3055\u308c\u307e\u305b\u3093\u306e\u3067\u3001<code>User<\/code>\u30e2\u30c7\u30eb\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass User extends Authenticatable\r\n{\r\n    <strong>protected $dispatchesEvents = [<\/strong>\r\n<strong>        'saved' =&gt; UserSaved::class,<\/strong>\r\n<strong>        'deleted' =&gt; UserDeleted::class<\/strong>\r\n<strong>    ];<\/strong><\/pre>\n<p><span style=\"font-size: 1rem;\">\u3053\u308c\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u767b\u9332\u3055\u308c\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306bHTML\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4130\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_2.png\" alt=\"\" width=\"403\" height=\"138\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_2.png 403w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_2-300x103.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/p>\n<p>\u5b9f\u969b\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4131\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_3.png\" alt=\"\" width=\"577\" height=\"132\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_3.png 577w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/laravel_static_3-300x69.png 300w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\uff01<\/p>\n<h1>\u304a\u307e\u3051\uff1a\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u72ec\u81ea\u30b3\u30de\u30f3\u30c9\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3082\u3057\u304b\u3059\u308b\u3068\u3001\u4e00\u6c17\u306b\u4f5c\u6210\u3057\u305f\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3067\u3066\u304f\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3093\u306a\u3068\u304d\u306e\u305f\u3081\u306b\u3001\u304a\u307e\u3051\u3068\u3057\u3066\u5168\u3066\u306e\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u72ec\u81ea\u30b3\u30de\u30f3\u30c9\u306e\u4f5c\u308a\u65b9\u3092\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:command ClearStaticCommand<\/strong><\/pre>\n<p><code>\/app\/Console\/Commands\/ClearStaticCommand.php<\/code>\u3092\u958b\u3044\u3066\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Console\\Commands;\r\n\r\nuse Illuminate\\Console\\Command;\r\nuse League\\Flysystem\\Filesystem;\r\n\r\nclass ClearStaticCommand extends Command\r\n{\r\n    <strong>protected $signature = 'static:clear';<\/strong>\r\n<strong>    protected $description = 'Clear static files';<\/strong>\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    public function handle()\r\n    {\r\n        <strong>$files = glob(public_path('statics\/*'));<\/strong>\r\n\r\n<strong>        foreach($files as $file) {<\/strong>\r\n\r\n<strong>            if(is_file($file)) {<\/strong>\r\n\r\n<strong>                @unlink($file);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n    }\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u3001<code>app\/Console\/Kernel.php<\/code>\u5185\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u767b\u9332\u3059\u308b\u3068<code>php artisan static:clear<\/code>\u30b3\u30de\u30f3\u30c9\u304c\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\n\/\/ \u7701\u7565\r\n\r\nclass Kernel extends ConsoleKernel\r\n{\r\n<strong>    protected $commands = [<\/strong>\r\n<strong>        ClearStaticCommand::class<\/strong>\r\n<strong>    ];<\/strong><\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3067\u9759\u7684HTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u9ad8\u901f\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30a2\u30af\u30bb\u30b9\u6570\u304c\u975e\u5e38\u306b\u591a\u3044\u30b5\u30a4\u30c8\u3067\u3057\u305f\u3089\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u3068\u308b\u3088\u308a\u3082\u9ad8\u901f\u306a\u8868\u793a\u304c\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30fb\u30fb\u30fb\u3068\u306f\u3044\u3048\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u696d\u754c\u3082\u5e38\u306b\u9032\u6b69\u3057\u3066\u3044\u3066\u3001\u304b\u306d\u3066\u3088\u308a\u5b9f\u88c5\u304c\u671f\u5f85\u3055\u308c\u3066\u3044\u305f<strong>\u300cJIT\u30b3\u30f3\u30d1\u30a4\u30e9\u300d<\/strong>\u304cPHP 7.4\uff068\u306b\u5b9f\u88c5\u3055\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u66f4\u306bPHP\u306f\u9ad8\u901f\u8868\u793a\u304c\u53ef\u80fd\u306b\u306f\u306a\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3055\u3059\u304c\u306bHTML\u5358\u4f53\u3088\u308a\u65e9\u304f\u306f\u306a\u3089\u306a\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u79c1\u306e\u958b\u767a\u8005\u306e\u3072\u3068\u308a\u3068\u3057\u3066\u65e9\u304f\u8a66\u3057\u3066\u307f\u305f\u3044\u9650\u308a\u3067\u3059\u3002\uff08\u3055\u3059\u304c\u306b\u6b63\u5f0f\u7248\u306b\u306a\u3063\u3066\u304b\u3089\u3067\u3059\u304c\ud83d\ude0a\uff09<\/p>\n<p>\u307f\u306a\u3055\u3093\u3082\u305c\u3072\u30b5\u30a4\u30c8\u306e\u9ad8\u901f\u5316\u306b\u6ce8\u76ee\u3057\u305f\u958b\u767a\u3092\u9032\u3081\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-519 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21.png\" alt=\"\" width=\"192\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21.png 192w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21-180x300.png 180w\" sizes=\"auto, (max-width: 192px) 100vw, 192px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel\u3084PHP\u306b\u9650\u3089\u305a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3068\u304d\u306b\u306f\u3044\u3064\u3082\u300c\u8868\u793a\u901f\u5ea6\u300d\u304c\u30c6\u30fc\u30de\u306e\u3072\u3068\u3064\u3068\u3057\u3066\u3064\u3044\u3066\u307e\u308f\u308b\u3068\u601d\u3044\u307e\u3059\u3002 \u3082\u3061\u308d\u3093\u3001\u6700\u8fd1\u306f\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4128\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u3067\u9759\u7684HTML\u30da\u30fc\u30b8\u3092\u4f5c\u3063\u3066\u9ad8\u901f\u8868\u793a\u3055\u305b\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4135,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[161],"class_list":["post-4128","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-html"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4128","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=4128"}],"version-history":[{"count":4,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4128\/revisions"}],"predecessor-version":[{"id":4136,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4128\/revisions\/4136"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4135"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}