new helpdesk module

This commit is contained in:
Mark Gregory
2026-06-12 10:10:52 +01:00
parent 28a34cfa87
commit 67faed6165
26 changed files with 630 additions and 11 deletions
+4 -1
View File
@@ -17,7 +17,10 @@ final class Category extends Model
protected $table = 'helpdesk_categories';
/** @var list<string> */
protected $fillable = ['name', 'slug', 'color', 'description'];
protected $fillable = ['company_id', 'name', 'slug', 'color', 'description'];
/** @var array<string, string> */
protected $casts = ['company_id' => 'integer'];
/** @return HasMany<Ticket> */
public function tickets(): HasMany
+9 -2
View File
@@ -6,6 +6,7 @@ namespace Modules\Helpdesk\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -17,10 +18,16 @@ final class Project extends Model
protected $table = 'helpdesk_projects';
/** @var list<string> */
protected $fillable = ['title', 'slug', 'color', 'description', 'archived_at'];
protected $fillable = ['company_id', 'team_id', 'title', 'slug', 'color', 'description', 'archived_at'];
/** @var array<string, string> */
protected $casts = ['archived_at' => 'datetime'];
protected $casts = ['company_id' => 'integer', 'team_id' => 'integer', 'archived_at' => 'datetime'];
/** @return BelongsTo<Team, Project> */
public function team(): BelongsTo
{
return $this->belongsTo(Team::class, 'team_id');
}
/** @return HasMany<Ticket> */
public function tickets(): HasMany
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace Modules\Helpdesk\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Team extends Model
{
use HasFactory;
use SoftDeletes;
protected $table = 'helpdesk_teams';
/** @var list<string> */
protected $fillable = ['company_id', 'name', 'slug', 'color', 'description', 'archived_at'];
/** @var array<string, string> */
protected $casts = [
'company_id' => 'integer',
'archived_at' => 'datetime',
];
/** @return HasMany<Project> */
public function projects(): HasMany
{
return $this->hasMany(Project::class, 'team_id');
}
/** @return HasMany<Ticket> */
public function tickets(): HasMany
{
return $this->hasMany(Ticket::class, 'team_id');
}
}
+9 -1
View File
@@ -27,12 +27,14 @@ final class Ticket extends Model
/** @var list<string> */
protected $fillable = [
'reference', 'user_id', 'agent_id', 'status_id', 'priority_id', 'category_id', 'project_id',
'reference', 'company_id', 'user_id', 'agent_id', 'status_id', 'priority_id', 'category_id', 'project_id', 'team_id',
'subject', 'body', 'due_at', 'completed_at', 'last_activity_at', 'archived_at',
];
/** @var array<string, string> */
protected $casts = [
'company_id' => 'integer',
'team_id' => 'integer',
'due_at' => 'datetime',
'completed_at' => 'datetime',
'last_activity_at' => 'datetime',
@@ -75,6 +77,12 @@ final class Ticket extends Model
return $this->belongsTo(Project::class, 'project_id');
}
/** @return BelongsTo<Team, Ticket> */
public function team(): BelongsTo
{
return $this->belongsTo(Team::class, 'team_id');
}
/** @return HasMany<Comment> */
public function comments(): HasMany
{