Some checks failed
tests / ci (pull_request) Has been cancelled
- Add FeedbackController to handle feedback submissions and management. - Create Feedback model and migration for feedbacks table. - Introduce FeedbackStatus and FeedbackType enums for better type handling. - Implement FeedbackService for business logic related to feedback. - Create FeedbackRequest for validation of feedback data. - Add Tiptap rich text editor for feedback message input. - Develop frontend components for displaying and managing feedback. - Add routes for feedback management in web.php. - Create utility types for feedback in TypeScript. - Update app-sidebar to include feedback navigation.
64 lines
1.6 KiB
PHP
64 lines
1.6 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\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
#[Hidden(['password'])]
|
|
#[Guarded(['id', 'last_login_at'])]
|
|
#[Appends(['full_name'])]
|
|
class User extends Authenticatable
|
|
{
|
|
use HasFactory, HasRoles, 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(fn () => $this->profile?->full_name ?? $this->username);
|
|
}
|
|
|
|
public function profile(): HasOne
|
|
{
|
|
return $this->hasOne(UserProfile::class);
|
|
}
|
|
|
|
public function student(): HasOne
|
|
{
|
|
return $this->hasOne(Student::class);
|
|
}
|
|
|
|
public function lecturer(): HasOne
|
|
{
|
|
return $this->hasOne(Lecturer::class);
|
|
}
|
|
|
|
public function notifications(): HasMany
|
|
{
|
|
return $this->hasMany(Notification::class);
|
|
}
|
|
|
|
public function feedbacks(): HasMany
|
|
{
|
|
return $this->hasMany(Feedback::class);
|
|
}
|
|
}
|