The error seems to come from any of your arrays.
$array[$someKey]
Probably a problem with a key.
Can you show the entire error message please ?
Can you also share with us the last log ?
giving error: Trying to access array offset on value of type null
my controller function
// Validate the request
$validated = $request->validate([
'full_name' => 'required|string|max:255',
'email' => 'required|email|max:255',
'phone' => 'required',
'subject' => 'required|max:255',
'message' => 'nullable|string',
]);
// dd($validated);
Contact::create($validated);
// Send the email
// Prepare the email data
$data = [
'full_name' => $validated['full_name'],
'email' => $validated['email'],
'user_message' => $validated['message'],
];
// Mail::to('[email protected]')->send(new ContactMail($validated));
Mail::send('emails.contact', $data, function ($message) use ($data) {
$message->to('[email protected]') // Replace with your email
->subject('New Contact Form Submission')
->from($data['email'], $data['full_name']);
});
data is passing to the blade file on both way through Mailable class or PHP and when i use dd and check data is receving in emails contact blade file and also i test with bank blade file still giving error. my blade file is:
<h1>New Contact Form Submission</h1>
@php
dd($full_name);
@endphp
<p><strong>Full Name:</strong> {{ $full_name }}</p>
<p><strong>Email:</strong> {{ $email }}</p>
<p><strong>Message:</strong></p>
<p>{{ $user_message }}</p>
Please or to participate in this conversation.