Implemented the authenticated admin contact system.

This commit is contained in:
2026-05-16 22:02:32 +03:30
parent 04e7931ccc
commit e633805ed3
28 changed files with 2200 additions and 14 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests;
use App\Models\SupportConversation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreSupportConversationRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'category' => ['required', 'string', Rule::in(SupportConversation::categories())],
'subject' => ['required', 'string', 'max:120'],
'body' => ['required', 'string', 'max:2000'],
'attachments' => ['nullable', 'array', 'max:3'],
'attachments.*' => ['file', 'max:10240', 'mimes:jpg,jpeg,png,webp,gif,pdf,txt,log,json,zip'],
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreSupportMessageRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* @return array<string, array<int, string>>
*/
public function rules(): array
{
return [
'body' => ['required', 'string', 'max:2000'],
'attachments' => ['nullable', 'array', 'max:3'],
'attachments.*' => ['file', 'max:10240', 'mimes:jpg,jpeg,png,webp,gif,pdf,txt,log,json,zip'],
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests;
use App\Models\SupportConversation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateSupportConversationStatusRequest extends FormRequest
{
public function authorize(): bool
{
return (bool) $this->user()?->is_admin;
}
/**
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'status' => ['required', 'string', Rule::in(SupportConversation::statuses())],
];
}
}