1. Go to this page and download the library: Download agenciafmd/admix-postal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
agenciafmd / admix-postal example snippets
// if you want to send attachments
$attachments = null;
if ($request->has('images')) {
$images = $request->file('images');
foreach ($images as $image) {
$customName = Str::of($request->name)->slug() . '-' . Str::random(5) . '.' . $image->getClientOriginalExtension();
/* TODO: refactor with Storage */
$attachments[] = storage_path(
'app/' . $image
->storeAs('attachments', $customName, 'local')
);
}
}
// fill if you want to customize the subject
$customSubject = null;
Postal::query()
->where('slug', 'slug-of-created-form')
->first()
->notify(new SendNotification([
'greeting' => $request->subject,
'introLines' => [
'**Nome:** ' . $request->name,
'**E-mail:** ' . $request->email,
'**Telefone:** ' . $request->phone,
'**Cidade:** ' . $request->city . ' - ' . $request->state,
'**Mensagem:** ' . nl2br($request->message),
],
], [$request->email => $request->name], $attachments, $customSubject));