mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 23:14:03 +00:00
HasArrayAccess trait
This commit is contained in:
parent
f471a1a7e4
commit
798df54d76
1 changed files with 26 additions and 0 deletions
26
src/Traits/HasArrayAccess.php
Normal file
26
src/Traits/HasArrayAccess.php
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stancl\Tenancy\Traits;
|
||||||
|
|
||||||
|
trait HasArrayAccess
|
||||||
|
{
|
||||||
|
public function offsetExists($offset): bool
|
||||||
|
{
|
||||||
|
return property_exists($this, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
return $this->$offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetSet($offset, $value): void
|
||||||
|
{
|
||||||
|
$this->$offset = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetUnset($offset): void
|
||||||
|
{
|
||||||
|
unset($this->$offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue