mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-16 14:54:02 +00:00
Custom tenant collections
This commit is contained in:
parent
1a8d150f2c
commit
5e99fca070
4 changed files with 86 additions and 1 deletions
23
src/Database/Collections/TenantCollection.php
Normal file
23
src/Database/Collections/TenantCollection.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Database\Collections;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
|
||||
/**
|
||||
* @property Tenant[] $items
|
||||
* @method void __construct(Tenant[] $items = [])
|
||||
* @method Tenant[] toArray()
|
||||
* @method Tenant offsetGet($key)
|
||||
* @method Tenant first()
|
||||
*/
|
||||
class TenantCollection extends Collection
|
||||
{
|
||||
public function runForEach(callable $callable): self
|
||||
{
|
||||
tenancy()->runForMultiple($this->items, $callable);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue