{"id":1520,"date":"2020-03-02T13:04:44","date_gmt":"2020-03-02T04:04:44","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=1520"},"modified":"2020-03-04T09:55:03","modified_gmt":"2020-03-04T00:55:03","slug":"post-1520","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2020\/03\/02\/post-1520\/","title":{"rendered":"Laravel\uff1aBase table or view not found: 1146 Table 'DataBase.staff' doesn't exist \u306e\u7f60"},"content":{"rendered":"<h2>Base table or view not found: 1146 Table 'DataBase.staff' doesn't exist \u306e\u7f60<\/h2>\n<p>\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u6b63\u76f4\u306b\u5bfe\u5fdc\u3059\u308c\u3070\u3088\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001Laravel\u306b\u6163\u308c\u3066\u304d\u305f\u305b\u3044\u3082\u3042\u308a\u3053\u306e\u30a8\u30e9\u30fc\u89e3\u6c7a\u306b\u9577\u6642\u9593\u3092\u8cbb\u3084\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u3010\u82f1\u8a9e\u529b\u3011<br \/>\n\u3044\u3084\u3041\uff5e\u3001\u4eca\u56de\u306e\u3053\u306e\u30a8\u30e9\u30fc\u306f\u75b2\u308c\u307e\u3057\u305f\u3002<\/p>\n<h3>Laravel \u547d\u540d\u898f\u5236\u306b\u3064\u3044\u3066\u306e\u304a\u3055\u3089\u3044<\/h3>\n<p>\u79c1\u306e\u30c9\u306f\u307e\u308a\u306e\u7406\u7531\u304c\u3053\u306e\u547d\u540d\u898f\u5236\u3067\u3059\u3002<br \/>\nLaravel \u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u547d\u540d\u898f\u5236\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>\u30c6\u30fc\u30d6\u30eb\u540d\u306f\u8907\u6570\u5f62\u3092\u7528\u3044\u308b<\/li>\n<li>Model\u540d\u306f\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u5358\u6570\u5f62\u3092\u4f7f\u3046<\/li>\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u540d\u306f\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u5358\u6570\u5f62+Controller\u3068\u3059\u308b<\/li>\n<\/ol>\n<\/div>\n<p>\u5177\u4f53\u7684\u306bUser\u3067\u898b\u3066\u307f\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>\u30c6\u30fc\u30d6\u30eb\u540d\uff1ausers<\/li>\n<li>Model\u540d\uff1aUser<\/li>\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u540d\uff1aUserController<\/li>\n<\/ol>\n<\/div>\n<h3>\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u9593\u9055\u3044\u306f\u306a\u3044\uff1f<\/h3>\n<p>\u3084\u308d\u3046\u3068\u3057\u3066\u3044\u305f Eloquent \u3082\u5c11\u3057\u8907\u96d1\u306a\u3082\u306e\u3060\u3063\u305f\u306e\u3067\u3053\u3063\u3061\u304c\u9593\u9055\u3048\u3066\u3044\u308b\u306e\u3067\u306f\u3068\u601d\u3044\u4f55\u56de\u3082\u898b\u76f4\u3057\u307e\u3057\u305f\u3002<br \/>\n\u66f8\u3044\u3066\u3044\u305f Eloquent \u306f\u3053\u3093\u306a\u3082\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">$contacts = Contact::whereHas('From_User',function($seach1) use($user){\r\n    $seach1-&gt;whereHas('Customer',function($seach2) use($user){\r\n        $seach2-&gt;whereHas('Staff',function($seach3) use($user){\r\n           $seach3-&gt;where('user_id',$user-&gt;id);})\r\n        ;})\r\n    ;})\r\n    -&gt;orwhere('for_customer',$customer)\r\n    -&gt;orwhere('for_user',$user-&gt;id)\r\n    -&gt;orderBy('updated_at','desc')\r\n    -&gt;paginate(10);<\/pre>\n<p>\u304a\u5ba2\u3055\u3093\u304b\u3089\u554f\u3044\u5408\u308f\u305b\u304c\u6765\u305f\u6642\u300e\u62c5\u5f53\u30b9\u30bf\u30c3\u30d5\u306b\u306e\u307f\u30a2\u30ca\u30a6\u30f3\u30b9\u300f\u3055\u308c\u308b\u3088\u3046\u306b\u62bd\u51fa\u3057\u3088\u3046\u3068\u3057\u305f\u306e\u3067\u3059\u304c\u30a8\u30e9\u30fc\u3002<br \/>\n\u3067\u3082\u4e0b\u306e\u3088\u3046\u306bModel\uff1aCustomer\u3067\u306f\u3061\u3083\u3093\u3068\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u8a2d\u8a08\u3092\u8a18\u8f09\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">class Customer extends Model\r\n{\r\n    public function Staff()\r\n    {\r\n        return $this-&gt;belongsTo('App\\Models\\Staff');\r\n    }\r\n}<\/pre>\n<p>\u9593\u9055\u3048\u3066\u3044\u308b\u611f\u3058\u306f\u7121\u3044\u3002\u306a\u305c\u51fa\u6765\u306a\u3044...\u3002\u3082\u3046\u60a9\u307f\u307e\u304f\u308a\u3067\u3059\u3002<\/p>\n<h3>\u30c6\u30fc\u30d6\u30eb\u540d\u306f\u8907\u6570\u5f62\u306b\u3059\u308b\u3002\u3067\u306fStaff\u306e\u8907\u6570\u5f62\u306f\uff1f<\/h3>\n<p>\u306f\u3044\u3001\u3053\u3053\u304c\u79c1\u306e\u9593\u9055\u3044\u30dd\u30a4\u30f3\u30c8\u3067\u3057\u305f\u3002Staff\u306e\u8907\u6570\u5f62\u3063\u3066\u4f55\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>Staff\u3068\u3044\u3046\u5358\u8a9e\u306f\u5358\u6570\u30fb\u8907\u6570\u4e21\u65b9\u3042\u308a\u3001\u8907\u6570\u5f62\u3082\u3010staff\u3011\u306a\u306e\u3060\u305d\u3046\u3067\u3059\u3002<br \/>\nstaffs\u3068\u306a\u308b\u3053\u3068\u3082\u3042\u308b\u3051\u3069\u3001\u305d\u308c\u306f3\u4eba\u79f0\u5358\u6570\u73fe\u5728\u306e\u6642\u306b\u8a9e\u5c3e\u306bs\u304c\u3064\u3044\u3066staffs\u3068\u306a\u308b\u306e\u3060\u3068\u304b\u3002<br \/>\n\u3067\u3082\u306d\u3001\u52d5\u8a5e\u306estaff\u3068\u8a00\u3046\u306e\u304c\u30a4\u30e1\u30fc\u30b8\u3067\u304d\u306a\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u306e\u307b\u304b\u306b\u3082staffs\u3068\u306a\u308b\u306e\u306f2\u30d1\u30bf\u30fc\u30f3\u3042\u308a\u3001\u307e\u3068\u3081\u308b\u3068\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>\u52d5\u8a5estaff\u306e3\u4eba\u79f0\u5358\u6570\u73fe\u5728\u306e\u3068\u304d<\/li>\n<li>\u96c6\u5408\u4f53\u3068\u3057\u3066\u306estaff\u304c\u8907\u6570\u3042\u308b\u6642<\/li>\n<li>\u6b69\u884c\u7528\u306e\u300c\u6756\uff08\u3064\u3048\uff09\u300d\u3084\u6b66\u5668\u306e\u300c\u3053\u3093\u68d2\u300d\u306e\u610f\u5473\u306estaff\u306e\u8907\u6570\u5f62<\/li>\n<\/ol>\n<\/div>\n<p>\u82f1\u8a9e\u306estaff\u306f\u96c6\u5408\u540d\u8a5e\u3068\u3044\u3044\u3001\u8907\u6570\u96c6\u307e\u3063\u305f\u3072\u3068\u307e\u3068\u307e\u308a\u3092\u6307\u3059\u8a00\u8449\u3002<br \/>\n\u306a\u306e\u3067\u3001\u5358\u6570\u306e\u5834\u5408\u306f a staff\u3000\u8907\u6570\u306e\u5834\u5408\u306f ten staff \u3068\u8868\u8a18\u3059\u308b\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u52d5\u8a5e\u3068\u3057\u3066\u306f\u3010\u4eba\u54e1\u3092\u914d\u7f6e\u3059\u308b\u3011\u3068\u3044\u3046\u610f\u5473\u3092\u6301\u3061\u3001\u4e09\u5358\u73fe\u306eS\u306f\u3053\u306e\u6642\u306b\u4f7f\u308f\u308c\u308b\u3068\u306e\u4e8b\u3002<br \/>\n\u305f\u3060\u3057\u3001\u52d5\u8a5e\u306estaff\u306f\u53d7\u52d5\u614b\u3067\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001d \u304c\u4ed8\u304f\u4e8b\u304c\u591a\u304fstaffs\u306f\u3042\u307e\u308a\u898b\u304b\u3051\u306a\u3044\u3068\u306e\u4e8b\u3002<\/p>\n<h3>\u30c6\u30fc\u30d6\u30eb\u540d\u3092Staff\u306b\u3057\u305f\u3089\u5168\u3066\u89e3\u6c7a\u3002<\/h3>\n<p>\u306f\u3044\u3001\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u3067\u3057\u305f\u3002<br \/>\n\u82f1\u8a9e\u529b\u5fc5\u8981\u3067\u3059\u306d\u3002<\/p>\n<p>\u75b2\u308c\u305f\u3041\uff5e\uff5e...\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Base table or view not found: 1146 Table 'DataBase.staff' doesn't exist \u306e\u7f60 \u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u6b63\u76f4\u306b\u5bfe\u5fdc\u3059\u308c\u3070\u3088\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001Laravel\u306b\u6163 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":944,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"vkexunit_cta_each_option":"","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}},"categories":[34],"tags":[422,54,153,99,53,279,45],"class_list":["post-1520","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-memorandum","tag-eloquent","tag-html","tag-laravel","tag-mysql","tag-53","tag-279","tag-45"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/qol-kk.com\/wp2\/wp-content\/uploads\/2018\/11\/laravel_logo.png?fit=1118%2C538&ssl=1","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1520","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=1520"}],"version-history":[{"count":2,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1520\/revisions"}],"predecessor-version":[{"id":1522,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1520\/revisions\/1522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/944"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=1520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=1520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}