- Departments + cross-department transfer workflow - Role-based closing (staff→resolved, manager→closed) with proof_of_resolution - Private file storage with collection system + temporary signed URLs - Dashboard: resolved tickets table, stats, handler performance bar chart - Spatie RBAC (admin/manager/staff) - Notifications: TicketTransferred, TicketClosed (database + mail) - Pest tests: 8 tests, 21 assertions - Docker production-ready (Dockerfile + compose + entrypoint)
33 lines
818 B
PHP
33 lines
818 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['name', 'manager_id'])]
|
|
class Department extends Model
|
|
{
|
|
public function manager(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'manager_id');
|
|
}
|
|
|
|
public function feedbacks(): HasMany
|
|
{
|
|
return $this->hasMany(Feedback::class, 'current_department_id');
|
|
}
|
|
|
|
public function transferLogsFrom(): HasMany
|
|
{
|
|
return $this->hasMany(TicketTransferLog::class, 'from_department_id');
|
|
}
|
|
|
|
public function transferLogsTo(): HasMany
|
|
{
|
|
return $this->hasMany(TicketTransferLog::class, 'to_department_id');
|
|
}
|
|
}
|