Level 53
$query = 'SELECT
price
FROM
matrices
INNER JOIN (
SELECT
price_group_id,
max_width
FROM
matrices
WHERE
price_group_id = 1
AND max_width >= 74
ORDER BY
max_width
LIMIT 1) AS t ON matrices.max_width = t.max_width
AND matrices.price_group_id = t.price_group_id
WHERE
matrices.max_height >= 84
ORDER BY
matrices.max_height
LIMIT 1';
$result = DB::select(DB::raw($query));
// you can also do this afterwords to get the models
$result = \App\Matrix::hydrate($result );
dd($result );