first commit
This commit is contained in:
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());
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user