You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Model;
|
|
|
|
|
|
|
|
use App\Scopes\CommonTimeScopes;
|
|
|
|
use Hyperf\DbConnection\Model\Model as BaseModel;
|
|
|
|
|
|
|
|
abstract class Model extends BaseModel
|
|
|
|
{
|
|
|
|
use CommonTimeScopes;
|
|
|
|
|
|
|
|
public $timestamps = false;
|
|
|
|
|
|
|
|
public static function alias($alias = null)
|
|
|
|
{
|
|
|
|
$name = with(new static)->getTable();
|
|
|
|
if ($alias) {
|
|
|
|
$name .= ' as ' . $alias;
|
|
|
|
}
|
|
|
|
return $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function fromAlias($alias)
|
|
|
|
{
|
|
|
|
return static::from(static::alias($alias));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRawAttribute($key)
|
|
|
|
{
|
|
|
|
if (!$key) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return $this->attributes[$key] ?? null;
|
|
|
|
}
|
|
|
|
}
|