mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
...
This commit is contained in:
@@ -11,10 +11,37 @@ abstract class Model
|
||||
protected array $fillable = [];
|
||||
protected array $hidden = [];
|
||||
protected array $casts = [];
|
||||
protected array $attributes = [];
|
||||
|
||||
public function __construct(\PDO $pdo)
|
||||
public function __construct(\PDO $pdo, array $data = [])
|
||||
{
|
||||
$this->pdo = $pdo;
|
||||
$this->attributes = $data;
|
||||
}
|
||||
|
||||
public function __get(string $key)
|
||||
{
|
||||
return $this->attributes[$key] ?? null;
|
||||
}
|
||||
|
||||
public function __set(string $key, $value)
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
public function __isset(string $key): bool
|
||||
{
|
||||
return isset($this->attributes[$key]);
|
||||
}
|
||||
|
||||
public function getAttributes(): array
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
public function setAttributes(array $data)
|
||||
{
|
||||
$this->attributes = $data;
|
||||
}
|
||||
|
||||
public function find(int $id): ?array
|
||||
|
||||
Reference in New Issue
Block a user