-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Add CollectedBy attribute (#53122)
* Add CollectedBy attribute * Fix styling * Fix null checks * Fix styling * Fix type checks * Wrap collection class name resolution in once * Fix docblock return type Co-authored-by: Jeffrey Angenent <[email protected]> * Use static variable instead of once function to memoize * formatting --------- Co-authored-by: Jeffrey Angenent <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
- Loading branch information
1 parent
ddfbbf0
commit 04e2e19
Showing
5 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/Illuminate/Database/Eloquent/Attributes/CollectedBy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database\Eloquent\Attributes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
class CollectedBy | ||
{ | ||
/** | ||
* Create a new attribute instance. | ||
* | ||
* @param class-string<\Illuminate\Database\Eloquent\Collection<*, *>> $collectionClass | ||
* @return void | ||
*/ | ||
public function __construct(public string $collectionClass) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters