first commit

This commit is contained in:
2026-01-23 17:28:21 +07:00
commit 29ff8992b9
331 changed files with 30545 additions and 0 deletions

88
app/Models/User.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
class User extends Authenticatable implements FilamentUser
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable, HasRoles, HasUuids;
public function canAccessPanel(Panel $panel): bool
{
return $this->hasAnyRole(['admin', 'super_admin', 'bendahara', 'editor', 'sensei']);
}
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'avatar_url',
'xp_points',
'current_streak',
'metadata',
];
/**
* Get the social accounts for the user.
*/
public function socialAccounts(): HasMany
{
return $this->hasMany(SocialAccount::class);
}
/**
* Get the enrollments for the user.
*/
public function enrollments(): HasMany
{
return $this->hasMany(Enrollment::class);
}
/**
* Get the progress for the user.
*/
public function userProgress(): HasMany
{
return $this->hasMany(UserProgress::class);
}
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'last_activity_at' => 'datetime',
];
}
}