*/
public static function public($file)
{
- return config('app.aws_s3_url')."/public/$file";
+ return str_replace('https://admin.','https://',url(str_replace('//', '/', '/s3/' . $file)));
}
/**
*/
public static function assetVersion($path)
{
- return asset($path).'?v='.filemtime(public_path($path));
+ return asset($path) . '?v=' . filemtime(public_path($path));
}
}
use App\Mail\BatchMail;
use App\PdfFile;
use App\User;
+use Cubist\Util\ArrayUtil;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
public function publish(Request $request)
{
$data = $request->input('data');
+ $default = ['email' =>
+ [
+ 'subject' => "L'édition du jour [" . $data['file']['title'] . "]",
+ 'content' => '<p>Bonjour %name%,</p>
+ <p>Voici la nouvelle édition du jour !</p>
+ <br>
+ <div style="text-align: center;width: 300px;margin:0 auto;">
+ <a href="%url%"><img src="%cover%" style="width:300px;height:auto;" /></a><br>
+ <a href="%url%" style="margin: 0 auto;border-radius: 5px;color: #fff;background-color: #074e9c;">Cliquez ici pour lire !</a>
+ </div>'
+ ],
+ ];
+
+ $data = ArrayUtil::mergeOverwriteNull($default, $data);
+
$recipientGroup = Arr::get($data, 'recipient_group');
]);
$i = 0;
+
$this->html = $this->batch->render();
$this->templateVariables = $this->processVariablesForMailer();
foreach ($this->users as $user) {
Mail::send([], [], function ($message) use ($user) {
+ $h = $this->html;
+ $h = str_replace('%name%', $user->name, $h);
+ $h = str_replace('%url%', $this->batch->file->getMailableUrl($user), $h);
+ $h = str_replace('%cover%', $this->batch->file->coverUrl, $h);
+ dd($h);
+
$message->from(config('mail.from.address'), config('mail.from_name'));
$message->subject($this->batch->subject);
- $message->setBody($this->html, 'text/html');
+ $message->setBody($h, 'text/html');
$message->to($user->email);
$message->replyTo(env('MAIL_REPLYTO'));
});
*/
public function getCoverUrlAttribute(): string
{
- return url(str_replace('fluidbook', 'view', $this->coverPath));
+ return str_replace('https://admin.', 'https://', url(str_replace('fluidbook', 'view', $this->coverPath)));
}
/**
'emails' => [
'subscriptions' => 'abonnement@prescription-quotidien.com',
'olivier' => 'olivier.robichon@prescription-quotidien.com',
- 'moi' => 'soufiane@cubedesigners.com'
+ 'moi' => 'test+psq@fluidbook.com'
],
+++ /dev/null
-@component('mail::message')
-
-# {{$subject}}
-
-
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="center">
- <a href="{{$link ?? '%recipient.file_url%'}}" target="_blank">
- <img src="{!! $image !!}" alt="cover" width="300" style="width:300px;" >
- </a>
- </td>
- </tr>
-</table>
-<br>
-
-{!! $content !!}
-
-@component('mail::button', ['url' => $link ?? '%recipient.file_url%', 'color' => 'primary'])
-Cliquez ici pour lire !
-@endcomponent
-
-
-@endcomponent
-