feat: Inertia profile settings page, Studio edit redesign, EGS, Nova UI components\n\n- Redesign /dashboard/profile as Inertia React page (Settings/ProfileEdit)\n with SettingsLayout sidebar, Nova UI components (TextInput, Textarea,\n Toggle, Select, RadioGroup, Modal, Button), avatar drag-and-drop,\n password change, and account deletion sections\n- Redesign Studio artwork edit page with two-column layout, Nova components,\n integrated TagPicker, and version history modal\n- Add shared MarkdownEditor component\n- Add Early-Stage Growth System (EGS): SpotlightEngine, FeedBlender,\n GridFiller, AdaptiveTimeWindow, ActivityLayer, admin panel\n- Fix upload category/tag persistence (V1+V2 paths)\n- Fix tag source enum, category tree display, binding resolution\n- Add settings.jsx Vite entry, settings.blade.php wrapper\n- Update ProfileController with JSON response support for API calls\n- Various route fixes (profile.edit, toolbar settings link)"
This commit is contained in:
93
app/Http/Controllers/Web/ApplicationController.php
Normal file
93
app/Http/Controllers/Web/ApplicationController.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\StaffApplication;
|
||||
|
||||
class ApplicationController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
return view('web.apply');
|
||||
}
|
||||
|
||||
public function submit(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'topic' => 'required|string|in:apply,bug,contact,other',
|
||||
'name' => 'required|string|max:100',
|
||||
'email' => 'required|email|max:150',
|
||||
'role' => 'nullable|string|max:100',
|
||||
'portfolio' => 'nullable|url|max:255',
|
||||
'affected_url' => 'nullable|url|max:255',
|
||||
'steps' => 'nullable|string|max:2000',
|
||||
'message' => 'nullable|string|max:2000',
|
||||
]);
|
||||
|
||||
$payload = [
|
||||
'id' => (string) Str::uuid(),
|
||||
'submitted_at' => now()->toISOString(),
|
||||
'ip' => $request->ip(),
|
||||
'user_agent' => $request->userAgent(),
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
// Honeypot: silently drop submissions that fill the hidden field
|
||||
if ($request->filled('website')) {
|
||||
return redirect()->route('contact.show')->with('success', 'Your submission was received.');
|
||||
}
|
||||
|
||||
try {
|
||||
Storage::append('staff_applications.jsonl', json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
} catch (\Throwable $e) {
|
||||
// best-effort store; don't fail the user if write fails
|
||||
}
|
||||
|
||||
// store in DB as well
|
||||
try {
|
||||
StaffApplication::create([
|
||||
'id' => $payload['id'],
|
||||
'topic' => $data['topic'] ?? 'apply',
|
||||
'name' => $data['name'] ?? null,
|
||||
'email' => $data['email'] ?? null,
|
||||
'role' => $data['role'] ?? null,
|
||||
'portfolio' => $data['portfolio'] ?? null,
|
||||
'message' => $data['message'] ?? null,
|
||||
'payload' => $payload,
|
||||
'ip' => $payload['ip'],
|
||||
'user_agent' => $payload['user_agent'],
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
// ignore DB errors
|
||||
}
|
||||
|
||||
$to = config('mail.from.address');
|
||||
|
||||
if ($to) {
|
||||
try {
|
||||
// prefer the DB model when available
|
||||
$appModel = isset($appModel) ? $appModel : StaffApplication::find($payload['id']) ?? null;
|
||||
if (! $appModel) {
|
||||
// construct a lightweight model-like object for the mailable
|
||||
$appModel = new StaffApplication($payload['data'] ?? []);
|
||||
$appModel->id = $payload['id'];
|
||||
$appModel->payload = $payload;
|
||||
$appModel->ip = $payload['ip'];
|
||||
$appModel->user_agent = $payload['user_agent'];
|
||||
$appModel->created_at = now();
|
||||
}
|
||||
|
||||
Mail::to($to)->queue(new \App\Mail\StaffApplicationReceived($appModel));
|
||||
} catch (\Throwable $e) {
|
||||
// ignore mail errors but don't fail user
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('contact.show')->with('success', 'Your submission was received. Thank you — we will review it soon.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user