Skip to content

Commit

Permalink
v73.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Mar 16, 2024
1 parent a2a4a66 commit e50e1e1
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 51 deletions.
128 changes: 77 additions & 51 deletions src/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* \Playground\Models\User
*
* @property string $id
* @property string $created_by_id
* @property string $modified_by_id
* @property ?string $created_by_id
* @property ?string $modified_by_id
* @property string $user_type
* @property ?Carbon $created_at
* @property ?Carbon $updated_at
Expand Down Expand Up @@ -200,6 +200,17 @@ class User extends Authenticatable implements
'status',
'rank',
'size',
'matrix',
'x',
'y',
'z',
'r',
'theta',
'rho',
'phi',
'elevation',
'latitude',
'longitude',
'active',
'banned',
'flagged',
Expand Down Expand Up @@ -264,57 +275,72 @@ class User extends Authenticatable implements
];

/**
* The attributes that should be cast.
* Get the attributes that should be cast.
*
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'email_verified_at' => 'datetime',
'banned_at' => 'datetime',
'suspended_at' => 'datetime',
'gids' => 'integer',
'po' => 'integer',
'pg' => 'integer',
'pw' => 'integer',
'status' => 'integer',
'rank' => 'integer',
'size' => 'integer',
// Boolean
'active' => 'boolean',
'banned' => 'boolean',
'flagged' => 'boolean',
'internal' => 'boolean',
'locked' => 'boolean',
'problem' => 'boolean',
'suspended' => 'boolean',
'unknown' => 'boolean',
// 'id' => 'uuid',
'name' => 'string',
'email' => 'string',
'locale' => 'string',
'phone' => 'encrypted',
'timezone' => 'string',
'role' => 'string',
'description' => 'string',
'image' => 'string',
'avatar' => 'string',
// json
'abilities' => 'array',
'accounts' => 'encrypted:array',
'address' => 'encrypted:array',
'contact' => 'encrypted:array',
'meta' => 'encrypted:array',
'notes' => 'encrypted:array',
'options' => 'encrypted:array',
'registration' => 'encrypted:array',
'roles' => 'array',
'permissions' => 'array',
'privileges' => 'array',
'ui' => 'array',
];
protected function casts(): array
{
return [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'email_verified_at' => 'datetime',
'banned_at' => 'datetime',
'suspended_at' => 'datetime',
'gids' => 'integer',
'po' => 'integer',
'pg' => 'integer',
'pw' => 'integer',
'status' => 'integer',
'rank' => 'integer',
'size' => 'integer',
// Matrix
'matrix' => 'string',
'x' => 'integer',
'y' => 'integer',
'z' => 'integer',
'r' => 'float',
'theta' => 'float',
'rho' => 'float',
'phi' => 'float',
'elevation' => 'float',
'latitude' => 'float',
'longitude' => 'float',
// Boolean
'active' => 'boolean',
'banned' => 'boolean',
'flagged' => 'boolean',
'internal' => 'boolean',
'locked' => 'boolean',
'problem' => 'boolean',
'suspended' => 'boolean',
'unknown' => 'boolean',
// 'id' => 'uuid',
'name' => 'string',
'email' => 'string',
'locale' => 'string',
'phone' => 'encrypted',
'timezone' => 'string',
'role' => 'string',
'description' => 'string',
'image' => 'string',
'avatar' => 'string',
// json
'abilities' => 'array',
'accounts' => 'encrypted:array',
'address' => 'encrypted:array',
'contact' => 'encrypted:array',
'meta' => 'encrypted:array',
'notes' => 'encrypted:array',
'options' => 'encrypted:array',
'registration' => 'encrypted:array',
'roles' => 'array',
'permissions' => 'array',
'privileges' => 'array',
'ui' => 'array',
];
}

/**
* Disable auto-incrementing primary when using a UUID column.
Expand Down
6 changes: 6 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public function about(array $config): void
'<fg=cyan;options=bold>User</> Playground\Models\Concerns\Role' => $this->userPlaygroundRoleConcerns ? '<fg=green;options=bold>USED</>' : '<fg=yellow;options=bold>NOT USED</>',
'<fg=cyan;options=bold>User</> Playground\Models\Contracts\Role' => $this->userHasPlaygroundRoleContracts ? '<fg=green;options=bold>IMPLEMENTED</>' : '<fg=yellow;options=bold>NOT IMPLEMENTED</>',

'<fg=cyan;options=bold>User</> Playground\Models\Contracts\WithMatrix' => $this->userHasPlaygroundMatrixContracts ? '<fg=green;options=bold>IMPLEMENTED</>' : '<fg=yellow;options=bold>NOT IMPLEMENTED</>',

'Packages' => implode(', ', $packages),
'Package' => $this->package,
'Version' => $version,
Expand Down Expand Up @@ -144,6 +146,8 @@ public function userPrimaryKeyType(string $auth_providers_users_model = null): s

protected bool $userHasPlaygroundRoleContracts;

protected bool $userHasPlaygroundMatrixContracts;

/**
* @param class-string $auth_providers_users_model
*/
Expand Down Expand Up @@ -185,6 +189,8 @@ private function userPrimaryKeyTypeParse(string $auth_providers_users_model): st
$this->userPlaygroundRoleConcerns = in_array(Models\Concerns\Role::class, class_uses_recursive($user));
$this->userHasPlaygroundRoleContracts = $user instanceof Models\Contracts\Role;

$this->userHasPlaygroundMatrixContracts = $user instanceof Models\Contracts\WithMatrix;

if (in_array(\Illuminate\Database\Eloquent\Concerns\HasUuids::class, class_uses_recursive($user))
&& ! $user->getIncrementing()
) {
Expand Down

0 comments on commit e50e1e1

Please sign in to comment.