{"id":361,"date":"2023-02-27T21:31:25","date_gmt":"2023-02-27T12:31:25","guid":{"rendered":"https:\/\/software.satoshis.jp\/?p=361"},"modified":"2023-04-11T14:13:59","modified_gmt":"2023-04-11T05:13:59","slug":"laravel%e3%81%a7%e3%82%bb%e3%83%83%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%bf%e3%82%a4%e3%83%a0%e3%82%a2%e3%82%a6%e3%83%88%e5%be%8c%e3%81%ae%e3%83%ad%e3%82%b0%e3%82%a2%e3%82%a6%e3%83%88%e3%81%a7419%e3%82%a8","status":"publish","type":"post","link":"https:\/\/software.satoshis.jp\/?p=361","title":{"rendered":"Laravel\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u5f8c\u306e\u30ed\u30b0\u30a2\u30a6\u30c8\u3067419\u30a8\u30e9\u30fc\u3092\u51fa\u3055\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p> Laravel\u3067\u30e6\u30fc\u30b6\u30fc\u304c\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u653e\u7f6e\u3055\u308c\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u5f8c\u306b\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001419\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p> \u3053\u306e\u4fee\u6b63\u65b9\u6cd5\u3092\u3050\u3050\u3063\u3066\u307f\u305f\u3089\u3001\u3042\u3061\u3053\u3061\u3067\u3001app\\Exceptions\\Hander.php \u3092\u4fee\u6b63\u3059\u308c\u3070\u3044\u3044\u3088\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n    public function render($request, Throwable $exception)\r\n    {\r\n        if ($exception instanceof Illuminate\\Session\\TokenMismatchException) {\r\n            return redirect()-&gt;route(&#039;login&#039;);\r\n        }\r\n        return parent::render($request, $exception);\r\n    }\r\n<\/pre>\n<p> \u78ba\u304b\u306b\u3001\u3053\u306e\u3088\u3046\u306b\u66f8\u3051\u3070\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n<p> \u3068\u308a\u3042\u3048\u305a\u671f\u5f85\u901a\u308a\u306b\u52d5\u3044\u3066\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u56f0\u3089\u306a\u3044\u3067\u3059\u304b\uff1f<\/p>\n<p> TokenMismatchException \u304c\u767a\u751f\u3057\u305f\u3068\u304d\u3001\u3059\u3079\u3066\u304c\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p> \u5358\u7d14\u306b @csrf \u3092\u66f8\u304d\u5fd8\u308c\u305f\u3068\u3057\u3066\u3082\u3001\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p> \u3053\u306e\u5909\u66f4\u3092\u77e5\u3089\u306a\u3044\u4eba\u306b\u3068\u3063\u3066\u306f\u3001\u8b0e\u306e\u6319\u52d5\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p> \u30a2\u30af\u30bb\u30b9\u3057\u305fURL\u304c\u30ed\u30b0\u30a2\u30a6\u30c8\u306eURL\u3060\u3063\u305f\u5834\u5408\u3060\u3051\u3001\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u3051\u3070\u3001\u8b0e\u306e\u6319\u52d5\u306b\u56f0\u308b\u3053\u3068\u304c\u306a\u304f\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n    public function render($request, Throwable $e) {\r\n        if ($e instanceof Illuminate\\Session\\TokenMismatchException) {\r\n            if (url()-&gt;current() == route(&#039;logout&#039;)) {\r\n                return redirect()-&gt;route(&#039;login&#039;);\r\n            }\r\n        }\r\n        return parent::render($request, $e);\r\n    }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Laravel\u3067\u30e6\u30fc\u30b6\u30fc\u304c\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u653e\u7f6e\u3055\u308c\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u5f8c\u306b\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001419\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002 \u3053\u306e\u4fee\u6b63\u65b9\u6cd5\u3092\u3050\u3050\u3063\u3066\u307f\u305f\u3089\u3001\u3042\u3061\u3053\u3061\u3067\u3001app\\Exce &#8230; <\/p>\n","protected":false},"author":1,"featured_media":63,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[141,14,142,143],"class_list":["post-361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-141","tag-laravel","tag-142","tag-143"],"nelio_content":{"autoShareEndMode":"never","automationSources":{"useCustomSentences":false,"customSentences":[]},"efiAlt":"","efiUrl":"","followers":[1],"highlights":[],"isAutoShareEnabled":true,"networkImageIds":[],"permalinkQueryArgs":[],"series":[],"suggestedReferences":[]},"views":8139,"_links":{"self":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=361"}],"version-history":[{"count":1,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/361\/revisions\/362"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/media\/63"}],"wp:attachment":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}