SupportRequest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Models;
  3. use App\Enums\SupportRequestStatusEnum;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  7. use Illuminate\Database\Eloquent\SoftDeletes;
  8. /**
  9. * @property int $id
  10. * @property int|null $user_id
  11. * @property string|null $user_type
  12. * @property string|null $name
  13. * @property string|null $email
  14. * @property string|null $phone
  15. * @property string $category
  16. * @property string $title
  17. * @property string $message
  18. * @property SupportRequestStatusEnum $status
  19. * @property int|null $handled_by
  20. * @property \Illuminate\Support\Carbon|null $resolved_at
  21. * @property \Illuminate\Support\Carbon|null $created_at
  22. * @property \Illuminate\Support\Carbon|null $updated_at
  23. * @property \Illuminate\Support\Carbon|null $deleted_at
  24. * @property-read \App\Models\User|null $user
  25. * @property-read \App\Models\User|null $handler
  26. */
  27. class SupportRequest extends Model
  28. {
  29. use HasFactory, SoftDeletes;
  30. protected $table = 'support_requests';
  31. protected $guarded = [
  32. 'id',
  33. ];
  34. protected $fillable = [
  35. 'user_id',
  36. 'user_type',
  37. 'name',
  38. 'email',
  39. 'phone',
  40. 'category',
  41. 'title',
  42. 'message',
  43. 'status',
  44. 'handled_by',
  45. 'resolved_at',
  46. ];
  47. protected $casts = [
  48. 'status' => SupportRequestStatusEnum::class,
  49. 'resolved_at' => 'datetime',
  50. 'created_at' => 'datetime',
  51. 'updated_at' => 'datetime',
  52. 'deleted_at' => 'datetime',
  53. ];
  54. public function user(): BelongsTo
  55. {
  56. return $this->belongsTo(User::class, 'user_id');
  57. }
  58. public function handler(): BelongsTo
  59. {
  60. return $this->belongsTo(User::class, 'handled_by');
  61. }
  62. }