{"id":879,"date":"2018-10-25T23:42:23","date_gmt":"2018-10-25T14:42:23","guid":{"rendered":"http:\/\/qol-kk.com\/wp2\/?p=879"},"modified":"2018-11-05T16:28:27","modified_gmt":"2018-11-05T07:28:27","slug":"post-879","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2018\/10\/25\/post-879\/","title":{"rendered":"Larabel\uff1aDB\u306b\u63a5\u7d9a\u3067\u304d\u306a\u304b\u3063\u305f\u7406\u7531"},"content":{"rendered":"<h2>Larabel\uff1aDB\u306b\u63a5\u7d9a\u3067\u304d\u306a\u304b\u3063\u305f\u7406\u7531<\/h2>\n<p>MVC\u30e2\u30c7\u30eb\u304c\u4f55\u3068\u306a\u304f\u7406\u89e3\u51fa\u6765\u3066\u304d\u305f\u4eca\u65e5\u3053\u306e\u9803\u3002<\/p>\n<p>\u300c\u3088\u3057\u3001DB\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u79fb\u308b\u304b\u300d\u3068\u610f\u6c17\u63da\u3005\u8a66\u3057\u3066\u307f\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>\u307e\u305a\u306f\u7c21\u5358\u306a\u30b7\u30f3\u30b0\u30eb\u30c6\u30fc\u30d6\u30eb\u3067<\/h3>\n<p>\u6700\u521d\u304b\u3089\u96e3\u6613\u5ea6\u4e0a\u3052\u308b\u3068\u30df\u30b9\u306e\u7b87\u6240\u3082\u308f\u304b\u3089\u306a\u304f\u306a\u308b\u306e\u3067\u300e\u304a\u984c\uff1a\u304a\u554f\u5408\u305b\u30d5\u30a9\u30fc\u30e0\u5b9f\u88c5\u300f\u3067\u8a66\u307f\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u571f\u53f0\u3092\u7528\u610f\u3002<\/p>\n<pre class=\"lang:default decode:true\">php artisan make:migration create_contacts_table<\/pre>\n<p>\u3053\u308c\u3067database\\micrations \u306b\u3010\u65e5\u4ed8+create_contacts_table.php\u3011\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u3044\u3066\u4f5c\u6210\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u958b\u3044\u3066\u30ab\u30e9\u30e0\u540d\u3068\u5c5e\u6027\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">&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 CreateContactsTable 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('contacts', function (Blueprint $table) {\r\n            $table-&gt;increments('id');\r\n            $table-&gt;string('name');\r\n            $table-&gt;string('email');\r\n            $table-&gt;string('subject');\r\n            $table-&gt;text('content');\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::drop('contacts');\r\n    }\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\uff01<\/p>\n<pre class=\"lang:default decode:true\">php artisan migrate<\/pre>\n<p>PHPMyAdmin\u3067\u78ba\u8a8d\u3059\u308b\u3068... \u304a\u30fc\u3001\u3057\u3063\u304b\u308a\u30c6\u30fc\u30d6\u30eb\u304c\u51fa\u6765\u4e0a\u304c\u3063\u3066\u307e\u3059\u3002\u524d\u4f5c\u3063\u305f\u30c7\u30fc\u30bf\u3092\u6d88\u3059\u3088\u3046\u306a\u3053\u3068\u306f\u305b\u305a\u3001\u8db3\u308a\u306a\u3044\u3082\u306e\u3060\u3051\u4f5c\u3063\u3066\u304f\u308c\u308b\u3068\u3053\u308d\u304c\u512a\u79c0\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>DB\u306f\u3067\u304d\u305f\u3002\u3055\u3041\u3001DB\u306b\u63a5\u7d9a\u3060\uff01\u3068\u601d\u3044Controller\u3092\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">    \/** \u554f\u3044\u5408\u308f\u305b DB\u63a5\u7d9a**\/\r\n    public function inquiry_list(Request $request)\r\n    { \/*WHERE name = {{ Auth::user()-&gt;name }}*\/\r\n        $contacts = DB::select('select * form contacts');\r\n        return view('home\/inquiry_list',['items' =&gt; $items]);\r\n    }<\/pre>\n<p>\u3064\u306a\u304c\u3089\u306a\u3044...\u3002<\/p>\n<p>\u30de\u30cb\u30e5\u30a2\u30eb\u3092\u8abf\u3079\u30b0\u30b0\u3063\u3066\u307f\u3066\u3082\u3069\u3053\u304c\u60aa\u3044\u304b\u4e0d\u660e\u3067\u3059\u30021\u6642\u9593\u306e\u683c\u95d8\u306e\u672b\u3001\u3084\u3063\u3068Controller\u306e\u4e2d\u306b\u60aa\u3044\u5974\u3092\u898b\u3064\u3051\u307e\u3057\u305f\uff01<\/p>\n<pre class=\"lang:default decode:true\">$contacts = DB::select('select * form contacts');<\/pre>\n<p>\u6c17\u3065\u304d\u307e\u3057\u305f\uff1f\u3002<\/p>\n<div class=\"pointBox\">\n<p>SQL\u306e\u30c6\u30fc\u30d6\u30eb\u6307\u5b9a\u306ffrom\u3067form\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<\/div>\n<p>\u30dd\u30a4\u30f3\u30c8\u3067\u3082\u4f55\u3067\u3082\u306a\u3044\u3093\u3067\u3059\u3051\u3069...\u3053\u3093\u306a\u3068\u3053\u308d\u306b\u539f\u56e0\u304c\u3042\u3063\u305f\u306e\u304b\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u3064\u307e\u3089\u306a\u3044\u9593\u9055\u3044\u307b\u3069\u6c17\u3065\u304d\u306b\u304f\u3044\u3082\u306e\u3002<\/p>\n<p>\u898b\u76f4\u3057\u306f\u5148\u5165\u89b3\u3092\u6301\u305f\u305a\u5b9f\u65bd\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Larabel\uff1aDB\u306b\u63a5\u7d9a\u3067\u304d\u306a\u304b\u3063\u305f\u7406\u7531 MVC\u30e2\u30c7\u30eb\u304c\u4f55\u3068\u306a\u304f\u7406\u89e3\u51fa\u6765\u3066\u304d\u305f\u4eca\u65e5\u3053\u306e\u9803\u3002 \u300c\u3088\u3057\u3001DB\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u79fb\u308b\u304b\u300d\u3068\u610f\u6c17\u63da\u3005\u8a66\u3057\u3066\u307f\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002 \u307e\u305a\u306f\u7c21\u5358\u306a\u30b7\u30f3\u30b0\u30eb\u30c6\u30fc\u30d6\u30eb\u3067 \u6700\u521d\u304b\u3089\u96e3\u6613\u5ea6\u4e0a\u3052\u308b\u3068 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[34],"tags":[161,162,163,159,160,58,164],"class_list":["post-879","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-memorandum","tag-form","tag-from","tag-163","tag-159","tag-160","tag-58","tag-164"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2018\/08\/top.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=879"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/879\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/9"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}