first commit
This commit is contained in:
16
app/Models/System/Area.php
Normal file
16
app/Models/System/Area.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
class Area extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_areas';
|
||||
protected $fillable = ['title', 'parent_id', 'status'];
|
||||
protected $hidden = ['deleted_at'];
|
||||
}
|
||||
39
app/Models/System/Client.php
Normal file
39
app/Models/System/Client.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Client extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_client';
|
||||
protected $fillable = ['title', 'app_id', 'secret', 'redirect', 'status'];
|
||||
|
||||
protected function casts(): array {
|
||||
return [
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function appId() : Attribute {
|
||||
return Attribute::make(
|
||||
set: function (mixed $value, array $data){
|
||||
return uniqid();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function secret() : Attribute {
|
||||
return Attribute::make(
|
||||
set: function (mixed $value, array $data){
|
||||
return md5(uniqid());
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
27
app/Models/System/ClientMenu.php
Normal file
27
app/Models/System/ClientMenu.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class ClientMenu extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_client_menu';
|
||||
protected $with = ['client'];
|
||||
|
||||
protected function casts(): array {
|
||||
return [
|
||||
'status' => 'integer',
|
||||
'sort' => 'integer',
|
||||
];
|
||||
}
|
||||
public function client(){
|
||||
return $this->belongsTo(Client::class, 'client_id', 'id');
|
||||
}
|
||||
}
|
||||
45
app/Models/System/Config.php
Normal file
45
app/Models/System/Config.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Config extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_configs';
|
||||
protected $fillable = ['values', 'name', 'title', 'group', 'remark', 'type', 'status', 'sort'];
|
||||
protected $hidden = ['deleted_at'];
|
||||
|
||||
protected function casts(): array {
|
||||
return [
|
||||
'option' => 'json',
|
||||
];
|
||||
}
|
||||
|
||||
public function options(): Attribute {
|
||||
return Attribute::make(
|
||||
get: fn (mixed $value, array $data) => [
|
||||
'placeholder' => $data['title'],
|
||||
'options' => $data['option'] ? json_decode($data['option'], true) : [],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function label() : Attribute {
|
||||
return Attribute::make(
|
||||
get: fn (mixed $value, array $data) => $data['title'],
|
||||
);
|
||||
}
|
||||
|
||||
public function prop() : Attribute {
|
||||
return Attribute::make(
|
||||
get: fn (mixed $value, array $data) => $data['title'],
|
||||
);
|
||||
}
|
||||
}
|
||||
24
app/Models/System/Crontab.php
Normal file
24
app/Models/System/Crontab.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Crontab extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_crontabs';
|
||||
protected $fillable = [];
|
||||
protected $hidden = ['deleted_at'];
|
||||
|
||||
protected function casts(): array {
|
||||
return [
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Models/System/Dict.php
Normal file
22
app/Models/System/Dict.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Dict extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_dicts';
|
||||
protected $fillable = ['title', 'values', 'group_id', 'group_name', 'sort', 'status'];
|
||||
protected $hidden = ['deleted_at'];
|
||||
|
||||
public function group(){
|
||||
return $this->belongsTo(DictGroup::class, 'group_id', 'id');
|
||||
}
|
||||
}
|
||||
25
app/Models/System/DictGroup.php
Normal file
25
app/Models/System/DictGroup.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
class DictGroup extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_dict_groups';
|
||||
protected $fillable = ['title', 'name', 'parent_id', 'sort', 'status'];
|
||||
protected $hidden = ['deleted_at'];
|
||||
|
||||
protected function casts(): array {
|
||||
return [
|
||||
'parent_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
'sort' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
22
app/Models/System/Log.php
Normal file
22
app/Models/System/Log.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use App\Models\Auth\Admin;
|
||||
|
||||
class Log extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_logs';
|
||||
protected $fillable = ['title', 'name', 'url', 'method', 'client_ip', 'browser', 'user_id', 'data', 'remark', 'status'];
|
||||
protected $hidden = ['deleted_at'];
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(Admin::class, 'user_id', 'uid');
|
||||
}
|
||||
}
|
||||
13
app/Models/System/Modules.php
Normal file
13
app/Models/System/Modules.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
class Modules extends \App\Models\BaseModel {
|
||||
//
|
||||
}
|
||||
31
app/Models/System/Tasks.php
Normal file
31
app/Models/System/Tasks.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace App\Models\System;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\Auth\Admin;
|
||||
|
||||
class Tasks extends \App\Models\BaseModel {
|
||||
|
||||
protected $table = 'system_tasks';
|
||||
protected $fillable = [];
|
||||
protected $hidden = ['deleted_at'];
|
||||
protected $append = ['url'];
|
||||
|
||||
public function url(): Attribute{
|
||||
return Attribute::make(
|
||||
get: fn (mixed $value, array $data) => Storage::disk('public')->url($data['file']),
|
||||
);
|
||||
}
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(Admin::class, 'user_id', 'uid');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user