mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-09 03:35:14 -05:00
Added package spatie/laravel-permission for adding roles and permissions.
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}
This commit is contained in:
10
dist/app/Models/User/User.php
vendored
10
dist/app/Models/User/User.php
vendored
@@ -2,18 +2,19 @@
|
||||
|
||||
namespace App\Models\User;
|
||||
|
||||
use App\Models\IdeHelperUser;
|
||||
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;
|
||||
use HasUuids, Authenticatable, HasRoles;
|
||||
|
||||
protected $fillable = [
|
||||
'steam_id',
|
||||
@@ -23,4 +24,9 @@ public function ban(): HasOne
|
||||
{
|
||||
return $this->hasOne(Ban::class);
|
||||
}
|
||||
|
||||
public static function findBySteamID(int $steamId): User|null
|
||||
{
|
||||
return static::where('steam_id', $steamId)->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user