有人可以帮我解决我的订购问题。
我有4张桌子:
posts
[id]
post_values
[id, post_id, value_id, value_text]
post_category_field_values
[id]
post_category_field_value_translations
[id, value_id, 'locale', 'name']
我需要按翻译的值名称排序所有帖子。
答案 0 :(得分:0)
也许Jarek的回答会帮助你
$products = Shop\Product::join('shop_products_options as po', 'po.product_id', '=', 'products.id')
->orderBy('po.pinned', 'desc')
->select('products.*') // just to avoid fetching anything from joined table
->with('options') // if you need options data anyway
->paginate(5);