Laravel's whereNotIn operator also accepts functions to nest queries:
$result = DB::table("foo")
->whereNotIn(function ($query) {
$query->from("foo as f2")
->where("f2.key", "client_location_id")
->select("id");
})->select("value1","value2")->get();
This will produce the following query (you can verify the query you get if you do a ->toSQL() instead of ->get())
select `value1`, `value2`
from `foo`
where `id` not in (
select `id` from `foo` as `f2` where `f2`.`key` = ?
)
Of course I could point out that this particular query does not require a nested select but I'm assuming this is just an example.
This being said, the eloquent ORM is a better long term solution if your project is large.