Some checks failed
tests / ci (pull_request) Has been cancelled
- Removed unnecessary "use client" directive from checkbox and select components. - Added new Drawer component with associated subcomponents (DrawerTrigger, DrawerClose, etc.) for better UI management. - Introduced Table component with TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, and TableCaption for structured data display. - Added Tabs component with TabsList, TabsTrigger, and TabsContent for tabbed navigation. - Updated user-info component to use full_name instead of name for better clarity. - Modified user-menu-content to include translations for settings and logout options. - Added data.json file for mock data in the dashboard. - Updated dashboard page to utilize new components and improved layout. - Refactored User type to replace name with full_name for consistency across the application.
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Appends;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
#[Hidden(['password'])]
|
|
#[Guarded(['id', 'last_login_at'])]
|
|
#[Appends(['full_name'])]
|
|
class User extends Authenticatable
|
|
{
|
|
use HasFactory, Notifiable, SoftDeletes;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_active' => 'boolean',
|
|
'last_login_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'two_factor_confirmed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
protected function fullName(): Attribute
|
|
{
|
|
return Attribute::get(function () {
|
|
return $this->profile?->full_name ?? $this->username;
|
|
});
|
|
}
|
|
|
|
public function profile(): HasOne
|
|
{
|
|
return $this->hasOne(UserProfile::class);
|
|
}
|
|
}
|