first commit

This commit is contained in:
2023-02-22 22:32:00 +08:00
commit 41617fe0cf
351 changed files with 51358 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Departments extends Model{
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Permissions extends Model{
protected $casts = [
'hidden' => 'integer',
'hiddenBreadcrumb' => 'integer',
'affix' => 'integer',
'fullpage' => 'integer',
];
protected $appends = ['meta'];
protected function meta(): Attribute{
return Attribute::make(
get: fn ($value, $data) => [
'title' => $data['title'],
'type' => $data['type'],
'icon' => $data['icon'],
'color' => $data['color'],
'hidden' => $data['hidden'],
'hiddenBreadcrumb' => $data['hiddenBreadcrumb'],
'affix' => $data['affix'],
'fullpage' => $data['fullpage'],
],
);
}
}

View File

@@ -0,0 +1,15 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class RoleHasPermissions extends Model{
}

View File

@@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Roles extends Model{
public function permissions(){
return $this->belongsToMany(Permissions::class, RoleHasPermissions::class, 'permission_id', 'role_id');
}
}

View File

@@ -0,0 +1,15 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class UserHasRoles extends Model{
}

View File

@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class Users extends Authenticatable implements JWTSubject{
use Notifiable;
protected $primaryKey = 'uid';
// Rest omitted for brevity
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier(){
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims(){
return [];
}
/**
* @title 角色关联
*
* @return void
*/
public function roles(){
return $this->belongsToMany(Roles::class, UserHasRoles::class, 'role_id', 'uid');
}
/**
* @title 部门关联
*
* @return void
*/
public function department(){
return $this->hasOne(Departments::class, 'id', 'department_id');
}
}

View File

@@ -0,0 +1,20 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Model;
class UsersLog extends Model{
protected $table = 'users_log';
public function user(){
return $this->hasOne(Users::class, 'uid', 'uid');
}
}