Merge branch 'develop' into trunk
This commit is contained in:
commit
4ab9e3d58f
16 changed files with 134 additions and 416 deletions
21
.env.example
21
.env.example
|
|
@ -22,12 +22,6 @@ QUEUE_CONNECTION=sync
|
|||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
|
|
@ -37,16 +31,5 @@ MAIL_ENCRYPTION=null
|
|||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
MAIL_LIST_SERVICEWEB=
|
||||
MAIL_LIST_CONTACTFORM=
|
||||
25
README.md
25
README.md
|
|
@ -1,11 +1,20 @@
|
|||
# DOUX
|
||||
|
||||
## Installation
|
||||
|
||||
* créer la BDD
|
||||
* renseigner le .env
|
||||
* composer install
|
||||
* npm install
|
||||
* npm run dev
|
||||
* php artisan migrate:fresh --seed
|
||||
* php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"
|
||||
```
|
||||
php artisan storage:link
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
composer install
|
||||
php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"
|
||||
```
|
||||
- Créez la base de données
|
||||
- Éditez le .env
|
||||
```
|
||||
php artisan migrate --seed
|
||||
```
|
||||
Pour le front :
|
||||
```
|
||||
npm install
|
||||
npm run prod
|
||||
```
|
||||
|
|
@ -13,8 +13,7 @@
|
|||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
|
|
@ -32,9 +31,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
protected $dontReport = [];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
|
|
@ -46,46 +43,4 @@ class Handler extends ExceptionHandler
|
|||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(
|
||||
function (Throwable $e) {
|
||||
try {
|
||||
if (!config('app.debug')) {
|
||||
if ($this->shouldntReport($e)) {
|
||||
return false;
|
||||
}
|
||||
Mail::send(
|
||||
[
|
||||
'html' => 'emails.exception',
|
||||
'text' => 'emails.exception-plain'
|
||||
],
|
||||
[
|
||||
'exception' => $e,
|
||||
'appName' => config('app.name')
|
||||
],
|
||||
function ($m) {
|
||||
$m->to(
|
||||
config('mail.contactsList.serviceweb'),
|
||||
sprintf(
|
||||
'%s Exception Handler',
|
||||
config('app.name')
|
||||
)
|
||||
//phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
)->subject('Need help !, an error occured in your application, please check Logs ASAP');
|
||||
}
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,22 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\ContactFormRequest;
|
||||
use App\Mail\SendContactMail;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function contact(Request $request)
|
||||
public function contact()
|
||||
{
|
||||
$status = $request->session()->get('status');
|
||||
|
||||
return view('front.contact', compact('status'));
|
||||
return view('front.contact');
|
||||
}
|
||||
|
||||
public function contactSubmit(ContactFormRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($request->validated()));
|
||||
|
||||
$toMail = config('mail.contactsList.contactform');
|
||||
if (!is_array($toMail)) {
|
||||
$toMail = explode(',', $toMail);
|
||||
}
|
||||
//envoi du mail d'alerte
|
||||
Mail::to($toMail)
|
||||
->send(new SendContactMail($request));
|
||||
|
||||
return back()->with('status', true);
|
||||
$lang = session()->get('lang', config('app.locale'));
|
||||
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")->with('status', true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Models\Product;
|
|||
use App\Models\SeoDatum;
|
||||
use App\Models\Slide;
|
||||
use App\Models\Slider;
|
||||
use Exception;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class HomeController extends Controller
|
||||
|
|
|
|||
|
|
@ -2,20 +2,11 @@
|
|||
|
||||
namespace App\Lib;
|
||||
|
||||
use App\Models\Customers;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use SplFileInfo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Some utilities methods
|
||||
*
|
||||
|
|
@ -24,145 +15,6 @@ use Throwable;
|
|||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* Replace stange accents
|
||||
*
|
||||
* https://stackoverflow.com/questions/3371697/replacing-accented-characters-php
|
||||
* @author Jérémy Munsch <jeremy.munsch@jeremydev.ovh>
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceSpecChar(string $subject): string
|
||||
{
|
||||
$char_map = array(
|
||||
"ъ" => "-", "ь" => "-", "Ъ" => "-", "Ь" => "-",
|
||||
"А" => "A", "Ă" => "A", "Ǎ" => "A", "Ą" => "A", "À" => "A", "Ã" => "A", "Á" => "A", "Æ" => "A", "Â" => "A", "Å" => "A", "Ǻ" => "A", "Ā" => "A", "א" => "A",
|
||||
"Б" => "B", "ב" => "B", "Þ" => "B",
|
||||
"Ĉ" => "C", "Ć" => "C", "Ç" => "C", "Ц" => "C", "צ" => "C", "Ċ" => "C", "Č" => "C", "©" => "C", "ץ" => "C",
|
||||
"Д" => "D", "Ď" => "D", "Đ" => "D", "ד" => "D", "Ð" => "D",
|
||||
"È" => "E", "Ę" => "E", "É" => "E", "Ë" => "E", "Ê" => "E", "Е" => "E", "Ē" => "E", "Ė" => "E", "Ě" => "E", "Ĕ" => "E", "Є" => "E", "Ə" => "E", "ע" => "E",
|
||||
"Ф" => "F", "Ƒ" => "F",
|
||||
"Ğ" => "G", "Ġ" => "G", "Ģ" => "G", "Ĝ" => "G", "Г" => "G", "ג" => "G", "Ґ" => "G",
|
||||
"ח" => "H", "Ħ" => "H", "Х" => "H", "Ĥ" => "H", "ה" => "H",
|
||||
"I" => "I", "Ï" => "I", "Î" => "I", "Í" => "I", "Ì" => "I", "Į" => "I", "Ĭ" => "I", "I" => "I", "И" => "I", "Ĩ" => "I", "Ǐ" => "I", "י" => "I", "Ї" => "I", "Ī" => "I", "І" => "I",
|
||||
"Й" => "J", "Ĵ" => "J",
|
||||
"ĸ" => "K", "כ" => "K", "Ķ" => "K", "К" => "K", "ך" => "K",
|
||||
"Ł" => "L", "Ŀ" => "L", "Л" => "L", "Ļ" => "L", "Ĺ" => "L", "Ľ" => "L", "ל" => "L",
|
||||
"מ" => "M", "М" => "M", "ם" => "M",
|
||||
"Ñ" => "N", "Ń" => "N", "Н" => "N", "Ņ" => "N", "ן" => "N", "Ŋ" => "N", "נ" => "N", "ʼn" => "N", "Ň" => "N",
|
||||
"Ø" => "O", "Ó" => "O", "Ò" => "O", "Ô" => "O", "Õ" => "O", "О" => "O", "Ő" => "O", "Ŏ" => "O", "Ō" => "O", "Ǿ" => "O", "Ǒ" => "O", "Ơ" => "O",
|
||||
"פ" => "P", "ף" => "P", "П" => "P",
|
||||
"ק" => "Q",
|
||||
"Ŕ" => "R", "Ř" => "R", "Ŗ" => "R", "ר" => "R", "Р" => "R", "®" => "R",
|
||||
"Ş" => "S", "Ś" => "S", "Ș" => "S", "Š" => "S", "С" => "S", "Ŝ" => "S", "ס" => "S",
|
||||
"Т" => "T", "Ț" => "T", "ט" => "T", "Ŧ" => "T", "ת" => "T", "Ť" => "T", "Ţ" => "T",
|
||||
"Ù" => "U", "Û" => "U", "Ú" => "U", "Ū" => "U", "У" => "U", "Ũ" => "U", "Ư" => "U", "Ǔ" => "U", "Ų" => "U", "Ŭ" => "U", "Ů" => "U", "Ű" => "U", "Ǖ" => "U", "Ǜ" => "U", "Ǚ" => "U", "Ǘ" => "U",
|
||||
"В" => "V", "ו" => "V",
|
||||
"Ý" => "Y", "Ы" => "Y", "Ŷ" => "Y", "Ÿ" => "Y",
|
||||
"Ź" => "Z", "Ž" => "Z", "Ż" => "Z", "З" => "Z", "ז" => "Z",
|
||||
"а" => "a", "ă" => "a", "ǎ" => "a", "ą" => "a", "à" => "a", "ã" => "a", "á" => "a", "æ" => "a", "â" => "a", "å" => "a", "ǻ" => "a", "ā" => "a", "א" => "a",
|
||||
"б" => "b", "ב" => "b", "þ" => "b",
|
||||
"ĉ" => "c", "ć" => "c", "ç" => "c", "ц" => "c", "צ" => "c", "ċ" => "c", "č" => "c", "©" => "c", "ץ" => "c",
|
||||
"Ч" => "ch", "ч" => "ch",
|
||||
"д" => "d", "ď" => "d", "đ" => "d", "ד" => "d", "ð" => "d",
|
||||
"è" => "e", "ę" => "e", "é" => "e", "ë" => "e", "ê" => "e", "е" => "e", "ē" => "e", "ė" => "e", "ě" => "e", "ĕ" => "e", "є" => "e", "ə" => "e", "ע" => "e",
|
||||
"ф" => "f", "ƒ" => "f",
|
||||
"ğ" => "g", "ġ" => "g", "ģ" => "g", "ĝ" => "g", "г" => "g", "ג" => "g", "ґ" => "g",
|
||||
"ח" => "h", "ħ" => "h", "х" => "h", "ĥ" => "h", "ה" => "h",
|
||||
"i" => "i", "ï" => "i", "î" => "i", "í" => "i", "ì" => "i", "į" => "i", "ĭ" => "i", "ı" => "i", "и" => "i", "ĩ" => "i", "ǐ" => "i", "י" => "i", "ї" => "i", "ī" => "i", "і" => "i",
|
||||
"й" => "j", "Й" => "j", "Ĵ" => "j", "ĵ" => "j",
|
||||
"ĸ" => "k", "כ" => "k", "ķ" => "k", "к" => "k", "ך" => "k",
|
||||
"ł" => "l", "ŀ" => "l", "л" => "l", "ļ" => "l", "ĺ" => "l", "ľ" => "l", "ל" => "l",
|
||||
"מ" => "m", "м" => "m", "ם" => "m",
|
||||
"ñ" => "n", "ń" => "n", "н" => "n", "ņ" => "n", "ן" => "n", "ŋ" => "n", "נ" => "n", "ʼn" => "n", "ň" => "n",
|
||||
"ø" => "o", "ó" => "o", "ò" => "o", "ô" => "o", "õ" => "o", "о" => "o", "ő" => "o", "ŏ" => "o", "ō" => "o", "ǿ" => "o", "ǒ" => "o", "ơ" => "o",
|
||||
"פ" => "p", "ף" => "p", "п" => "p",
|
||||
"ק" => "q",
|
||||
"ŕ" => "r", "ř" => "r", "ŗ" => "r", "ר" => "r", "р" => "r", "®" => "r",
|
||||
"ş" => "s", "ś" => "s", "ș" => "s", "š" => "s", "с" => "s", "ŝ" => "s", "ס" => "s",
|
||||
"т" => "t", "ț" => "t", "ט" => "t", "ŧ" => "t", "ת" => "t", "ť" => "t", "ţ" => "t",
|
||||
"ù" => "u", "û" => "u", "ú" => "u", "ū" => "u", "у" => "u", "ũ" => "u", "ư" => "u", "ǔ" => "u", "ų" => "u", "ŭ" => "u", "ů" => "u", "ű" => "u", "ǖ" => "u", "ǜ" => "u", "ǚ" => "u", "ǘ" => "u",
|
||||
"в" => "v", "ו" => "v",
|
||||
"ý" => "y", "ы" => "y", "ŷ" => "y", "ÿ" => "y",
|
||||
"ź" => "z", "ž" => "z", "ż" => "z", "з" => "z", "ז" => "z", "ſ" => "z",
|
||||
"™" => "tm",
|
||||
"@" => "at",
|
||||
"Ä" => "ae", "Ǽ" => "ae", "ä" => "ae", "æ" => "ae", "ǽ" => "ae",
|
||||
"ij" => "ij", "IJ" => "ij",
|
||||
"я" => "ja", "Я" => "ja",
|
||||
"Э" => "je", "э" => "je",
|
||||
"ё" => "jo", "Ё" => "jo",
|
||||
"ю" => "ju", "Ю" => "ju",
|
||||
"œ" => "oe", "Œ" => "oe", "ö" => "oe", "Ö" => "oe",
|
||||
"щ" => "sch", "Щ" => "sch",
|
||||
"ш" => "sh", "Ш" => "sh",
|
||||
"ß" => "ss",
|
||||
"Ü" => "ue",
|
||||
"Ж" => "zh", "ж" => "zh",
|
||||
);
|
||||
return self::mbStrtr($subject, $char_map);
|
||||
}
|
||||
/**
|
||||
* Multibyte strtr
|
||||
*
|
||||
* @param string $str
|
||||
* @param string|array $from
|
||||
* @param string|null $to
|
||||
* @return void
|
||||
*/
|
||||
public static function mbStrtr($str, $from, $to = null): string
|
||||
{
|
||||
if (is_array($from)) {
|
||||
$from = array_map('utf8_decode', $from);
|
||||
$from = array_map('utf8_decode', array_flip($from));
|
||||
return utf8_encode(strtr(utf8_decode($str), array_flip($from)));
|
||||
}
|
||||
return utf8_encode(strtr(utf8_decode($str), utf8_decode($from), utf8_decode($to)));
|
||||
}
|
||||
/**
|
||||
* Assert That no Back Office url is present on txt
|
||||
*
|
||||
* @param string $field
|
||||
* @param string $text
|
||||
* @return string
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public static function assertNoInternalUrls(string $field, string $text): string
|
||||
{
|
||||
$routes = Route::getRoutes();
|
||||
// url replace and email replace
|
||||
$text = preg_replace_callback(
|
||||
'/(?P<url>(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))/',
|
||||
function ($matches) use ($routes, $field) {
|
||||
$match = collect($matches)->first() ?? '';
|
||||
$url = $match;
|
||||
try {
|
||||
$request = Request::create($url);
|
||||
// if a route is match then it do not throws exception
|
||||
if ($routes->match($request)->getPrefix() === 'bo') {
|
||||
// removes the matched url
|
||||
throw ValidationException::withMessages([
|
||||
$field => trans($field) . " : Il est interdit de coller une url du Back Office Le Gaulois dans ce champ"
|
||||
]);
|
||||
}
|
||||
return $match;
|
||||
} catch (NotFoundHttpException $e) {
|
||||
return $match;
|
||||
}
|
||||
},
|
||||
$text
|
||||
);
|
||||
return $text;
|
||||
}
|
||||
public static function dotStringToNestedArray($path, $value, $separator = '.')
|
||||
{
|
||||
$arr = $value;
|
||||
$keys = array_reverse(explode($separator, $path));
|
||||
foreach ($keys as $key) {
|
||||
$arr = [$key => $arr];
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
/**
|
||||
* Store an image for a model
|
||||
* if a string is passed then the store action is ignored and the strieng is returned
|
||||
|
|
@ -212,117 +64,4 @@ class Utils
|
|||
}
|
||||
return $fullPath;
|
||||
}
|
||||
/**
|
||||
* Manually send an exception to team instead of going trough the error handler
|
||||
* (requires package kwaadpepper/exception-handler)
|
||||
*
|
||||
* @param Throwable $e
|
||||
* @return void
|
||||
*/
|
||||
public static function sendEmailErrorManually(Throwable $e)
|
||||
{
|
||||
Mail::send([
|
||||
'html' => 'exception-handler::emails.exception',
|
||||
'text' => 'exception-handler::emails.exception-plain'
|
||||
], [
|
||||
'appName' => config('app.name'),
|
||||
'code' => $e->getCode(),
|
||||
'line' => $e->getLine(),
|
||||
'ename' => \get_class($e),
|
||||
'emessage' => self::getAnonymizedMessage($e->getMessage()),
|
||||
'file' => str_replace(\realpath(\sprintf('%s/../', \app_path())), '', $e->getFile()),
|
||||
'stackTrace' => self::getAnonymizedStackTrace($e),
|
||||
'uri' => app()->runningInConsole() ?
|
||||
'CONSOLE' : (
|
||||
(request() and request()->fullUrl()) ?
|
||||
request()->fullUrl() : 'none')
|
||||
], function ($m) {
|
||||
/** @var \Illuminate\Mail\Message $m */
|
||||
$m->to(
|
||||
config('mail.contactsList.serviceweb'),
|
||||
sprintf('%s Exception Handler', config('app.name'))
|
||||
)->subject('Need help !, an error occured in your application, please check Logs ASAP');
|
||||
});
|
||||
Log::alert(sprintf('Envoie d\'une erreur par mail : %s', json_encode($e)));
|
||||
}
|
||||
/**
|
||||
* Generate an unique pseudo
|
||||
*
|
||||
* @param string $firstname
|
||||
* @param string $lastname
|
||||
* @param integer $i
|
||||
* @return void
|
||||
*/
|
||||
public static function getUniquePseudo($firstname, $lastname, int $i = 0)
|
||||
{
|
||||
$pseudo = $firstname . '.' . substr($lastname, 0, 1);
|
||||
if ($i > 0) {
|
||||
$pseudo .= "-" . Str::random(8);
|
||||
}
|
||||
$customer = Customers::where('username', $pseudo)->first();
|
||||
if ($customer) {
|
||||
return self::getUniquePseudo($firstname, $lastname, $i + 1);
|
||||
}
|
||||
return $pseudo;
|
||||
}
|
||||
/**
|
||||
* Anonymize at least Sql queries
|
||||
*
|
||||
* @param string $message
|
||||
* @return string
|
||||
*/
|
||||
private static function getAnonymizedMessage(string $message): string
|
||||
{
|
||||
$message = \preg_replace('/^(.*)( \(SQL:.*\))$/', '$1', $message) ?? $message;
|
||||
return $message;
|
||||
}
|
||||
/**
|
||||
* Anonymize stack trace
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return string
|
||||
*/
|
||||
private static function getAnonymizedStackTrace(Throwable $e): string
|
||||
{
|
||||
$projectPath = \realpath(\sprintf('%s/../', \app_path()));
|
||||
$traceStack = $e->getTrace();
|
||||
$traceStr = '';
|
||||
$maxStackStage = 0;
|
||||
foreach ($traceStack as $stackStage => $stack) {
|
||||
$maxStackStage = $stackStage;
|
||||
$traceStr .= \sprintf(
|
||||
'#%s %s(%d): ',
|
||||
$stackStage,
|
||||
str_replace($projectPath, '', $stack['file']),
|
||||
$stack['line']
|
||||
);
|
||||
$traceStr .= "{$stack['class']}->{$stack['function']}(";
|
||||
$traceArgs = '';
|
||||
if (isset($stack['args'])) {
|
||||
$argsCount = count($stack['args']);
|
||||
for ($i = 0; $i < $argsCount; $i++) {
|
||||
$type = \gettype($stack['args'][$i]);
|
||||
switch ($type) {
|
||||
case 'object':
|
||||
$traceArgs .= sprintf('Object(%s)', \get_class($stack['args'][$i]));
|
||||
break;
|
||||
case 'array':
|
||||
$traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i]));
|
||||
break;
|
||||
case 'string':
|
||||
$traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i]));
|
||||
break;
|
||||
default:
|
||||
$traceArgs .= \gettype($stack['args'][$i]);
|
||||
}
|
||||
$traceArgs .= ($i !== ($argsCount - 1) ? ',' : '');
|
||||
}
|
||||
$traceStr .= $traceArgs;
|
||||
}
|
||||
$traceStr .= ")\n";
|
||||
}
|
||||
$maxStackStage++;
|
||||
$traceStr .= "#$maxStackStage {main}";
|
||||
return $traceStr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ class SendContactMail extends Mailable
|
|||
"Contact - " .
|
||||
config('app.name', 'Doux') .
|
||||
" - " .
|
||||
$data->topic
|
||||
$data['topic']
|
||||
)
|
||||
->from($data->email)
|
||||
->from($data['email'])
|
||||
->view('emails.send-contact', compact('data'));
|
||||
}
|
||||
|
||||
|
|
@ -82,20 +82,20 @@ class SendContactMail extends Mailable
|
|||
*/
|
||||
protected function joinFileIfProvided(): void
|
||||
{
|
||||
if ($this->data->file) {
|
||||
if (isset($this->data['file'])) {
|
||||
$this->joinedFileName = sprintf(
|
||||
'Doux_MESSAGE-PJ-%s.%s',
|
||||
date("YmdHis"),
|
||||
$this->data->file->extension()
|
||||
$this->data['file']->extension()
|
||||
);
|
||||
$this->attach(
|
||||
$this->data->file,
|
||||
$this->data['file'],
|
||||
[
|
||||
'as' => $this->joinedFileName,
|
||||
'mime' => $this->data->file->getMimeType()
|
||||
'mime' => $this->data['file']->getMimeType()
|
||||
]
|
||||
);
|
||||
$this->data->file = $this->joinedFileName;
|
||||
$this->data['file'] = $this->joinedFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"joedixon/laravel-translation": "^1.1",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.8",
|
||||
"laravel/framework": "^8.65",
|
||||
"laravel/sanctum": "^2.11",
|
||||
"laravel/tinker": "^2.5",
|
||||
|
|
|
|||
65
composer.lock
generated
65
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9e5c04cb7369a0dfd36212e6ca2bf597",
|
||||
"content-hash": "6d3d19ee0637b85edde0f49067b24cae",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
|
@ -1046,6 +1046,67 @@
|
|||
},
|
||||
"time": "2021-11-18T16:52:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kwaadpepper/exception-handler",
|
||||
"version": "0.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kwaadpepper/exception-handler.git",
|
||||
"reference": "e8ba0e31ca2bf5971e459c623f0f5322a4c7a630"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kwaadpepper/exception-handler/zipball/e8ba0e31ca2bf5971e459c623f0f5322a4c7a630",
|
||||
"reference": "e8ba0e31ca2bf5971e459c623f0f5322a4c7a630",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "~7|~8|~9",
|
||||
"laravel/framework": "~7|~8|~9"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.13",
|
||||
"phpunit/phpunit": "~9.0",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Kwaadpepper\\ExceptionHandler\\ExceptionHandlerServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kwaadpepper\\ExceptionHandler\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jérémy Munsch",
|
||||
"email": "github@jeremydev.ovh",
|
||||
"homepage": "https://jeremydev.ovh"
|
||||
}
|
||||
],
|
||||
"description": "Send emails when exceptions occurs",
|
||||
"homepage": "https://github.com/kwaadpepper/exception-handler",
|
||||
"keywords": [
|
||||
"email",
|
||||
"exception",
|
||||
"laravel",
|
||||
"policies"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Kwaadpepper/exception-handler/issues",
|
||||
"source": "https://github.com/Kwaadpepper/exception-handler/tree/0.0.8"
|
||||
},
|
||||
"time": "2022-02-03T15:23:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v8.83.4",
|
||||
|
|
@ -8222,5 +8283,5 @@
|
|||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
|||
15
config/exception-handler.php
Normal file
15
config/exception-handler.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
* Send mail when app debug is turn off
|
||||
* so you can be warned if an unhandled exception occurs
|
||||
*/
|
||||
'enableMaiLog' => !config('app.debug'),
|
||||
|
||||
/**
|
||||
* Put a developper secured mailbox in here
|
||||
* so you can receive email if things go mad
|
||||
*/
|
||||
'contactsList' => explode(",", env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr'))
|
||||
];
|
||||
|
|
@ -98,8 +98,7 @@ return [
|
|||
|
||||
// Contacts List
|
||||
'contactsList' => [
|
||||
'serviceweb' => env('MAIL_LIST_SERVICEWEB', 'informatique.internet@ldc.fr'),
|
||||
'contactform' => env('MAIL_LIST_CONTACTFORM', 'equipe.web@ldc.fr')
|
||||
'contactform' => explode(",", env('MAIL_LIST_CONTACTFORM', 'equipe.web@ldc.fr'))
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
4
resources/sass/frontend/_fonts.scss
vendored
4
resources/sass/frontend/_fonts.scss
vendored
|
|
@ -17,6 +17,6 @@ $font-path: "~@/fonts";
|
|||
@font-face {
|
||||
font-family: "cocon-regular";
|
||||
font-weight: normal;
|
||||
src: url("~/assets/fonts/cocon/cocon-regular-webfont.woff2") format("woff2"),
|
||||
url("~/assets/fonts/cocon/cocon-regular-webfont.woff") format("woff");
|
||||
src: url("#{$font-path}/cocon/cocon-regular-webfont.woff2") format("woff2"),
|
||||
url("#{$font-path}/cocon/cocon-regular-webfont.woff") format("woff");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
{{ $appName }} Exception Handler
|
||||
|
||||
Une erreur est survenue sur le site {{ $appName }}
|
||||
{{ $exception->getMessage() }}
|
||||
date : {{ date('Y-m-d H:i:s') }}
|
||||
code : {{$exception->getCode() }}
|
||||
file : {{$exception->getFile() }}
|
||||
line : {{$exception->getLine() }}
|
||||
|
||||
Veuillez vérifier les logs pour en voir la trace.
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{{ $appName }} Exception Handler</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Une erreur est survenue sur le site {{ $appName }}</h1>
|
||||
<h2>{{ $exception->getMessage() }}</h2>
|
||||
<p>date : {{ date('Y-m-d H:i:s') }}</p>
|
||||
<p>code : {{$exception->getCode() }}</p>
|
||||
<p>file : {{$exception->getFile() }}</p>
|
||||
<p>line : {{$exception->getLine() }}</p>
|
||||
<p>Veuillez vérifier les logs pour en voir la trace.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -154,8 +154,8 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">Expediteur : {{ $data->civilite }} {{ $data->name }} {{ $data->lastname }}<br><br> Adresse : {{ $data->address }} {{ $data->postcode }} {{ $data->city }} <br><br> Téléphone : {{ $data->phone }}<br><br> Email : {{ $data->email }}<br><br> Pays : {{ $data->country }}<br><br> Département : {{ $data->departement }}<br><br> Sujet : {{ $data->topic }}<br><br> Produit : {{ $data->product_name }}<br><br> Code Barre : {{ $data->barcode }}<br><br> Lot : {{ $data->lot }}<br><br> Date limite de consommation : {{ $data->limit_date }}<br><br> Lieu d'achat : {{ $data->shop }}<br><br> Date de consommation : {{ $data->consumption_date }}<br><br> Message : <br><br>
|
||||
{{ $data->message }}
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:20px;line-height:1;text-align:left;color:black;">Expediteur : {{ $data['civilite'] }} {{ $data['name'] }} {{ $data['lastname'] }}<br><br> Adresse : {{ $data['address'] }} {{ $data['postcode'] }} {{ $data['city'] }} <br><br> Téléphone : {{ $data['phone'] }}<br><br> Email : {{ $data['email'] }}<br><br> Pays : {{ $data['country'] }}<br><br> Département : {{ $data['departement'] }}<br><br> Sujet : {{ $data['topic'] }}<br><br> Produit : {{ $data['product_name'] }}<br><br> Code Barre : {{ $data['barcode'] }}<br><br> Lot : {{ $data['lot'] }}<br><br> Date limite de consommation : {{ $data['limit_date'] }}<br><br> Lieu d'achat : {{ $data['shop'] }}<br><br> Date de consommation : {{ $data['consumption_date'] }}<br><br> Message : <br><br>
|
||||
{{ $data['message'] }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -49,21 +49,12 @@
|
|||
<h2 class="punchline-module__title align-center animate__animated fadeInUp animate__slow">{!! __('Une question ? Une idée ? Un conseil ?<br>Des informations sur nos produits ?') !!}</h2>
|
||||
</div>
|
||||
<p class="align-center">{!! __('N’hésitez-pas à nous contacter en renseignant le formulaire ci-dessous.<br>Nous traiterons votre demande avec la plus grande attention dans les meilleurs délais.') !!}</p>
|
||||
{{-- IF MAIL IS SENT --}}
|
||||
@if(!is_null($status))
|
||||
@if(session()->get('status'))
|
||||
@if(session()->has('status'))
|
||||
<div class="form-result form-result_confirm">
|
||||
<div class="form-result__title title title_small">{{ __('Votre message a bien été envoyé !') }}</div>
|
||||
<div class="form-result__text">{{ __('Nos services mettent tout en oeuvre pour y répondre au plus vite.') }}</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="form-result form-result_fail">
|
||||
<div class="form-result__title title">{{ __('Oups ! Une erreur s’est produite...') }}</div>
|
||||
<div class="form-result__text">{{ __('Votre message n’a pas pu être envoyé.<br>Nous en sommes désolés et vous prions<br>de bien vouloir réessayer plus tard.') }}</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<form action="{{route($routeprefixer . 'contact.submit')}}" method="post" class="form contact__form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@if ($errors->any())
|
||||
|
|
@ -75,11 +66,11 @@
|
|||
<legend>{{ __('Vos coordonnées') }} :</legend>
|
||||
|
||||
<label class="radio-label">{{ __('Monsieur') }}
|
||||
<input type="radio" checked="checked" name="civilite" value="monsieur" @if (old('civilite')=="monsieur" ) checked @endif>
|
||||
<input type="radio" checked="checked" name="civilite" value="monsieur" @if (old('civilite') === "monsieur" ) checked @endif>
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label class="radio-label">{{ __('Madame') }}
|
||||
<input type="radio" name="civilite" value="madame" @if (old('civilite')=="madame" ) checked @endif>
|
||||
<input type="radio" name="civilite" value="madame" @if (old('civilite') === "madame" ) checked @endif>
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
|
||||
|
|
@ -129,19 +120,19 @@
|
|||
<div class="drom">
|
||||
<select id="departement" class="changeLength" name="departement">
|
||||
<option value="" @if(!old('departement')) selected @endif>{{ __('Sélectionnez un département') }} *</option>
|
||||
<option value="Guadeloupe" @if(old('departement') == 'Guadeloupe') selected @endif>{{ __('Guadeloupe') }}</option>
|
||||
<option value="Martinique" @if(old('departement') == 'Martinique') selected @endif>{{ __('Martinique') }}</option>
|
||||
<option value="Guyane" @if(old('departement') == 'Guyane') selected @endif>{{ __('Guyane') }}</option>
|
||||
<option value="La Réunion" @if(old('departement') == 'La Réunion') selected @endif>{{ __('La Réunion') }}</option>
|
||||
<option value="Mayotte" @if(old('departement') == 'Mayotte') selected @endif>{{ __('Mayotte') }}</option>
|
||||
<option value="Saint-Pierre-et-Miquelon" @if(old('departement') == 'Saint-Pierre-et-Miquelon') selected @endif>{{ __('Saint-Pierre-et-Miquelon') }}</option>
|
||||
<option value="Saint-Barthélémy" @if(old('departement') == 'Saint-Barthélémy') selected @endif>{{ __('Saint-Barthélémy') }}</option>
|
||||
<option value="Saint-Martin" @if(old('departement') == 'Saint-Martin') selected @endif>{{ __('Saint-Martin') }}</option>
|
||||
<option value="Polynésie française" @if(old('departement') == 'Polynésie française') selected @endif>{{ __('Polynésie française') }}</option>
|
||||
<option value="Île de Clipperton" @if(old('departement') == 'Île de Clipperton') selected @endif>{{ __('Île de Clipperton') }}</option>
|
||||
<option value="Wallis-et-Futuna" @if(old('departement') == 'Wallis-et-Futuna') selected @endif>{{ __('Wallis-et-Futuna') }}</option>
|
||||
<option value="Nouvelle-Calédonie" @if(old('departement') == 'Nouvelle-Calédonie') selected @endif>{{ __('Nouvelle-Calédonie') }}</option>
|
||||
<option value="Terres australes et antarctiques françaises" @if(old('departement') == 'Terres australes et antarctiques françaises') selected @endif>{{ __('Terres australes et antarctiques françaises') }}</option>
|
||||
<option value="Guadeloupe" @if(old('departement') === 'Guadeloupe') selected @endif>{{ __('Guadeloupe') }}</option>
|
||||
<option value="Martinique" @if(old('departement') === 'Martinique') selected @endif>{{ __('Martinique') }}</option>
|
||||
<option value="Guyane" @if(old('departement') === 'Guyane') selected @endif>{{ __('Guyane') }}</option>
|
||||
<option value="La Réunion" @if(old('departement') === 'La Réunion') selected @endif>{{ __('La Réunion') }}</option>
|
||||
<option value="Mayotte" @if(old('departement') === 'Mayotte') selected @endif>{{ __('Mayotte') }}</option>
|
||||
<option value="Saint-Pierre-et-Miquelon" @if(old('departement') === 'Saint-Pierre-et-Miquelon') selected @endif>{{ __('Saint-Pierre-et-Miquelon') }}</option>
|
||||
<option value="Saint-Barthélémy" @if(old('departement') === 'Saint-Barthélémy') selected @endif>{{ __('Saint-Barthélémy') }}</option>
|
||||
<option value="Saint-Martin" @if(old('departement') === 'Saint-Martin') selected @endif>{{ __('Saint-Martin') }}</option>
|
||||
<option value="Polynésie française" @if(old('departement') === 'Polynésie française') selected @endif>{{ __('Polynésie française') }}</option>
|
||||
<option value="Île de Clipperton" @if(old('departement') === 'Île de Clipperton') selected @endif>{{ __('Île de Clipperton') }}</option>
|
||||
<option value="Wallis-et-Futuna" @if(old('departement') === 'Wallis-et-Futuna') selected @endif>{{ __('Wallis-et-Futuna') }}</option>
|
||||
<option value="Nouvelle-Calédonie" @if(old('departement') === 'Nouvelle-Calédonie') selected @endif>{{ __('Nouvelle-Calédonie') }}</option>
|
||||
<option value="Terres australes et antarctiques françaises" @if(old('departement') === 'Terres australes et antarctiques françaises') selected @endif>{{ __('Terres australes et antarctiques françaises') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue