File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ protected function getInfo($className)
155
155
->toArray ();
156
156
157
157
$ data ['scopes ' ] = collect ($ reflection ->getMethods ())
158
- ->filter (fn ($ method ) => $ method ->isPublic () && ! $ method ->isStatic () && str_starts_with ($ method ->name , 'scope ' ))
158
+ ->filter (fn ($ method ) =>! $ method ->isStatic () && ( $ method ->getAttributes (\ Illuminate \ Database \ Eloquent \ Attributes \Scope::class) || ( $ method -> isPublic () && str_starts_with ($ method ->name , 'scope ' )) ))
159
159
->map (fn ($ method ) => str ($ method ->name )->replace ('scope ' , '' )->lcfirst ()->toString ())
160
160
->values ()
161
161
->toArray ();
@@ -175,8 +175,8 @@ public function methods()
175
175
{
176
176
$ reflection = new \ReflectionClass (\Illuminate \Database \Query \Builder::class);
177
177
178
- return collect ($ reflection ->getMethods (\ReflectionMethod::IS_PUBLIC ))
179
- ->filter (fn (ReflectionMethod $ method ) => !str_starts_with ($ method ->getName (), "__ " ))
178
+ return collect ($ reflection ->getMethods (\ReflectionMethod::IS_PUBLIC | \ReflectionMethod:: IS_PROTECTED ))
179
+ ->filter (fn (ReflectionMethod $ method ) => !str_starts_with ($ method ->getName (), "__ " ) || (! $ method -> isPublic () && empty ( $ method -> getAttributes (\ Illuminate \ Database \ Eloquent \ Attributes \Scope::class))) )
180
180
->map (fn (\ReflectionMethod $ method ) => $ this ->getMethodInfo ($ method ))
181
181
->filter ()
182
182
->values ();
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ $models = new class($factory) {
155
155
->toArray();
156
156
157
157
$data['scopes'] = collect($reflection->getMethods())
158
- ->filter(fn($method) => $method->isPublic () && ! $method->isStatic() && str_starts_with($method->name, 'scope'))
158
+ ->filter(fn($method) =>! $method->isStatic () && ( $method->getAttributes(\\Illuminate\\Database\\Eloquent\\Attributes\\Scope::class) || ($method->isPublic() && str_starts_with($method->name, 'scope')) ))
159
159
->map(fn($method) => str($method->name)->replace('scope', '')->lcfirst()->toString())
160
160
->values()
161
161
->toArray();
@@ -175,8 +175,8 @@ $builder = new class($docblocks) {
175
175
{
176
176
$reflection = new \\ReflectionClass(\\Illuminate\\Database\\Query\\Builder::class);
177
177
178
- return collect($reflection->getMethods(\\ReflectionMethod::IS_PUBLIC))
179
- ->filter(fn(ReflectionMethod $method) => !str_starts_with($method->getName(), "__"))
178
+ return collect($reflection->getMethods(\\ReflectionMethod::IS_PUBLIC | \\ReflectionMethod::IS_PROTECTED ))
179
+ ->filter(fn(ReflectionMethod $method) => !str_starts_with($method->getName(), "__") || (!$method->isPublic() && empty($method->getAttributes(\\Illuminate\\Database\\Eloquent\\Attributes\\Scope::class))) )
180
180
->map(fn(\\ReflectionMethod $method) => $this->getMethodInfo($method))
181
181
->filter()
182
182
->values();
You can’t perform that action at this time.
0 commit comments