- Added main application entry point (app.jsx) and bootstrap file for React setup. - Created Wiki index page (Index.jsx) for documentation and file management. - Implemented utility functions for formatting and status handling in utils.js. - Set up Blade template (app.blade.php) for Inertia.js integration. - Defined API routes for metrics and terminal access in api.php. - Established console commands for scheduled tasks in console.php. - Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php. - Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments. - Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js. - Set up Vite for asset bundling and development server in vite.config.js.
59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Spatie\Activitylog\Traits\CausesActivity;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use HasApiTokens, HasFactory, HasRoles, Notifiable, SoftDeletes, CausesActivity;
|
|
|
|
protected $fillable = [
|
|
'name', 'email', 'password', 'avatar', 'auth_source',
|
|
'ldap_guid', 'ldap_domain', 'is_active', 'mfa_enabled',
|
|
'mfa_secret', 'mfa_recovery_codes', 'last_login_at',
|
|
'last_login_ip', 'preferences',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password', 'remember_token', 'mfa_secret', 'mfa_recovery_codes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'email_verified_at' => 'datetime',
|
|
'last_login_at' => 'datetime',
|
|
'is_active' => 'boolean',
|
|
'mfa_enabled' => 'boolean',
|
|
'mfa_recovery_codes' => 'encrypted:array',
|
|
'mfa_secret' => 'encrypted',
|
|
'preferences' => 'array',
|
|
'password' => 'hashed',
|
|
];
|
|
|
|
public function getAvatarUrlAttribute(): string
|
|
{
|
|
if ($this->avatar) {
|
|
return asset('storage/' . $this->avatar);
|
|
}
|
|
$hash = md5(strtolower(trim($this->email)));
|
|
return "https://www.gravatar.com/avatar/{$hash}?d=identicon&s=128";
|
|
}
|
|
|
|
public function isLdapUser(): bool
|
|
{
|
|
return $this->auth_source === 'ldap';
|
|
}
|
|
|
|
public function passwordEntries()
|
|
{
|
|
return $this->hasMany(PasswordEntry::class);
|
|
}
|
|
}
|