如何仅在表“ service_gos”中获取“ ids”(Lavarel)

时间:2018-08-27 17:06:21

标签: mysql database laravel

我想通过将“ gos.id”与“ service_gos.gos_id”(LARAVEL 5.6)进行比较,仅返回未在“ service_gos”表中注册的那些“ gos”

goals table

service_goals table

my view

my controller function

result expected

this is what im getting

1 个答案:

答案 0 :(得分:0)

不确定表名,请相应更改。 试试:

$ids = Goals::whereDoesntHave("service_goals")->pluck("id");