{"id":4385,"date":"2019-08-08T16:11:36","date_gmt":"2019-08-08T07:11:36","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4385"},"modified":"2019-08-08T16:11:36","modified_gmt":"2019-08-08T07:11:36","slug":"%e3%80%90laravel%e3%80%91%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e3%83%af%e3%83%bc%e3%82%afapi%e3%82%a6%e3%82%a7%e3%83%96%e3%83%95%e3%83%83%e3%82%af%e3%81%a7%e5%9c%a8%e5%ba%ab%e6%95%b0%e3%83%bb%e7%a2%ba","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4385","title":{"rendered":"\u3010Laravel\u3011\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30afAPI+\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3067\u5728\u5eab\u6570\u30fb\u78ba\u8a8d\u30dc\u30c3\u30c8\u3092\u3064\u304f\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u9593<a href=\"https:\/\/blog.capilano-fw.com\/?p=4285\">Laravel\u3067LINE\u306b\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u3064\u304f\u308b<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3067\u306f\u3001\u300c\u9001\u4fe1\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u3092QR\u30b3\u30fc\u30c9\u306b\u3057\u3066\u8fd4\u4fe1\u3059\u308b\u300d\u3068\u3044\u3046\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001LINE\u306f\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u7528\u3068\u3057\u3066\u9577\u5e74\u4f7f\u308f\u305b\u3066\u3082\u3089\u3063\u3066\u3044\u3066\u3001\u305d\u306e\u5f71\u97ff\u304b\u3089\u3001\u3053\u306e\u30d6\u30ed\u30b0\u3067\u4f7f\u3063\u3066\u3044\u308b\u30a4\u30e9\u30b9\u30c8\u306e<a href=\"https:\/\/store.line.me\/stickershop\/product\/4224594\" target=\"_blank\" rel=\"noopener noreferrer\">LINE\u30b9\u30bf\u30f3\u30d7<\/a>\u3092\u8ca9\u58f2\u3057\u3066\u3044\u305f\u308a\u3057\u307e\u3059\u3002\uff08\u5f8c\u767a\u3060\u3063\u305f\u3053\u3068\u3082\u3042\u308a\u3001\u307e\u3063\u305f\u304f\u58f2\u308c\u3066\u307e\u305b\u3093\u304c\u30fb\u30fb\u30fb\ud83d\ude05\uff09<\/p>\n<p>\u3067\u306f\u3001\u304a\u4ed5\u4e8b\u7528\u306f\u30fb\u30fb\u30fb\uff1f\uff1f\u3068\u3044\u3046\u3068\u3001\u30e1\u30a4\u30f3\u3067<a href=\"https:\/\/go.chatwork.com\/ja\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af<\/a>\u3092\u5229\u7528\u3055\u305b\u3066\u3082\u3089\u3063\u3066\u3044\u307e\u3059\u3002\u79c1\u304c<code>Linux<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u7406\u7531\u306b\u901a\u305a\u308b\u3068\u3053\u308d\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u300c\u5fc5\u8981\u6700\u4f4e\u9650\u3060\u3051\u300d\u3068\u3044\u3046\u3068\u3053\u308d\u304c\u3068\u3066\u3082\u6c17\u306b\u3044\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u524d\u8ff0\u3057\u305f<code>LINE\u30dc\u30c3\u30c8<\/code>\u3092\u4f5c\u6210\u3057\u305f\u3042\u3068\u3067\u3001\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u304c\u3042\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u30d0\u30c3\u30c1\u30ea\u5b58\u5728\u3057\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u4eca\u56de\u306f\u3061\u3087\u3063\u3068\u304a\u4ed5\u4e8b\u7528\u306b\u4f7f\u3048\u305d\u3046\u306a\u6a5f\u80fd\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001\u30ba\u30d0\u30ea\uff01<\/p>\n<p><strong style=\"font-size: 35px;\">\u55b6\u696d\u3055\u3093\u304c\u51fa\u5148\u3067\u5728\u5eab\u6570\u3092\u3059\u3050\u78ba\u8a8d\u3067\u304d\u308b<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u304d\u3063\u3068\u3001\u4eca\u56de\u306e\u8a18\u4e8b\u3092\u5fdc\u7528\u3059\u308c\u3070\u8272\u3005\u306a\u3053\u3068\u304c\u5b9f\u73fe\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<span style=\"font-size: 1rem;\">\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059<\/span>\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/p>\n<p>\u958b\u767a\u74b0\u5883\uff1a Laravel 5.8<\/p>\n<h1>\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<h2>\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u7528\u306e\u30c1\u30e3\u30c3\u30c8\u30eb\u30fc\u30e0\u3092\u3064\u304f\u308b<\/h2>\n<p>\u30e1\u30a4\u30f3\u306e\u30c1\u30e3\u30c3\u30c8\u30eb\u30fc\u30e0\u3092\u4f7f\u3063\u3066\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u306e\u30c6\u30b9\u30c8\u3067\u3059\u306e\u3067\u3001\u5c02\u7528\u306e\u30eb\u30fc\u30e0\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u753b\u9762\u5de6\u4e0a\u306b\u3042\u308b<strong>\u300c\uff0b\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002\u3059\u308b\u3068\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u305d\u306e\u4e2d\u306e<strong>\u300c\u30b0\u30eb\u30fc\u30d7\u30c1\u30e3\u30c3\u30c8\u3092\u65b0\u898f\u4f5c\u6210\u300d<\/strong>\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4393\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_6.png\" alt=\"\" width=\"412\" height=\"152\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_6.png 412w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_6-300x111.png 300w\" sizes=\"auto, (max-width: 412px) 100vw, 412px\" \/><\/p>\n<p>\u6b21\u306b\u30b0\u30eb\u30fc\u30d7\u30c1\u30e3\u30c3\u30c8\u306e\u5185\u5bb9\u3092\u5165\u529b\u3059\u308b\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u3066<strong>\u300c\u4f5c\u6210\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4392\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_7.png\" alt=\"\" width=\"620\" height=\"180\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_7.png 620w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_7-300x87.png 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/p>\n<p>\u3053\u308c\u3067\u65b0\u3057\u3044\u30b0\u30eb\u30fc\u30d7\u30c1\u30e3\u30c3\u30c8\u304c\u4f5c\u6210\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u3053\u306e\u4f5c\u6210\u3055\u308c\u305f\u30c1\u30e3\u30c3\u30c8\u30eb\u30fc\u30e0\u306eID\u304c\u3059\u3050\u5f8c\u3067\u5fc5\u8981\u306b\u306a\u308b\u306e\u3067\u3001\u53d6\u5f97\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002ID\u306fURL\u306b\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b<strong>\u300crid\u300d<\/strong>\u306e\u5f8c\u306b\u7d9a\u304f\u6570\u5b57\u3092\u30b3\u30d4\u30fc\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4391\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_8.png\" alt=\"\" width=\"309\" height=\"43\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_8.png 309w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_8-300x42.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/p>\n<h2>\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u767b\u9332\u3059\u308b<\/h2>\n<p>\u3067\u306f\u3001<a href=\"https:\/\/www.chatwork.com\/service\/packages\/chatwork\/subpackages\/webhook\/list.php\" target=\"_blank\" rel=\"noopener noreferrer\">Webhook\u306e\u767b\u9332\u30da\u30fc\u30b8<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u300c\u65b0\u898f\u4f5c\u6210\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4396\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_3.png\" alt=\"\" width=\"585\" height=\"175\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_3.png 585w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_3-300x90.png 300w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u306b\u95a2\u3059\u308b\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u3066<strong>\u300c\u4f5c\u6210\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\uff08\u203b \u3053\u3053\u3067\u5148\u307b\u3069\u306e\u30eb\u30fc\u30e0ID\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<p>\u203b \u306a\u304a\u3001<code>Webhook URL<\/code>\u306f\u3001<code>https:\/\/*******\/chatwork_bot\/stock<\/code>\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u9069\u5b9c\u30c9\u30e1\u30a4\u30f3\u90e8\u5206\u3092\u5909\u66f4\u3057\u3066\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4395\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_4.png\" alt=\"\" width=\"584\" height=\"440\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_4.png 584w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_4-300x226.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/p>\n<p>\u767b\u9332\u304c\u3067\u304d\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u5148\u307b\u3069\u306e\u30eb\u30fc\u30e0ID\u3068\u4e00\u7dd2\u306bLaravel\u306e<code>.env<\/code>\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4394\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_5.png\" alt=\"\" width=\"584\" height=\"294\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_5.png 584w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_5-300x151.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/p>\n<p><strong>\uff08.env\u306e\u4f8b\uff09<\/strong><\/p>\n<pre><strong>CHATWORK_WEBHOOK_ROOM_ID=\uff08\u5148\u307b\u3069\u8a2d\u5b9a\u3057\u305f\u30eb\u30fc\u30e0ID\uff09\r\nCHATWORK_WEBHOOK_TOKEN=\uff08\u3042\u306a\u305f\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u30fb\u30c8\u30fc\u30af\u30f3\uff09<\/strong><\/pre>\n<h1>\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30afAPI\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u306f\u53d7\u4fe1\u306e\u307f\u3067\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u3059\u308b\u306b\u306fAPI\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u306eAPI\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u30c8\u30fc\u30af\u30f3\u3082\u53d6\u5f97\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001<a href=\"https:\/\/www.chatwork.com\/service\/packages\/chatwork\/subpackages\/api\/token.php\">API Token\u306e\u30da\u30fc\u30b8<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<br \/>\n\u3059\u308b\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u306e\u3067\u5165\u529b\u3057\u3066\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4398\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_9.png\" alt=\"\" width=\"584\" height=\"141\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_9.png 584w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_9-300x72.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001API\u30c8\u30fc\u30af\u30f3\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u3053\u308c\u3082<code>Laravel<\/code>\u306e<code>.env<\/code>\u306b\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4399\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_10.png\" alt=\"\" width=\"588\" height=\"103\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_10.png 588w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_10-300x53.png 300w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/p>\n<pre><strong>CHATWORK_API_TOKEN=\uff08\u3042\u306a\u305f\u306eAPI\u30c8\u30fc\u30af\u30f3\uff09<\/strong><\/pre>\n<h1>Laravel\u5074\u306e\u4f5c\u696d<\/h1>\n<h2>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u306f\u3058\u3081\u306b<code>Chatwork<\/code>\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u304c\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u308bURL\u304c\u5fc5\u8981\u3067\u3059\u306e\u3067\u3001<code>routes\/web.php<\/code>\u306b\u4ee5\u4e0b\u306e\u30eb\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>Route::get('chatwork_bot\/stock', 'ChatworkBotController@stock');<\/strong><\/pre>\n<h2>\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h2>\n<p>\u6b21\u306b\u3001\u5546\u54c1\u30c7\u30fc\u30bf\u3092\u7ba1\u7406\u3059\u308b\u30e2\u30c7\u30eb<strong>\u300cProduct\u300d<\/strong>\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>php artisan make:model Product -m<\/strong><\/pre>\n<p><code>-m<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u3044\u308b\u3068\u3001\u30e2\u30c7\u30eb\u3060\u3051\u3067\u306a\u304f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3082\u4e00\u7dd2\u306b\u4f5c\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002<code>database\/migrations\/****_**_**_******.php<\/code>\u3092\u958b\u3044\u3066\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;?php\r\n\r\nuse Illuminate\\Support\\Facades\\Schema;\r\nuse Illuminate\\Database\\Schema\\Blueprint;\r\nuse Illuminate\\Database\\Migrations\\Migration;\r\n\r\nclass CreateProductsTable extends Migration\r\n{\r\n    public function up()\r\n    {\r\n        <strong>Schema::create('products', function (Blueprint $table) {\r\n            $table-&gt;bigIncrements('id');\r\n            $table-&gt;string('name');\r\n            $table-&gt;integer('stock')-&gt;default(0);\r\n            $table-&gt;timestamps();\r\n        });<\/strong>\r\n    }\r\n\r\n    public function down()\r\n    {\r\n        Schema::dropIfExists('products');\r\n    }\r\n}<\/pre>\n<p>\u5909\u66f4\u304c\u7d42\u308f\u3063\u305f\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u5b9f\u884c\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-4387\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_1.png\" alt=\"\" width=\"351\" height=\"274\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_1.png 351w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_1-300x234.png 300w\" sizes=\"auto, (max-width: 351px) 100vw, 351px\" \/><\/p>\n<h2>Seeder\u3067\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u3064\u304f\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u4f5c\u3063\u3066<code>products<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:seed ProductsTableSeeder<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>database\/seeds\/ProductsTableSeeder.php<\/code>\u3068\u3044\u3046\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<pre><strong>&lt;?php\r\n\r\nuse Illuminate\\Database\\Seeder;\r\n\r\nclass ProductsTableSeeder 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        $products = [\r\n            ['code' =&gt; 'CUV001', 'name' =&gt; '\u304b\u3089\u3060\u3088\u308d\u3053\u3076\u7c89\u30c1\u30fc\u30ba'],\r\n            ['code' =&gt; 'FJV002', 'name' =&gt; '\u30c7\u30e9\u30c3\u30af\u30b9\u304a\u9162'],\r\n            ['code' =&gt; 'ACI003', 'name' =&gt; '\u7d14\u6b63\u30df\u30cd\u30e9\u30eb\u30a6\u30a9\u30fc\u30bf\u30fc'],\r\n            ['code' =&gt; 'FOQ004', 'name' =&gt; '\u5927\u81ea\u7136\u306e\u62b9\u8336'],\r\n            ['code' =&gt; 'EIN005', 'name' =&gt; '\u30df\u30eb\u30ad\u30fc\u8c46\u4e73'],\r\n            ['code' =&gt; 'KMV006', 'name' =&gt; '\u719f\u6210\u5869'],\r\n            ['code' =&gt; 'MSW007', 'name' =&gt; '\u6975\u4e0a\u7dd1\u8336'],\r\n            ['code' =&gt; 'GKW008', 'name' =&gt; '\u30d5\u30ec\u30c3\u30b7\u30e5\u30c1\u30e7\u30b3\u30ec\u30fc\u30c8'],\r\n            ['code' =&gt; 'FNO009', 'name' =&gt; '\u5065\u3084\u304b\u304a\u8336'],\r\n            ['code' =&gt; 'EFQ010', 'name' =&gt; '\u30d7\u30ec\u30df\u30a2\u30e0\u30c1\u30fc\u30ba'],\r\n            ['code' =&gt; 'FXZ011', 'name' =&gt; '\u30aa\u30ea\u30b8\u30ca\u30eb\u30b3\u30fc\u30d2\u30fc'],\r\n            ['code' =&gt; 'MQU012', 'name' =&gt; '\u304b\u3089\u3060\u306b\u3084\u3055\u3057\u3044\u7d05\u8336'],\r\n            ['code' =&gt; 'JQS013', 'name' =&gt; '\u6700\u9ad8\u7d1a\u30a6\u30fc\u30ed\u30f3\u8336'],\r\n            ['code' =&gt; 'AEH014', 'name' =&gt; '\u307f\u3093\u306a\u306e\u30ac\u30fc\u30ea\u30c3\u30af'],\r\n            ['code' =&gt; 'IRS015', 'name' =&gt; '\u4eca\u307e\u3067\u306a\u304b\u3063\u305f\u30aa\u30ea\u30fc\u30d6\u30aa\u30a4\u30eb'],\r\n            ['code' =&gt; 'BMN016', 'name' =&gt; '\u30a8\u30af\u30b9\u30c8\u30e9\u30b3\u30fc\u30d2\u30fc\u725b\u4e73'],\r\n            ['code' =&gt; 'FJT017', 'name' =&gt; '\u5065\u5eb7\u30de\u30fc\u30ac\u30ea\u30f3'],\r\n            ['code' =&gt; 'BEQ018', 'name' =&gt; '\u6975\u65e8\u30d0\u30bf\u30fc'],\r\n            ['code' =&gt; 'FKO019', 'name' =&gt; '\u5927\u81ea\u7136\u304c\u304f\u308c\u305f\u30b8\u30e3\u30e0'],\r\n            ['code' =&gt; 'BFW020', 'name' =&gt; '\u30c7\u30ea\u30b7\u30e3\u30b9\u30b9\u30e9\u30a4\u30b9\u30c1\u30fc\u30ba'],\r\n            ['code' =&gt; 'AJY021', 'name' =&gt; '\u30d8\u30eb\u30b7\u30fc\u725b\u4e73'],\r\n            ['code' =&gt; 'DNS022', 'name' =&gt; '\u5fb3\u7528\u30c1\u30e7\u30b3\u30ec\u30fc\u30c8'],\r\n            ['code' =&gt; 'CHN023', 'name' =&gt; '\u5947\u8de1\u306e\u30b3\u30fc\u30d2\u30fc'],\r\n            ['code' =&gt; 'PTW024', 'name' =&gt; '\u304a\u3044\u3057\u3044\u7c89\u30c1\u30fc\u30ba'],\r\n            ['code' =&gt; 'LOZ025', 'name' =&gt; '\u9ad8\u7d1a\u8c46\u4e73'],\r\n            ['code' =&gt; 'JQT026', 'name' =&gt; '\u5929\u7136\u30de\u30fc\u30ac\u30ea\u30f3'],\r\n            ['code' =&gt; 'BMZ027', 'name' =&gt; '\u6599\u7406\u7528\u30c1\u30e7\u30b3\u30ec\u30fc\u30c8'],\r\n            ['code' =&gt; 'MVW028', 'name' =&gt; '\u30c7\u30ea\u30b7\u30e3\u30b9\u30df\u30cd\u30e9\u30eb\u30a6\u30a9\u30fc\u30bf\u30fc'],\r\n            ['code' =&gt; 'BKY029', 'name' =&gt; '\u30d7\u30ec\u30df\u30a2\u30e0\u30c1\u30e7\u30b3\u30ec\u30fc\u30c8'],\r\n            ['code' =&gt; 'ACI030', 'name' =&gt; '\u304b\u3089\u3060\u3088\u308d\u3053\u3076\u30c1\u30e7\u30b3\u30ec\u30fc\u30c8']\r\n        ];\r\n\r\n        foreach ($products as $product) {\r\n\r\n            \\App\\Product::insert([\r\n                'code' =&gt; $product['code'],\r\n                'name' =&gt; $product['name'],\r\n                'stock' =&gt; rand(0, 100),\r\n                'created_at' =&gt; now(),\r\n                'updated_at' =&gt; now()\r\n            ]);\r\n\r\n        }\r\n\r\n    }\r\n}<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001\u3053\u308c\u3089\u306e\u30c0\u30df\u30fc\u30c7\u30fc\u30bf\u306f<a href=\"http:\/\/roopidea.com\/smartdata\/index.php\" target=\"_blank\" rel=\"noopener noreferrer\">SmartData<\/a>\u3055\u3093\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u4f7f\u308f\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\ud83d\ude0a\u2728<\/p>\n<p>\u305d\u3057\u3066\u3001\u4f5c\u6210\u3057\u305f<code>ProductsTableSeeder<\/code>\u3092<code>database\/seeds\/DatabaseSeeder.php<\/code>\u306b\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002\uff08\u592a\u5b57\u304c\u8ffd\u52a0\u3057\u305f\u90e8\u5206\u3067\u3059\uff09<\/p>\n<pre>&lt;?php\r\n\r\nuse Illuminate\\Database\\Seeder;\r\n\r\nclass DatabaseSeeder extends Seeder\r\n{\r\n    \/**\r\n     * Seed the application's database.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function run()\r\n    {\r\n         \/\/$this-&gt;call(UsersTableSeeder::class);\r\n         <strong>$this-&gt;call(ProductsTableSeeder::class);<\/strong>\r\n    }\r\n}<\/pre>\n<p>\u3053\u308c\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u304c\u4f5c\u6210\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan db:seed<\/strong><\/pre>\n<p>\u30c6\u30fc\u30d6\u30eb\u5185\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4388\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_2.png\" alt=\"\" width=\"679\" height=\"449\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_2.png 679w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_2-300x198.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/p>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u6700\u5f8c\u306b\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>php artisan make:controller ChatworkBotController<\/strong><\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068<code>app\/Http\/Controllers\/ChatworkBotController.php<\/code>\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Controllers;<\/strong>\r\n\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Illuminate\\Support\\Str;<\/strong>\r\n\r\n<strong>class ChatworkBotController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function stock(Request $request) {<\/strong>\r\n\r\n<strong>        \/\/ \u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u306e\u9001\u4fe1\u3092\u691c\u8a3c<\/strong>\r\n<strong>        $token = env('CHATWORK_WEBHOOK_TOKEN');<\/strong>\r\n<strong>        $secret_key = base64_decode($token);<\/strong>\r\n<strong>        $request_body = $request-&gt;getContent();<\/strong>\r\n<strong>        $digest = hash_hmac('sha256', $request_body, $secret_key, true);<\/strong>\r\n<strong>        $signature = base64_encode($digest);<\/strong>\r\n\r\n<strong>        if($signature === $request-&gt;header('X-ChatWorkWebhookSignature')) { \/\/ \u691c\u8a3c\u6210\u529f<\/strong>\r\n\r\n<strong>            $api_key = env('CHATWORK_API_TOKEN');<\/strong>\r\n<strong>            $room_id = env('CHATWORK_WEBHOOK_ROOM_ID');<\/strong>\r\n<strong>            $webhook_data = json_decode($request_body, true);<\/strong>\r\n<strong>            $message = $webhook_data['webhook_event']['body'];<\/strong>\r\n<strong>            $reply_prefix = '\u3010\u30dc\u30c3\u30c8\u304b\u3089\u306e\u8fd4\u4fe1\uff1a\u5728\u5eab\u6570\u3011';<\/strong>\r\n\r\n<strong>            if(!empty($message) &amp;&amp; !Str::startsWith($message, $reply_prefix)) {  \/\/ \u3010\u91cd\u8981\uff01\u3011\u3053\u3053\u3067\u7121\u9650\u30eb\u30fc\u30d7\u3092\u56de\u907f<\/strong>\r\n\r\n<strong>                \/\/ \u5546\u54c1\u3092\u691c\u7d22<\/strong>\r\n<strong>                $keywords = explode(' ', trim(mb_convert_kana($message, 's')));<\/strong>\r\n<strong>                $query = \\App\\Product::select('name', 'stock')-&gt;take(25);<\/strong>\r\n\r\n<strong>                foreach($keywords as $keyword) {<\/strong>\r\n\r\n<strong>                    $query-&gt;where('name', 'LIKE', '%'. $keyword .'%');  \/\/ AND\u691c\u7d22<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>                $products = $query-&gt;get();<\/strong>\r\n<strong>                $reply_message = $reply_prefix .\"\\n\";<\/strong>\r\n\r\n<strong>                if($products-&gt;count() &gt; 0) {<\/strong>\r\n\r\n<strong>                    foreach ($products as $product) {<\/strong>\r\n\r\n<strong>                        $reply_message .= $product-&gt;name .': '. $product-&gt;stock .\"\\n\";<\/strong>\r\n\r\n<strong>                    }<\/strong>\r\n\r\n<strong>                } else {<\/strong>\r\n\r\n<strong>                    $reply_message .= '\u8a72\u5f53\u3059\u308b\u5546\u54c1\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002';<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>                \/\/ \u691c\u7d22\u7d50\u679c\u3092\u8fd4\u4fe1<\/strong>\r\n<strong>                $params = ['body' =&gt; $reply_message];<\/strong>\r\n<strong>                $ch = curl_init();<\/strong>\r\n<strong>                curl_setopt($ch, CURLOPT_URL, 'https:\/\/api.chatwork.com\/v2\/rooms\/'. $room_id .'\/messages');<\/strong>\r\n<strong>                curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-ChatWorkToken: '. $api_key]);<\/strong>\r\n<strong>                curl_setopt($ch, CURLOPT_POST, 1);<\/strong>\r\n<strong>                curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, '', '&amp;'));<\/strong>\r\n<strong>                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<\/strong>\r\n<strong>                curl_exec($ch);<\/strong>\r\n<strong>                curl_close ($ch);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return response('OK', 200);<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u4e00\u756a\u5927\u4e8b\u306a\u306e\u306f\u3001\u306a\u3093\u3068\u3044\u3063\u3066\u3082<strong>\u300c\u7121\u9650\u30eb\u30fc\u30d7\u3092\u56de\u907f\u3059\u308b\u300d<\/strong>\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u30dc\u30c3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001\u307e\u305a\u4ee5\u4e0b\u306e\u6d41\u308c\u304c\u5fc5\u8981\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u53d7\u3051\u53d6\u308a\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97<\/li>\n<li>\u305d\u306e\u30c6\u30ad\u30b9\u30c8\u3067\u30c7\u30fc\u30bf\u691c\u7d22<\/li>\n<li>\u691c\u7d22\u7d50\u679c\u3092API\u3092\u4f7f\u3063\u3066\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1<\/li>\n<\/ol>\n<p>\u3068\u3053\u308d\u304c\u3001\u3053\u306e\u6d41\u308c\u3067\u884c\u304f\u3068<strong>\u300c\uff13\u756a\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u3067\u3059\u3089\u518d\u5ea6\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u5f15\u304d\u8d77\u3053\u3057\u3066\u3057\u307e\u3046\u300d<\/strong>\u306e\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u7121\u9650\u30eb\u30fc\u30d7\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u3001\u3053\u308c\u6b62\u3081\u308b\u306b\u306f<code>apache<\/code>\u3084<code>nginx<\/code>\u306e\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u3092\u3092\u518d\u8d77\u52d5\u3059\u308b\u3057\u304b\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002\uff08\u3061\u306a\u307f\u306b\u3001\u8ca0\u8377\u304c\u3042\u307e\u308a\u306b\u5927\u304d\u3044\u3068\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u65b9\u3067\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u7121\u52b9\u306b\u3057\u3066\u304f\u308c\u308b\u305d\u3046\u3067\u3059\uff09<\/p>\n<p>\u3057\u304b\u3082\u3001\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u306e\u4e2d\u8eab\u304b\u3089API\u304b\u3069\u3046\u304b\u3092\u5224\u5225\u3092\u3057\u3088\u3046\u306b\u3082\u540c\u3058\u30e6\u30fc\u30b6\u30fcID\u3092\u4f7f\u3063\u3066\u9001\u4fe1\u3057\u3066\u304f\u308b\u306e\u3067\u3001\u7d50\u5c40\u306f\u30dc\u30c3\u30c8\u306e\u8fd4\u4fe1\u306b\u306f\u56fa\u5b9a\u306e\u6587\u7ae0\uff08\u30b3\u30fc\u30c9\u5185\u3067\u8a00\u3046\u3068<code>\u3010\u30dc\u30c3\u30c8\u304b\u3089\u306e\u8fd4\u4fe1\uff1a\u5728\u5eab\u6570\u3011<\/code>\uff09\u3092\u3064\u3051\u3001\u3082\u3057\u53d6\u5f97\u30c6\u30ad\u30b9\u30c8\u306b\u3053\u306e\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u7121\u9650\u30eb\u30fc\u30d7\u3057\u3066\u3057\u307e\u3046\u306e\u3067\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u3001\u3068\u3044\u3046\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u3082\u3057\u304b\u3059\u308b\u3068\u3001\u4f55\u304b\u89e3\u6c7a\u6cd5\u304c\u3042\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u65b9\u6cd5\u3057\u304b\u7121\u3044\u3068\u3059\u308b\u3068\u3061\u3087\u3063\u3068\u3053\u306eAPI\u306f\u4f7f\u3044\u306b\u304f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\ud83d\ude05\uff09<\/p>\n<h2><span id=\"CSRF\">CSRF\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30a9\u30fc\u30b8\u30a7\u30ea\uff09\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u89e3\u9664\u3059\u308b<\/span><\/h2>\n<p>LINE\u30dc\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3068\u304d\u3068\u540c\u3058\u304f<code>CSRF<\/code>\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u3092\u89e3\u9664\u3057\u306a\u3044\u3068POST\u9001\u4fe1\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u306f\u51fa\u6765\u306a\u3044\u306e\u3067<code>app\/Http\/Middleware\/VerifyCsrfToken.php<\/code>\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u958b\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b \u8a73\u3057\u3044\u5185\u5bb9\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=4285\">Laravel\u3067LINE\u306b\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u3064\u304f\u308b<\/a>\u306e<strong>\u300cCSRF\u5bfe\u7b56\u3092\u89e3\u9664\u3059\u308b\u300d<\/strong>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Middleware;\r\n\r\nuse Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken as Middleware;\r\n\r\nclass VerifyCsrfToken extends Middleware\r\n{\r\n    \/**\r\n     * Indicates whether the XSRF-TOKEN cookie should be set on the response.\r\n     *\r\n     * @var bool\r\n     *\/\r\n    protected $addHttpCookie = true;\r\n\r\n    \/**\r\n     * The URIs that should be excluded from CSRF verification.\r\n     *\r\n     * @var array\r\n     *\/\r\n    protected $except = [\r\n        <strong>'chatwork_bot\/stock'<\/strong>\r\n    ];\r\n}<\/pre>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6e96\u5099\u304c\u6574\u3063\u305f\u306e\u3067\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\u9001\u4fe1\u3059\u308b\u5185\u5bb9\u306f<strong>\u300c\u30c1\u30fc\u30ba\u300d<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u7d50\u679c\u306f\u3053\u3061\u3089\u2193\u2193\u2193<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4400\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_11.png\" alt=\"\" width=\"261\" height=\"140\" \/><\/p>\n<p>\u306f\u3044\uff01<br \/>\n<code>Seeder<\/code>\u3067\u7528\u610f\u3057\u305f\u30c7\u30fc\u30bf\u306e\u4e2d\u304b\u3089\u300c\u30c1\u30fc\u30ba\u300d\u3092\u542b\u3080\u5546\u54c1\u3068\u305d\u306e\u5728\u5eab\u6570\u3092\u8fd4\u4fe1\u3057\u3066\u304f\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude0a<\/p>\n<p>\u307e\u305f\u3001\u3082\u3063\u3068\u7d5e\u308a\u8fbc\u3080\u305f\u3081\u306b<strong>\u300c\u30c1\u30fc\u30ba\u3000\u304a\u3044\u3057\u3044\u300d<\/strong>\u3092\u9001\u4fe1\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u7d50\u679c\u306f\u3053\u3061\u3089\u2193\u2193\u2193<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4401\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/chatwork_webhook_12.png\" alt=\"\" width=\"223\" height=\"91\" \/><\/p>\n<p>\u3053\u3063\u3061\u3082\u7d5e\u308a\u8fbc\u307f\u3057\u305f\u7d50\u679c\u304c\u8fd4\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u301c\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u4eca\u56de\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3068API\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u300cLINE\u306e\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u4f5c\u308b\u306e\u3068\u307b\u307c\u540c\u3058\u3060\u306a\u300d\u3068\u611f\u3058\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u306e\u9001\u4fe1\u3092\u691c\u8a3c\u3059\u308b\u90e8\u5206\u3067\u306f\u3001<code>base64_encode()<\/code>\u3084\u3001<code>hash_hmac()<\/code>\u3092\u4f7f\u3063\u3066\u7f72\u540d\u3092\u6bd4\u8f03\u3059\u308b\u5f62\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306fLINE\u3068\u540c\u3058\u3067\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001LINE\u3068\u9055\u3046\u306e\u306f\u8a18\u4e8b\u4e2d\u3067\u3082\u66f8\u3044\u305f\u300c\u7121\u9650\u30eb\u30fc\u30d7\u300d\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u3067\u3059\u3002<\/p>\n<p>LINE\u306e\u5834\u5408\u306f<strong>\u300cline-bot-sdk\u300d<\/strong>\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u3066\u3001\u3053\u306e\u4e2d\u306b\u8fd4\u4fe1\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046\u9650\u308a\u306f\u7121\u9650\u30eb\u30fc\u30d7\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u306f\u3001\u307b\u307c\u306a\u3044\u3068\u601d\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305b\u3081\u3066API\u304b\u3089\u306e\u9001\u4fe1\u304b\u3069\u3046\u304b\u304c\u308f\u304b\u308b\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u3044\u3044\u306e\u3067\u3059\u304c\u30fb\u30fb\u30fb\uff08\u3082\u3057\u304b\u3057\u305f\u3089\u3001\u3059\u3067\u306b\u5bfe\u7b56\u3055\u308c\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u3001\u307e\u305f\u6642\u9593\u304c\u3067\u304d\u305f\u3089\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u307e\u3059 or \u77e5\u3063\u3066\u305f\u3089\u6559\u3048\u3066\u304f\u3060\u3055\u3044 m_ _m\uff09<\/p>\n<p>\u4eca\u56de\u306f\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-427 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png\" alt=\"\" width=\"182\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png 182w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24-171x300.png 171w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u9593Laravel\u3067LINE\u306b\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u3064\u304f\u308b\u3068\u3044\u3046\u8a18\u4e8b\u3067\u306f\u3001\u300c\u9001\u4fe1\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u3092QR\u30b3\u30fc\u30c9\u306b\u3057\u3066\u8fd4\u4fe1\u3059\u308b\u300d\u3068\u3044\u3046\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4385\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel\u3011\u30c1\u30e3\u30c3\u30c8\u30ef\u30fc\u30afAPI+\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3067\u5728\u5eab\u6570\u30fb\u78ba\u8a8d\u30dc\u30c3\u30c8\u3092\u3064\u304f\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4404,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[134,151,165],"class_list":["post-4385","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-api","tag-151","tag-165"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4385","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=4385"}],"version-history":[{"count":7,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4385\/revisions"}],"predecessor-version":[{"id":4405,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4385\/revisions\/4405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4404"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}