laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.55k stars 11.03k forks source link

BelongsToMany return soft deleted records of pivot table #34857

Closed monadashish closed 4 years ago

monadashish commented 4 years ago

Description:

When i use belongstomany pivot tables soft deleted records coming in instance though raw query for the same givng correct results.

relation i am using $this->belongsToMany('Navnorth\Core\Http\Models\Group', 'group_members', 'profile_id', 'group_id') ->distinct('group_id') ->where('group_type_id', '!=', (int) array_search('ll_roster', config('core.group.grouptypes'))) ->whereNull('group_members.deleted_at');

my tables groups id , name, created_at,updated_at,deleted_at

group_members

id,group_id,profile_id,created_at,updated_at,deleted_at

Steps To Reproduce:

taylorotwell commented 4 years ago

Laravel does not support soft deletes on pivot tables.