初始化本地仓库
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model\plugin;
|
||||
|
||||
use app\model\system\Admin;
|
||||
use core\base\BaseModel;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationAuth extends BaseModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'plugin_application_auth';
|
||||
|
||||
protected $appends = ['expired_date', 'created_date', 'updated_date', 'created_name', 'updated_name'];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'name',
|
||||
'access_key',
|
||||
'secret_key',
|
||||
'expired_at',
|
||||
'enabled',
|
||||
'description',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'expired_at' => 'integer',
|
||||
'enabled' => 'integer',
|
||||
'created_at' => 'integer',
|
||||
'updated_at' => 'integer',
|
||||
'deleted_at' => 'integer',
|
||||
];
|
||||
|
||||
public function createds(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Admin::class, 'id', 'created_by')->select('id', 'real_name as created_name');
|
||||
}
|
||||
|
||||
public function updateds(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Admin::class, 'id', 'updated_by')->select('id', 'real_name as updated_name');
|
||||
}
|
||||
|
||||
public function getExpiredDateAttribute(): ?string
|
||||
{
|
||||
$timestamp = $this->getRawOriginal('expired_at');
|
||||
if (empty($timestamp)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return \Carbon\Carbon::createFromTimestamp((int)$timestamp)
|
||||
->setTimezone(config('app.default_timezone'))
|
||||
->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function getCreatedNameAttribute(): string
|
||||
{
|
||||
return $this->createds?->created_name ?? '';
|
||||
}
|
||||
|
||||
public function getUpdatedNameAttribute(): string
|
||||
{
|
||||
return $this->updateds?->updated_name ?? '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: https://madong.tech
|
||||
*/
|
||||
|
||||
namespace app\model\plugin;
|
||||
|
||||
use core\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 系统插件
|
||||
*
|
||||
* @author Mr.April
|
||||
* @since 1.0
|
||||
*/
|
||||
class Plugin extends BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'plugin';
|
||||
|
||||
/**
|
||||
* 指示是否自动维护时间戳
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = true;
|
||||
|
||||
protected $appends = ['created_date', 'updated_date'];
|
||||
|
||||
/**
|
||||
* 时间格式为Unix时间戳
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $dateFormat = 'U';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'title',
|
||||
'icon',
|
||||
'key',
|
||||
'desc',
|
||||
'status',
|
||||
'author',
|
||||
'version',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'installed_at',
|
||||
'cover',
|
||||
'type',
|
||||
'variables',
|
||||
'support_app',
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: https://madong.tech
|
||||
*/
|
||||
|
||||
namespace app\model\plugin;
|
||||
|
||||
use core\base\BaseModel;
|
||||
|
||||
/**
|
||||
* 系统插件日志
|
||||
*
|
||||
* @author Mr.April
|
||||
* @since 1.0
|
||||
*/
|
||||
class PluginLog extends BaseModel
|
||||
{
|
||||
protected $table = 'plugin_log';
|
||||
|
||||
/**
|
||||
* 指示是否自动维护时间戳
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = true;
|
||||
|
||||
protected $appends = ['created_date', 'updated_date'];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'action',
|
||||
'key',
|
||||
'pre_upgrade_version',
|
||||
'post_upgrade_version',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user