PortIO/app/Models/User.php

60 lines
1.2 KiB
PHP
Raw Normal View History

2023-03-14 14:33:06 +00:00
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2023-03-16 13:36:59 +00:00
use Illuminate\Database\Eloquent\Relations\HasMany;
2023-03-14 14:33:06 +00:00
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
2023-05-14 10:17:59 +00:00
'traffic',
'realnamed'
2023-03-14 14:33:06 +00:00
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
2023-03-15 13:37:41 +00:00
'is_admin' => 'boolean',
2023-03-14 14:33:06 +00:00
];
2023-03-15 13:37:41 +00:00
2023-03-15 13:42:40 +00:00
public function isAdmin()
{
2023-03-15 13:37:41 +00:00
return $this->is_admin;
}
// tunnels
2023-03-16 13:36:59 +00:00
public function tunnels(): HasMany
2023-03-15 13:37:41 +00:00
{
return $this->hasMany(Tunnel::class);
}
2023-03-14 14:33:06 +00:00
}