سؤال

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