mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-07 10:40:48 +01:00
feat: Add Discord alert webhook, ContactCategory enum, form request
- Added Discord alert webhook URL to .env.example - Created ContactCategory enum with humanReadable method - Implemented ContactSubmissionRequest form request - Added ContactSubmission model with fillable and casts properties - Included configurations for Discord alerts and honeypot protection
This commit is contained in:
23
app/Enums/ContactCategory.php
Normal file
23
app/Enums/ContactCategory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum ContactCategory: string
|
||||
{
|
||||
case Question = 'question';
|
||||
case Advertising = 'advertising';
|
||||
case BugReport = 'bug_report';
|
||||
case Feedback = 'feedback';
|
||||
case Other = 'other';
|
||||
|
||||
public function humanReadable(): string
|
||||
{
|
||||
return match ($this) {
|
||||
ContactCategory::Question => 'Question',
|
||||
ContactCategory::Advertising => 'Advertising',
|
||||
ContactCategory::BugReport => 'Bug Report',
|
||||
ContactCategory::Feedback => 'Feedback',
|
||||
ContactCategory::Other => 'Other',
|
||||
};
|
||||
}
|
||||
}
|
||||
25
app/Http/Requests/ContactSubmissionRequest.php
Normal file
25
app/Http/Requests/ContactSubmissionRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ContactSubmissionRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'max:254'],
|
||||
'email' => ['required', 'email', 'max:254'],
|
||||
'discord' => ['nullable', 'min:2', 'max:34'],
|
||||
'category' => ['required', 'in:question,advertising,bug_report,feedback,other'],
|
||||
'subject' => ['required', 'max:254'],
|
||||
'message' => ['required', 'unique:contact_submissions', 'max:3500'],
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
23
app/Models/ContactSubmission.php
Normal file
23
app/Models/ContactSubmission.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Enums\ContactCategory;
|
||||
|
||||
class ContactSubmission extends Model
|
||||
{
|
||||
protected $fillable
|
||||
= [
|
||||
'name',
|
||||
'email',
|
||||
'discord',
|
||||
'category',
|
||||
'subject',
|
||||
'message',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'category' => ContactCategory::class,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user