mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
feat(ModelsCommand): add support for the new Scope attribute (#1694)
* composer fix-style * feat(model): add support for new Scope attribute * composer fix-style * snapshot * check if class_exists for psalm * check if class_exists for psalm * resolve psalm issue * remove prefix slash * revert whitespace changes * composer fix-style * Update composer.json --------- Co-authored-by: laravel-ide-helper <[email protected]> Co-authored-by: Barry vd. Heuvel <[email protected]>
This commit is contained in:
co-authored by
laravel-ide-helper
Barry vd. Heuvel
parent
d567978ebe
commit
8eec4f1ff5
@@ -669,9 +669,11 @@ class ModelsCommand extends Command
|
||||
$comment = $this->getCommentFromDocBlock($reflection);
|
||||
$this->setProperty($name, null, null, true, $comment);
|
||||
}
|
||||
} elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes') {
|
||||
} elseif (!empty($reflection->getAttributes('Illuminate\Database\Eloquent\Attributes\Scope')) || (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes')) {
|
||||
$scopeUsingAttribute = !empty($reflection->getAttributes('Illuminate\Database\Eloquent\Attributes\Scope'));
|
||||
|
||||
//Magic scope<name>Attribute
|
||||
$name = Str::camel(substr($method, 5));
|
||||
$name = $scopeUsingAttribute ? $method : Str::camel(substr($method, 5));
|
||||
if (!empty($name)) {
|
||||
$comment = $this->getCommentFromDocBlock($reflection);
|
||||
$args = $this->getParameters($reflection);
|
||||
|
||||
Reference in New Issue
Block a user