docs
docs copied to clipboard
Add global scope for Winter 1.1.x version
Global scopes documentation seem to refer only to Laravel 9.x (Winter 1.2.x), for previous version that are based on Laravel 6.x classes and methods are different (see https://laravel.com/docs/6.x/eloquent#global-scopes )
See issue https://github.com/wintercms/winter/issues/747
@webbati maybe reference this in the PR:
https://laravel.com/docs/6.x/eloquent#global-scopes
@webbati this doesn't seem right? The original code was documented 16 months ago, so it (assumedly) must've worked with Laravel 6. Your global scope example seems to just replace the Winter versions of the model, query and builder classes with the base Laravel classes. Could you explain more on why the original code examples did not work?
@webbati my apologies, I read your linked issue and understand the problem now.
Is it really necessary to change the class imports back to Illuminate or is it just required to make the booted() vs boot() change?
This should also be submitted to the 1.1 branch btw (https://github.com/wintercms/docs/tree/1.1), @bennothommo's new documentation site that will be out soon will allow you to switch between versions of the docs
@LukeTowers Yes, it's necessary or you will get an error
Declaration of Concreta\Zuum\Scopes\OwnedScope::apply(Winter\Storm\Database\Builder $builder, Winter\Storm\Database\Model $model) must be compatible with Illuminate\Database\Eloquent\Scope::apply(Illuminate\Database\Eloquent\Builder $builder, Illuminate\Database\Eloquent\Model $model)
@webbati can you resubmit this targeting only the 1.1 branch?
@LukeTowers done https://github.com/wintercms/docs/pull/110
Closed in favour of #111.