multilingual content, change in how we show header categories and homepage hero products

This commit is contained in:
elvira
2026-09-28 19:42:35 +03:00
parent 60ae6cf7a6
commit b522d60954
24 changed files with 250 additions and 63 deletions
+11 -6
View File
@@ -5,6 +5,7 @@
use App\Http\Requests\ContactRequest;
use App\Mail\ContactConfirmationMail;
use App\Mail\ContactMessageMail;
use App\Models\StoicPage;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
@@ -15,7 +16,7 @@
/**
* Contact form. Nothing is stored: the message is emailed to the store
* (CONTACT_EMAIL) and the sender gets a generic confirmation. Both are sent
* (Store Details' contact email) and the sender gets a generic confirmation. Both are sent
* synchronously so a failed store email can be reported back on the form.
*
* Limited per IP in here rather than with throttle middleware, so the limit
@@ -28,11 +29,15 @@ class ContactController extends Controller
public function index(string $locale): View
{
// Address and phone come from Store Details; the email is still
// CONTACT_EMAIL until Store Details has an email field.
$page = StoicPage::localized('contact');
if (! $page) {
abort(404);
}
return view('contact', [
'page' => $page,
'store' => app(StoreDetailsService::class)->current(),
'contactEmail' => config('services.contact.email'),
]);
}
@@ -47,11 +52,11 @@ public function send(string $locale, ContactRequest $request): RedirectResponse
RateLimiter::hit($key, self::SEND_DECAY_SECONDS);
$data = $request->validated();
$to = config('services.contact.email');
$to = app(StoreDetailsService::class)->current()->contact_email;
try {
if (blank($to)) {
throw new \RuntimeException('CONTACT_EMAIL is not set.');
throw new \RuntimeException('Store Details has no contact email.');
}
Mail::to($to)->send(new ContactMessageMail(