first commit

This commit is contained in:
salam committed 2025-09-04 16:06:17 +02:00
commit c9b36775da
180 files changed
+18476

No files matched your search

+97
View File
@@ -0,0 +1,97 @@
<?php
namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
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 Illuminate\Support\Facades\Log;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, HasRoles, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'super_admin',
'app_verified_at',
'first_name',
'last_name',
'gender',
'company',
'uid',
'address',
'place',
'postcode',
'phone',
];
/**
* 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',
'app_verified_at' => 'datetime',
];
}
public function canAccessPanel(Panel $panel): bool
{
Log::info('canAccessPanel');
return true;
}
public function canAccessAdminPanel(Panel $panel): bool
{
Log::info('canAccessAdminPanel');
if ($panel->getId() === 'admin') {
return (
str_ends_with($this->email, '@webwerkstatt.tirol') ||
str_ends_with($this->email, '@kammerwest.at')
)
&& $this->hasVerifiedEmail();
}
return false;
}
public function kammer()
{
return $this->belongsTo(Kammer::class);
}
public function bundesland()
{
return $this->belongsTo(Bundesland::class);
}
}