Вот мой код:
Файл маршрута:
Код: Выделить всё
Route::get('/program/touching-lives-at-christmas/register', [PublicController::class, 'form_tlc']);
Route::post('/program/touching-lives-at-christmas/register', [PublicController::class, 'register_save_tlc']);
Код: Выделить всё
class PublicController extends Controller
{
//
public function register_save_tlc(Request $request){
$tlc= new Tlc();
$participant= new Participant();
$part1=Participant::where('email', $request->email)->get();
$check=Participant::where('email', $request->email)->count();
$centerl= Tlc_leader::where('center', $request->center)->get();
foreach($centerl as $center_loc){
$data = [
'title'=> $request->title,
'name'=> $request->name,
'package' => $request->tlc_package,
'center' => $request->center,
'city' => $request->city,
'coordinator_name'=> $center_loc->coordinator_name,
'phone_no'=> $center_loc->phone_no
];
Mail::to($request->email)->send(new Signup($data));
}
Код: Выделить всё
TKP Registration confirmation
TLC Registration Confirmation.
[img]https://forms.tkpmission.org/images/banner.png[/img]
Dear {{$data['title']}} {{$data['name']}},
This to acknowledge your registration for TLC 2024.
You have indicated indicate in {{$data['package']}}
(the TLC Package)
in
@if($data['package'] !=null || $data['package']!="")
{{$data['center']}} Center .
@else
{{$data['city']}} City .
@endif
Код: Выделить всё
class Signup extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public $data;
public function __construct($data)
{
//
$this->data= $data;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Signup'
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'success',
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{
return [];
}
}
Код: Выделить всё
MAIL_MAILER=smtp
MAIL_HOST=
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=App
Подробнее здесь: https://stackoverflow.com/questions/791 ... -regularly
Мобильная версия