我有三个表:tbl_borrower、tbl_client
和tbl_guarantor
tbl_Client:
id|name|address|email|
tbl_Guarantor:
id|clientid(fk)|Guaranteed_date|borrower_id(fk from borrower table)
我想检索客户端表的所有值,但 Laravel 5.5
Controller 中担保表中存在的值除外。
最佳答案
建立模型和关系后,您应该执行以下操作:
Client::doesntHave('guarantor')->get()
https://laravel.com/docs/5.6/eloquent-relationships#querying-relationship-absence
关于php - 如何从表中选择除外部表中的值之外的所有值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52192625/