【发布时间】:2021-10-19 03:11:30
【问题描述】:
DB::table("game")
->join("game_description", "game_description.game_id", "=", "game.game_id")
->where("game_description.language_id", "=", getLocaleID())
->where("game_description.active", "=", 1)
->leftJoin("product_to_game", "product_to_game.game_id", "=", "game.game_id")
->leftJoin("product_price", "product_price.product_id", "=", "product_to_game.product_id")
->orderBy("product_price.product_price", "DESC");
我必须创建一个这样的查询(在 eloquent 模型中)。我必须在一个查询中连接 6-7 个表。你能帮我怎么做吗?
【问题讨论】:
-
请不要发布代码图片,请将代码粘贴到您问题的代码块中。您需要在模型中定义关系。这在 Laravel 文档中有详细记录。
-
请避免将代码作为图片上传为图片。 meta.stackoverflow.com/questions/285551/…
标签: php laravel eloquent model laravel-8