{"id":2150,"date":"2022-07-06T20:33:07","date_gmt":"2022-07-06T11:33:07","guid":{"rendered":"http:\/\/wp.ultimai.org\/?p=2150"},"modified":"2022-07-06T20:38:20","modified_gmt":"2022-07-06T11:38:20","slug":"larabel8-%e3%82%af%e3%82%a8%e3%83%aa%e3%83%bc%e3%83%93%e3%83%ab%e3%83%80%e3%83%bc-%e3%82%b5%e3%83%96%e3%82%af%e3%82%a8%e3%83%aa-%e8%a4%87%e6%95%b0%e6%9d%a1%e4%bb%b6-%e7%ae%97%e8%a1%93%e6%bc%94","status":"publish","type":"post","link":"https:\/\/wp.ultimai.org\/?p=2150","title":{"rendered":"laravel8 \u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc \u30b5\u30d6\u30af\u30a8\u30ea \u8907\u6570\u6761\u4ef6 \u7b97\u8853\u6f14\u7b97 groupBy\u8907\u6570 orderBy DESC\u6df7\u5728 \u751f\u306eSQL chank"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"><code>\r\n    \u30b5\u30d6\u30af\u30a8\u30ea\r\n    \u5909\u6570\u306f\u305f\u3044\u3066\u3044\u30b0\u30ed\u30fc\u30d0\u30eb\u5316\u3057\u306a\u3044\u3068\u6e21\u305b\u306a\u3044\r\n\r\n    $ranks_tags = DB::table('ranks_tags')->where('label',$this->range_w);\r\n\r\n        DB::table('post_tags as p')->select(\r\n            DB::raw(   \/\/\u3053\u306e\u4e2d\u306e''\u306f1\u30bb\u30c3\u30c8\uff61\u6700\u521d\u3068\u6700\u5f8c\u306e\u307f\u3067\u5168\u4f53\u3092\u56f2\u3080\r\n            'p.fave_id , p.tag_id, f.name , f.cnt_cheer , s.before_cnt_cheer\r\n            , f.cnt_cheer - s.before_cnt_cheer AS incre_cheer \r\n            , f.cnt_post, s.before_cnt_post\r\n            , f.cnt_post - s.before_cnt_post AS incre_post\r\n            , cnt_share\r\n            , s.id as ranktag_id'\r\n            )\r\n        )\r\n        ->LeftJoin( 'tags as t' , 'p.tag_id' ,'t.id')\r\n        ->LeftJoin( 'faves as f', 'p.fave_id','f.id')\r\n        ->LeftJoinSub($ranks_tags, 's', function ($join) {\r\n            $join->on('s.tag_id' , 'p.tag_id' );\r\n            $join->on('p.fave_id' , 's.fave_id');\r\n        })\r\n        ->groupBy('p.tag_id' , 'p.fave_id' , 'incre_cheer' , 'ranktag_id' )\r\n        ->orderBy('p.tag_id' ,'asc')\r\n        ->orderBy('incre_cheer' ,'DESC')\r\n        ->orderBy('cnt_post' ,'DESC')\r\n        ->limit(999999)\r\n        \/\/ ->toSql(); \u2190\u7d20\u306eSQL\u6587\u3092\u66f8\u304d\u51fa\u305b\u308b\r\n        ->chunk( $this->max_lows, function ($tag_fave) {\r\n            foreach ($tag_fave as $key => $row) {\r\n                \/\/ DB::table('tags')\r\n                \/\/     ->where('id', $tags->id)\r\n                \/\/     ->update(['created_at' => $this->ranges['day']]);\r\n                var_dump($key, $row );\r\n\t\t\t\t\t\t\t\r\n\t\t\t}\r\n            return false; \/\/\u2190 \u3053\u308c\u3067\u7d42\u308f\u308b\r\n\t\t});\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30b5\u30d6\u30af\u30a8\u30ea \u5909\u6570\u306f\u305f\u3044\u3066\u3044\u30b0\u30ed\u30fc\u30d0\u30eb\u5316\u3057\u306a\u3044\u3068\u6e21\u305b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2150","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/2150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2150"}],"version-history":[{"count":2,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/2150\/revisions"}],"predecessor-version":[{"id":2153,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=\/wp\/v2\/posts\/2150\/revisions\/2153"}],"wp:attachment":[{"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.ultimai.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}