kirschbaum-development / eloquent-power-joins

The Laravel magic you know, now applied to joins.
MIT License
1.39k stars 87 forks source link

feat: support for statically added closure global scopes #140

Closed boumanb closed 1 year ago

boumanb commented 1 year ago

Adds support for statically added Closure global scopes.

Example:

protected static function boot()
{
    parent::boot();

    static::addGlobalScope('order', function ($builder) {
        $builder->orderBy('first_name')->orderBy('last_name');
    });
}

This would throw a Instantiation of 'Closure' is not allowed before.

luisdalmolin commented 1 year ago

@boumanb Thank you, this sounds great. Would you mind adding a test covering this use case? Then I'll merge and tag this change.

boumanb commented 1 year ago

@boumanb Thank you, this sounds great. Would you mind adding a test covering this use case? Then I'll merge and tag this change.

Done. Thanks.