{"id":10950,"date":"2024-06-07T17:23:35","date_gmt":"2024-06-07T08:23:35","guid":{"rendered":"https:\/\/www.moonmile.net\/blog\/?p=10950"},"modified":"2024-06-07T17:23:35","modified_gmt":"2024-06-07T08:23:35","slug":"%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e5%ae%9a%e7%be%a9%ef%bc%88ddl%ef%bc%89%e3%81%8b%e3%82%89-laravel-%e3%81%ae-web-api-%e3%82%92-chatgpt-%e3%81%a7%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/10950","title":{"rendered":"\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\uff08DDL\uff09\u304b\u3089 Laravel \u306e web api \u3092 ChatGPT \u3067\u4f5c\u6210\u3059\u308b"},"content":{"rendered":"\n<p>\u3055\u3089\u306b\u3001ChatGPT \u3067\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u3059\u308b\u30b7\u30ea\u30fc\u30ba\u306e\u7d9a\u304d\u3002<\/p>\n\n\n\n<p>\u3044\u308f\u3086\u308b\u30b9\u30ad\u30e3\u30d5\u30a9\u30fc\u30eb\u30c7\u30a3\u30f3\u30b0\u306e\u624b\u6cd5\u3092\u4f7f\u3044\u307e\u3059\u3002CakePHP \u3084 Ruby on Rails \u306b\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066 MVC \u30d1\u30bf\u30fc\u30f3\u306e\u5404\u30af\u30e9\u30b9\uff06\u30e1\u30bd\u30c3\u30c9\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u4f55\u6545\u304b Laravel \u306b\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3044\u304f\u3064\u304b\u3001\u305d\u308c\u3063\u307d\u3044\u3082\u306e\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u3084\u308a\u305f\u3044\u3068\u3053\u308d\u3068\u3057\u3066\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SQL \u306e create table \u6587\u3092\u6e21\u3059<\/li>\n\n\n\n<li>\u9069\u5f53\u306b\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u89e3\u91c8\u3057\u3066\u6b32\u3057\u3044\u3002<\/li>\n\n\n\n<li>\u51fa\u529b\u306f Controller\/Model \u3092\u51fa\u529b\u3057\u3066\u6b32\u3057\u3044\u3002<\/li>\n\n\n\n<li>Laravel \u306e\u5834\u5408\u306f api.php \u3082\u5fc5\u8981<\/li>\n\n\n\n<li>web api \u3067\u5229\u7528\u3059\u308b\u306e\u3067\u3001View \u306e blade \u306f\u5fc5\u8981\u306a\u3044<\/li>\n<\/ul>\n\n\n\n<p>\u3068\u3044\u3046\u8981\u4ef6\u304c\u3042\u308b\u306e\u3067\u3001\u901a\u5e38\u306e\u30b9\u30ad\u30e3\u30d5\u30a9\u30fc\u30eb\u30c7\u30a3\u30f3\u30b0\u30c4\u30fc\u30eb\u3067\u306f\u904e\u5270\u306a\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b View \u306e\u90e8\u5206\u306f\u3044\u3089\u306a\u3044\u306e\u3068\u3001\u3067\u304d\u308c\u3070 Vue3 \u306e\u51fa\u529b\u307e\u3067\u3057\u3066\u6b32\u3057\u3044\u3001\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4ed5\u65b9\u304c\u306a\u3044\u306e\u3067\u3001\u4f55\u304b\u306e\u6a5f\u4f1a\u304c\u3042\u3063\u305f\u3089 PHP \u306e\u30c4\u30fc\u30eb\u3092\u4f5c\u308d\u3046\u3068\u601d\u3063\u3066\u3044\u305f\u3068\u3053\u308d\u306a\u306e\u3067\u3059\u304c\uff08Laravel \u304c PHP \u306a\u306e\u3067&#8230;\u3053\u308c\u306f\u4ed5\u65b9\u304c\u306a\u3044\uff09\u3001ChatGPT \u304c\u3067\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL \u3092\u6e21\u3057\u3066\u3001\u51fa\u529b\u3092\u8981\u6c42\u3059\u308b<\/h2>\n\n\n\n<p>\u30d7\u30ed\u30f3\u30d7\u30c8\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001SQL\u3092\u30d9\u30bf\u6253\u3061\u3001\u3067\u304d\u308b\u3060\u3051\u6307\u793a\u3092\u77ed\u304f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\u4ee5\u4e0b\u306e SQL \u304b\u3089\u3001\u6307\u5b9a\u3057\u305f\u5e97\u8217\u5185\u306b\u3042\u308b\u5546\u54c1\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u3002\n\u3053\u308c\u3092\u3001Laravel \u306e web api \u3067\u4f5c\u6210\u3057\u3066\u3002\n\n--\n-- \u5e97\u8217\u30c6\u30fc\u30d6\u30eb\n-- \ncreate table Stores ( \n\tid int not null,\t\t-- \u5e97\u8217id\n\tname varchar(100),\t\t-- \u5e97\u8217\u540d\n\taddress varchar(255),\t-- \u5e97\u8217\u4f4f\u6240\n\tcreated_at datetime,\t-- \u4f5c\u6210\u65e5\u6642\n\tupdated_at datetime,\t-- \u66f4\u65b0\u65e5\u6642\n\tis_delete bool\t\t-- \u524a\u9664\u30d5\u30e9\u30b0\n);\n\n--\n-- \u5e97\u8217\u304b\u3089\u5546\u54c1\u3078\u306e\u9023\u643a\u30c6\u30fc\u30d6\u30eb\n--\ncreate table store_product_link (\n    store_id int not null,\t    -- \u5e97\u8217ID\n    product_id int not null,\t-- \u5546\u54c1ID\n    stock int,\t\t\t\t    -- \u5728\u5eab\u6570\n    created_at datetime,\t    -- \u4f5c\u6210\u65e5\u6642\n    updated_at datetime,\t    -- \u66f4\u65b0\u65e5\u6642\n\tis_delete bool\t\t        -- \u524a\u9664\u30d5\u30e9\u30b0\n);<\/code><\/pre><\/div>\n\n\n\n<p>\u4ee5\u524d\u3001GPT-3.5\u306e\u9803\u306b\u306f\u3046\u307e\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001GPT-4o \u3067\u306f\u304b\u306a\u308a\u7dba\u9e97\u306b\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"769\" src=\"https:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-5.png\" alt=\"\" class=\"wp-image-10951\" srcset=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-5.png 803w, http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-5-300x287.png 300w, http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-5-768x735.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/a><\/figure>\n\n\n\n<p>\u30b3\u30c4\u3068\u3057\u3066\u306f\u3001Laravel \u3067\u51fa\u529b\u3092\u8981\u6c42\u3059\u308b\u3068\u3053\u308d\u3068\u3001SQL \u306e\u30b3\u30e1\u30f3\u30c8\u306b\u3042\u308b\u300c\u5e97\u8217\u300d\u3084\u300c\u5546\u54c1\u300d\u306a\u3069\u3092\u30d7\u30ed\u30f3\u30d7\u30c8\u5185\u306b\u660e\u78ba\u306b\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u3053\u3053\u306e\u65b0\u4eba\u6559\u80b2\u3067\u4f7f\u3063\u3066\u3044\u308b\u5e97\u8217\u3084\u5546\u54c1\u306e SQL \u81ea\u4f53\u304c\u3001GPT-4o \u3067\u51fa\u529b\u3057\u305f\u3082\u306e\u306a\u306e\u3067\u3001GPT \u81ea\u4f53\u306b\u8aad\u307f\u3084\u3059\u3044\uff08\u5185\u90e8\u7684\u306b\u4fdd\u6301\u3057\u3066\u3044\u308b\u8005\u306b\u8fd1\u3044\uff09\u5f62\u5f0f\u306b\u306a\u3063\u3066\u3044\u308b\u3060\u3051\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u5b9f\u904b\u7528\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u696d\u754c\u7528\u8a9e\u3092\u5834\u5408\u306f\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u53ef\u80fd\u6027\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u3001\u5b8c\u5168\u306b\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b\u306e\u3092\u671f\u5f85\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u591a\u5c11\u306e\u624b\u4f5c\u696d\u306e\u6642\u9593\u3092\u6b8b\u3057\u3066\u304a\u3044\u305f\u307b\u3046\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002\u305d\u3046\u3060\u3068\u3057\u3066\u3082\u3001\u7d50\u69cb\u9762\u5012\u306a Model \u540c\u58eb\u306e\u9023\u7d50\u306a\u3069\u3082\u51fa\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u6700\u521d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066\u304b\u306a\u308a\u91cd\u5b9d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"642\" src=\"https:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-6.png\" alt=\"\" class=\"wp-image-10952\" srcset=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-6.png 766w, http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2024\/06\/image-6-300x251.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3089\u306b\u3001ChatGPT \u3067\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u3059\u308b\u30b7\u30ea\u30fc\u30ba\u306e\u7d9a\u304d\u3002 \u3044\u308f\u3086\u308b\u30b9\u30ad\u30e3\u30d5\u30a9\u30fc\u30eb\u30c7\u30a3\u30f3\u30b0\u306e\u624b\u6cd5\u3092\u4f7f\u3044\u307e\u3059\u3002CakePHP \u3084 Ruby on Rails \u306b\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066 MVC \u30d1\u30bf\u30fc\u30f3\u306e\u5404\u30af\u30e9\u30b9 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/10950\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-10950","post","type-post","status-publish","format-standard","hentry","category-dev"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/10950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=10950"}],"version-history":[{"count":1,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/10950\/revisions"}],"predecessor-version":[{"id":10953,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/10950\/revisions\/10953"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=10950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=10950"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=10950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}