mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-12-05 08:44:59 -06:00
Setup default admin and view-log role and permission (the whole reason i added all this stuff).
also added artisan command to give user a role via command line with artisan permissions:AddRoleToUser {rolename} {userId}
33 lines
720 B
PHP
33 lines
720 B
PHP
<?php
|
|
|
|
namespace App\Models\User;
|
|
|
|
use Illuminate\Auth\Authenticatable;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
/**
|
|
* @mixin \Eloquent
|
|
* @mixin IdeHelperUser
|
|
*/
|
|
class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable
|
|
{
|
|
use HasUuids, Authenticatable, HasRoles;
|
|
|
|
protected $fillable = [
|
|
'steam_id',
|
|
];
|
|
|
|
public function ban(): HasOne
|
|
{
|
|
return $this->hasOne(Ban::class);
|
|
}
|
|
|
|
public static function findBySteamID(int $steamId): User|null
|
|
{
|
|
return static::where('steam_id', $steamId)->first();
|
|
}
|
|
}
|