문제

Suppose I have the following whereHas constraint:

$query->whereHas('club', function($q)
{
    $q->whereHas('membership', function($q)
    {
        $q->whereHas('package', function($q)
        {
            $q->whereId(Input::get('package_id'));
        });
    });
});

I would like to build the above from an input as such:

['key' => 'package_id', 'relationship' => 'club.membership.package']

Is this possible?

I don't know in this case how to properly explode and iterate relationship from the array.

도움이 되었습니까?

해결책

Check PR github.com/laravel/framework/pull/4237 as it solves the problem.

Update: The mentioned PR has moved to github.com/laravel/framework/pull/6726 and is now merged.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top