Compare commits

...
Sign in to create a new pull request.

41 commits

Author SHA1 Message Date
Vincent BRIDIER
3c7af56770 Merge branch 'trunk' 2026-10-28 17:44:57 +01:00
Vincent BRIDIER
74ce43b556 Merge branch '68-error' into 'trunk'
fix: 🐛 cast dates to datetime

See merge request ldc-web/projets/mesbr!75
2026-10-28 17:41:48 +01:00
Vincent BRIDIER
a7226f8319 Merge branch '67-fix-sentry-error' into 'trunk'
fix: 🐛 parse mouvement_created_at as date

See merge request ldc-web/projets/mesbr!74
2026-10-28 17:41:34 +01:00
Corentin Huet
f4ce662e8f fix: 🐛 cast dates to datetime 2026-10-28 17:35:34 +01:00
Corentin Huet
c8953e4e4a fix: 🐛 parse mouvement_created_at as date 2026-10-28 17:34:22 +01:00
Vincent BRIDIER
6ade3c6578 Merge branch 'trunk' 2026-10-28 16:16:38 +01:00
Vincent BRIDIER
6ec164d39a feat: Bump barcode deps 2026-10-28 16:08:30 +01:00
Vincent BRIDIER
df7768f424 feat: Remove Override 2026-10-28 13:23:49 +01:00
Vincent BRIDIER
7ebefee1c4 feat: Update CICD 2026-10-28 13:15:51 +01:00
Vincent BRIDIER
1fd7b6f692 feat: L11 to L13 2026-10-28 13:10:33 +01:00
Vincent BRIDIER
c62537a087 feat: L9 to L11 2026-10-28 13:00:51 +01:00
Vincent BRIDIER
6203647673 Update dependencies for PHP 8.5 compatibility + L8 to L9 2026-10-28 12:48:57 +01:00
Vincent BRIDIER
8483c63838 feat: rector to php 8.5 2026-10-28 12:27:46 +01:00
K Muller
a737011ae3 Merge branch 'trunk' 2026-10-08 14:25:16 +02:00
K Muller
07b326e62a Merge branch 'develop' into trunk 2026-10-08 14:25:02 +02:00
K Muller
a63aaf2f83 Merge branch 'trunk' 2026-10-08 10:45:21 +02:00
K Muller
09a71342f0 Merge branch 'develop' into trunk 2026-10-08 10:45:00 +02:00
Vincent BRIDIER
e5a50e41a4 Merge branch 'trunk' 2026-07-31 10:30:54 +02:00
Vincent BRIDIER
019c03ccb5 Merge branch 'develop' into trunk 2026-07-31 10:17:53 +02:00
Vincent BRIDIER
81508c376f Merge branch 'trunk' 2026-07-31 09:41:45 +02:00
Vincent BRIDIER
3c1245b66b Merge branch 'develop' into trunk 2026-07-31 09:37:36 +02:00
Noah Lancien
f7c028fd1b Merge branch 'trunk' 2026-06-22 10:31:55 +02:00
Noah Lancien
8a230d897b Merge branch 'develop' into trunk 2026-06-22 10:31:40 +02:00
K Muller
9e2fe9cc73 Merge branch 'trunk' 2026-06-18 09:51:03 +02:00
K Muller
d9dffadb1f Merge branch 'develop' into trunk 2026-06-18 09:50:48 +02:00
Vincent BRIDIER
b7f111123f Merge branch 'trunk' 2025-12-09 15:06:32 +01:00
Vincent BRIDIER
58eca4167a Merge branch 'develop' into trunk 2025-12-09 15:06:23 +01:00
Vincent BRIDIER
967edc9f07 Merge branch 'trunk' 2025-11-25 11:34:16 +01:00
Vincent BRIDIER
a077d5e89a Merge branch 'develop' into trunk 2025-11-25 11:34:06 +01:00
Vincent BRIDIER
e5e6d2bee8 Merge branch 'trunk' 2025-11-13 10:05:52 +01:00
Vincent BRIDIER
656b9e3b3a Merge branch 'develop' into trunk 2025-11-13 10:05:43 +01:00
Vincent BRIDIER
1fd8f3bd35 Merge branch 'trunk' 2025-11-13 09:36:15 +01:00
Vincent BRIDIER
0da72e56bf Merge branch 'develop' into trunk 2025-11-13 09:29:53 +01:00
Vincent BRIDIER
f2f8c37069 Merge branch 'trunk' 2025-11-13 08:32:31 +01:00
Vincent BRIDIER
4cca7dea5e Merge branch 'develop' into trunk 2025-11-12 17:31:45 +01:00
Vincent BRIDIER
15118238ea Merge branch 'develop' into trunk 2025-11-12 16:36:04 +01:00
Noah Lancien
64118d03b0 Merge branch 'develop' into trunk 2025-11-07 12:37:17 +01:00
Noah Lancien
0e64a0715a Merge branch 'develop' into trunk 2025-10-09 09:51:09 +02:00
Vincent BRIDIER
cec74c9933
Merge branch 'develop' into trunk 2025-08-06 09:45:48 +02:00
Noah Lancien
da005cdf5c Merge branch 'develop' into trunk 2025-07-30 12:15:48 +02:00
Vincent BRIDIER
e3a51051f0
Merge branch 'develop' into trunk 2025-05-07 09:53:26 +02:00
79 changed files with 3718 additions and 3604 deletions

View file

@ -1,13 +1,13 @@
include:
- project: "ldc-web/shared-ci"
ref: "main"
file: "lint/lint7.3.yml"
file: "lint/lint.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "security/security7.3.yml"
file: "security/security.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "build/build7.3.yml"
file: "build/build.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "test/test.yml"

View file

@ -1,4 +1,5 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-7.3:060825-070701
ARG PHP_8_5_TAG=latest
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/uwil-production-8.5:${PHP_8_5_TAG}
COPY --chown=www-data:www-data . /app/srcs
USER root
RUN chmod -R 755 /app/srcs/storage

View file

@ -15,6 +15,7 @@ class ArchiveStatsCommand extends Command
*
* @var string
*/
protected $signature = 'uwil:stats:archive';
/**
@ -22,6 +23,7 @@ class ArchiveStatsCommand extends Command
*
* @var string
*/
protected $description = 'Archives mesbr stats';
/**
@ -34,7 +36,7 @@ class ArchiveStatsCommand extends Command
$baseArchiveStatCount = ArchiveStat::count();
$baseStatCount = Statistique::count();
(new ArchiveStatsJob())->handle();
new ArchiveStatsJob()->handle();
$this->info(sprintf(
'%s archive(s) created',

View file

@ -19,6 +19,7 @@ class CustomersClaims extends Command
*
* @var string
*/
protected $signature = 'customers:claims {--siteId=?} {destCampaignId} {destCouponId}';
/**
@ -26,6 +27,7 @@ class CustomersClaims extends Command
*
* @var string
*/
protected $description = 'Command description';
/**
@ -58,30 +60,20 @@ class CustomersClaims extends Command
Site::all(['id', 'site_id', 'site_nom'])->toArray()
);
$site = $this->validateInput(function () {
return $this->ask('Enter site model id');
}, 'required|numeric|min:1|max:50|exists:site,id');
$site = $this->validateInput(fn() => $this->ask('Enter site model id'), 'required|numeric|min:1|max:50|exists:site,id');
$site = Site::find($site);
} else {
$site = Site::find($siteIdArg);
}
$email = $this->validateInput(function () {
return $this->ask('Enter customer email');
}, 'required|email|min:1|max:255');
$email = $this->validateInput(fn() => $this->ask('Enter customer email'), 'required|email|min:1|max:255');
$crmHashcode = $this->validateInput(function () {
return $this->ask('Enter customer hashcode');
}, 'required|string|min:1|max:36');
$crmHashcode = $this->validateInput(fn() => $this->ask('Enter customer hashcode'), 'required|string|min:1|max:36');
$crmCountry = $this->validateInput(function () {
return $this->ask('Enter customer country ISO code');
}, 'required|numeric|in:56,250,442');
$crmCountry = $this->validateInput(fn() => $this->ask('Enter customer country ISO code'), 'required|numeric|in:56,250,442');
$date = $this->validateInput(function () {
return $this->ask('Enter claim date');
}, 'required|date_format:d/m/Y');
$date = $this->validateInput(fn() => $this->ask('Enter claim date'), 'required|date_format:d/m/Y');
$contacts = Contact::where('contact_email', $email)
->where('contact_siteId', '=', $site->site_id)
@ -89,7 +81,7 @@ class CustomersClaims extends Command
$toAdd = 0;
foreach ($contacts as $contact) {
$claimDate = Carbon::createFromFormat('d/m/Y', $date)->format('Y-m-d');
$claimDate = \Illuminate\Support\Facades\Date::createFromFormat('d/m/Y', $date)->format('Y-m-d');
// On vient chercher les paniers dont la date de création est >= à la date de la récla
$paniers = $contact->paniers()->where('panier_createdate', '>=', $claimDate)->get();
foreach ($paniers as $panier) {
@ -99,9 +91,7 @@ class CustomersClaims extends Command
}
}
$qty = $this->validateInput(function () use ($toAdd) {
return $this->ask('Enter quantity to add', $toAdd);
}, 'required|numeric|max:20');
$qty = $this->validateInput(fn() => $this->ask('Enter quantity to add', $toAdd), 'required|numeric|max:20');
$customer = Customers::firstOrNew([
'hashcode' => $crmHashcode,

View file

@ -16,6 +16,7 @@ class RegenBRBase extends Command
*
* @var string
*/
protected $signature = 'coupons:regen-base';
/**
@ -23,6 +24,7 @@ class RegenBRBase extends Command
*
* @var string
*/
protected $description = 'Re-generate coupons base image';
/**

View file

@ -45,19 +45,19 @@ class Kernel extends ConsoleKernel
$schedule->job(CleanOldDatasJob::class)->daily();
// ---- Commande d'alerte appelé tt les jours de la semaine a 7h00
$schedule->call(function () {
$schedule->call(function (): void {
$sites = Site::all();
$couponSeuilGlobal = array();
$couponDiffusionGlobal = array();
$couponSeuilGlobal = [];
$couponDiffusionGlobal = [];
$sendGlobal = false;
foreach ($sites as $site) {
// ---- Pour chaque site
$campagnes = Campagne::where(['camp_siteId' => $site->site_id])->get();
foreach ($campagnes as $campagne) {
$sendMail = false;
$users = array();
$couponSeuil = array();
$couponDiffusion = array();
$users = [];
$couponSeuil = [];
$couponDiffusion = [];
$coupons = $campagne->coupons()->get();
foreach ($coupons as $coupon) {
$couponAlert = false;
@ -100,7 +100,7 @@ class Kernel extends ConsoleKernel
} //end foreach
} //end foreach
if ($sendGlobal) {
$superadmins = array();
$superadmins = [];
$admins = User::where(['roles' => 'superadmin'])->get();
foreach ($admins as $admin) {
$adminObject = [];

View file

@ -21,6 +21,7 @@ class Handler extends ExceptionHandler
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [];
/**
@ -28,6 +29,7 @@ class Handler extends ExceptionHandler
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
@ -41,9 +43,9 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->reportable(function (Throwable $e) {
$this->reportable(function (Throwable $e): void {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
resolve('sentry')->captureException($e);
}
});
}

View file

@ -101,7 +101,7 @@ class AjaxController extends Controller
$log->log_refsite = $campagne->camp_siteId;
$log->log_params = json_encode(['refcamp' => $campagne->camp_id]);
$couponsPrinted = array();
$couponsPrinted = [];
$coupons = '<TABLE width="100%" align="center" cellpadding="0" cellspacing="0" border="0">';
$coupons .= '<TR><TD width="100%" align="center"><div>';
@ -113,7 +113,7 @@ class AjaxController extends Controller
}
$nbCoupon = 0;
foreach ($couponsToPrint as $key => $coupon_code) {
foreach ($couponsToPrint as $coupon_code) {
$cp = Coupon::where(['coupon_code' => $coupon_code])->first();
if ($this->isAvailable($cp, $campagne, $contact) && $this->isAvailableToPrint($cp, $campagne)) {
@ -233,7 +233,7 @@ class AjaxController extends Controller
if (!isset($panier)) {
die();
}
foreach ($couponsToPrint as $key => $coupon_code) {
foreach ($couponsToPrint as $coupon_code) {
$cp = Coupon::where(['coupon_code' => $coupon_code])->first();
if ($this->isAvailable($cp, $campagne, $contact) && $this->isAvailableToPrint($cp, $campagne)) {

View file

@ -51,7 +51,7 @@ class PanierController extends Controller
if (isset($request->panier) && $request->panier != "") {
$panier = $request->panier;
$panierTab = explode(",", $panier);
$coupons = array();
$coupons = [];
foreach ($panierTab as $panier) {
$pos = strpos($panier, ")");
if ($pos === false || substr_count($panier, ")") != 1) {
@ -88,7 +88,7 @@ class PanierController extends Controller
}
}//end foreach
// ---- Préparation message de log avec coupons
$panierCoupons = array();
$panierCoupons = [];
foreach ($coupons as $code => $qty) {
array_push($panierCoupons, ['cp_code' => $code, 'qty' => $qty]);
}
@ -306,7 +306,7 @@ class PanierController extends Controller
if (isset($request->panier) && $request->panier != "") {
$panier = $request->panier;
$panierTab = explode(",", $panier);
$coupons = array();
$coupons = [];
foreach ($panierTab as $panier) {
$pos = strpos($panier, ")");
if ($pos === false) {
@ -333,7 +333,7 @@ class PanierController extends Controller
// ---- Préparation message de log avec coupons
if (isset($coupons)) {
$panierCoupons = array();
$panierCoupons = [];
foreach ($coupons as $code => $qty) {
array_push($panierCoupons, ['cp_code' => $code, 'qty' => $qty]);
}

View file

@ -30,13 +30,7 @@ class BasketController extends Controller
{
// Validate required parameters
$requiredParams = ['customer_hashcode', 'refcamp', 'refsite', 'panier'];
$error = false;
foreach ($requiredParams as $param) {
if (empty($request->{$param})) {
$error = true;
break;
}
}
$error = array_any($requiredParams, fn($param) => empty($request->{$param}));
if ($error) {
$this->writeLogErrorWrongRequestParameters(

View file

@ -12,7 +12,7 @@ use App\Models\Customers;
use App\Traits\CouponTrait;
use App\Traits\GenerateBR;
use PDF;
use LDC\LDCCRM\CrmApiV2;
use LDC\LDCCRM\CrmApiV4;
class CouponsController extends Controller
{
@ -39,14 +39,14 @@ class CouponsController extends Controller
return new StatusResource(['status' => 'KO', 'code' => 422, 'message' => 'Coupons not found.']);
}
$crm = new CrmApiV2(config('services.crm.endpoint'), $campagne->site->crm_token, $campagne->site->crm_password);
$crm = new CrmApiV4(config('services.crm.endpoint'), $campagne->site->crm_token, $campagne->site->crm_password);
try {
/**
* @var \LDC\LDCCRM\Models\Customer
*/
$crmInfos = $crm->getCustomer($customer->hashcode);
} catch (\Exception $e) {
} catch (\Exception) {
// TODO : Update error message
return new StatusResource(['status' => 'KO', 'code' => 422, 'message' => 'Customer not found.']);
}
@ -60,7 +60,7 @@ class CouponsController extends Controller
$coupons = [];
if ($campagne->camp_type->equals(CampaignTypes::mur())) {
// ---- POUR LES MURS
foreach ($couponsToPrint as $key => $coupon_code) {
foreach ($couponsToPrint as $coupon_code) {
$cp = Coupon::where(['coupon_code' => $coupon_code])->first();
if (!$this->isUsed($cp, $campagne, $customer)) {

View file

@ -17,7 +17,7 @@ class MaintenanceController extends Controller
DB::raw("COUNT(*) as count")
)
->where('log_statut', 'NOK')
->where('created_at', '>=', Carbon::now()->subMonths(5)->startOfMonth())
->where('created_at', '>=', \Illuminate\Support\Facades\Date::now()->subMonths(5)->startOfMonth())
->groupBy('month')
->orderBy('month', 'asc')
->get();

View file

@ -36,7 +36,7 @@ class UserController extends Controller
$sites = Site::whereIn('site_id', $request->site)->get()->pluck('id')->toArray();
$user->sites()->sync($sites);
return redirect()->route('bo.users.edit', $user);
return to_route('bo.users.edit', $user);
}
public function edit(User $user)
@ -56,18 +56,16 @@ class UserController extends Controller
$user->sites()->sync($sites);
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
$submarques = $marques->map(fn($marque) => $marque->only(['id', 'site_nom', 'site_id', 'site_logo']));
session()->put('marques', $submarques);
return redirect()->route('bo.users.edit', $user);
return to_route('bo.users.edit', $user);
}
public function destroy(DestroyUserRequest $request, User $user)
{
if ($user->delete()) {
return redirect()->route('bo.users.index');
return to_route('bo.users.index');
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return view('bo.user.index');

View file

@ -17,6 +17,6 @@ class BrandChangeController extends Controller
// TODO : Revoir le passage du site
$site = \App\Models\Site::find($request->site_id);
session()->put('site', $site);
return redirect()->back();
return back();
}
}

View file

@ -92,7 +92,7 @@ class CampagneController extends Controller
// TODO : Revoir le passage du site id
$siteId = session()->get('site')->id;
$couponsNotLinked = Coupon::whereDoesntHave('campagnes', function ($q) use ($campagne) {
$couponsNotLinked = Coupon::whereDoesntHave('campagnes', function (\Illuminate\Contracts\Database\Query\Builder $q) use ($campagne): void {
$q->where('campagne_id', $campagne->camp_id);
})->where('coupon_siteId', $siteId)->where('coupon_published', 1)->get();
@ -120,7 +120,7 @@ class CampagneController extends Controller
session()->flash('update_nok', __("Erreur lors de l'enregistrement"));
}
return redirect()->route('campagne.edit', ['campagne' => $campagne]);
return to_route('campagne.edit', ['campagne' => $campagne]);
}
/**
@ -169,7 +169,7 @@ class CampagneController extends Controller
$notification->fill(array_merge($request->validated(), ['notif_campId' => $campaign->camp_id]));
$notification->save();
return redirect()->back();
return back();
}
/**
@ -181,10 +181,10 @@ class CampagneController extends Controller
public function deleteNotification(RemoveNotifCampaign $request, Notification $notification)
{
if ($notification->delete()) {
return redirect()->back();
return back();
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return redirect()->back();
return back();
}
}
@ -351,13 +351,13 @@ class CampagneController extends Controller
$type = "panier avec sélection";
break;
}
$data = array (
$data = [
'Site' => $site->site_nom,
'Ref campagne' => $campagne->camp_id,
'Nom campagne' => $campagne->camp_name,
"En ligne" => $enligne,
"Type" => $type,
);
];
$coupons = $campagne->coupons()->get();
@ -393,7 +393,7 @@ class CampagneController extends Controller
$dateFinValidite = date("d/m/Y", strtotime($coupon->coupon_maxdatevalidity));
}
$codeTraitement = array (
$codeTraitement = [
"Code traitement" => $coupon->coupon_code,
"Nom" => $coupon->coupon_name,
"Nb à diffuser" => $this->getFullQuantity($coupon),
@ -403,7 +403,7 @@ class CampagneController extends Controller
"En ligne" => $enligne,
"Date de fin de diffusion" => $dateFinDiffusion,
"Date de fin de validité" => $dateFinValidite,
);
];
$data['Coupons'][] = $codeTraitement;
}//end foreach
}//end if

View file

@ -120,7 +120,7 @@ class CouponController extends Controller
}
}
return redirect()->route('coupon.edit', ['coupon' => $coupon]);
return to_route('coupon.edit', ['coupon' => $coupon]);
}
/**
@ -191,12 +191,12 @@ class CouponController extends Controller
}
session()->flash('update_ok', 'Mise à jour du coupon réussie !');
return redirect()->route('coupon.edit', ['coupon' => $coupon]);
return to_route('coupon.edit', ['coupon' => $coupon]);
} else {
return view('holder');
} //end if
return redirect()->route('coupon.edit', ['coupon' => $coupon]);
return to_route('coupon.edit', ['coupon' => $coupon]);
}
/**
@ -210,7 +210,7 @@ class CouponController extends Controller
$coupon->coupon_published = 0;
$coupon->save();
if ($coupon->delete()) {
return redirect()->route('coupon.index');
return to_route('coupon.index');
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return back();

View file

@ -9,7 +9,7 @@ use App\Models\Basket;
use App\Traits\GenerateBR;
use PDF;
use Illuminate\Http\Request;
use LDC\LDCCRM\CrmApiV2;
use LDC\LDCCRM\CrmApiV4;
class BasketController extends Controller
{
@ -18,9 +18,7 @@ class BasketController extends Controller
// FIXME: Docblock
public function show(Request $request, Basket $basket)
{
$totalQuantity = $basket->contents->sum(function ($content) {
return $content->quantity - $content->printed;
});
$totalQuantity = $basket->contents->sum(fn($content) => $content->quantity - $content->printed);
if (!$totalQuantity) {
return view('fo.basket.empty', compact('basket'));
@ -34,17 +32,14 @@ class BasketController extends Controller
{
$campagne = $basket->campagne;
// FIXME: Bump to CrmApiV4
$crm = new CrmApiV2(config('services.crm.endpoint'), $campagne->site->crm_token, $campagne->site->crm_password);
$crm = new CrmApiV4(config('services.crm.endpoint'), $campagne->site->crm_token, $campagne->site->crm_password);
/**
* @var \LDC\LDCCRM\Models\Customer
*/
$crmInfos = $crm->getCustomer($basket->customer->hashcode);
if (is_null($crmInfos)) {
throw new \Exception('Customer not found.');
}
throw_if(is_null($crmInfos), \Exception::class, 'Customer not found.');
$coupons = [];
$currentDateTime = date('Y-m-d H:i:s');
@ -83,7 +78,7 @@ class BasketController extends Controller
}
if (empty($coupons)) {
return redirect()->route('fo.basket.show', $basket);
return to_route('fo.basket.show', $basket);
}
// $coupons contains all printed coupons

View file

@ -20,28 +20,22 @@ class PanierController extends Controller
{
// $panier = Panier::find($request->query('basketid'));
$panier = Panier::where(['panier_ref' => $request->basketid])->first();
if (!$panier) {
abort(404);
}
abort_unless($panier, 404);
session()->put('panier', $panier);
$panierCouponsCount = $this->getCountCouponsPanierPublished($panier);
$contact = Contact::where(['contact_id' => $panier->panier_contactId])->first();
if (!$contact) {
abort(404);
}
abort_unless($contact, 404);
session()->put('contact', $contact);
$campagne = Campagne::where(['camp_id' => $panier->panier_campId, 'camp_published' => 1])->first();
if (!$campagne) {
abort(404);
}
abort_unless($campagne, 404);
session()->put('campagne', $campagne);
if ($campagne->camp_type->equals(CampaignTypes::panier())) {
$coupons = $this->getCouponsPublished($campagne);
} else {
$panierContents = $this->getPanierContentPublished($panier);
$coupons = array();
$coupons = [];
foreach ($panierContents as $panierContent) {
$cp = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
$qty = $panierContent->panier_content_quantity;
@ -63,9 +57,7 @@ class PanierController extends Controller
$coupons = session('coupons', []);
if (!$request->session()->has('campagne')) {
abort(404);
}
abort_unless($request->session()->has('campagne'), 404);
$campagne = $request->session()->get('campagne');

View file

@ -20,7 +20,7 @@ class RedirectController extends Controller
if (isset($request->basketid)) {
return $panier->showTemplate($request);
} else {
return redirect()->route('login');
return to_route('login');
}
}
}

View file

@ -66,9 +66,7 @@ class SiteController extends Controller
}
// --- MAJ Selecteur marques
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
$submarques = $marques->map(fn($marque) => $marque->only(['id', 'site_nom', 'site_id', 'site_logo']));
session()->put('marques', $submarques);
@ -101,7 +99,7 @@ class SiteController extends Controller
session()->flash('update_nok', 'Erreur lors de l\'enregistrement');
}
return redirect()->route('site.edit', ['site' => $site]);
return to_route('site.edit', ['site' => $site]);
}
/**

View file

@ -50,7 +50,7 @@ class Kernel extends HttpKernel
*
* @var array
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

View file

@ -11,6 +11,7 @@ class CheckForMaintenanceMode extends Middleware
*
* @var array
*/
protected $except = [
];
}

View file

@ -11,6 +11,7 @@ class EncryptCookies extends Middleware
*
* @var array
*/
protected $except = [
];
}

View file

@ -18,7 +18,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect()->route('campagne.index');
return to_route('campagne.index');
}
return $next($request);

View file

@ -29,9 +29,7 @@ class SaveCurrentRoute
if (!$siteId) {
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
$submarques = $marques->map(fn($marque) => $marque->only(['id', 'site_nom', 'site_id', 'site_logo']));
session()->put('marques', $submarques);
}

View file

@ -11,6 +11,7 @@ class TrimStrings extends Middleware
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',

View file

@ -3,7 +3,7 @@
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
@ -19,5 +19,10 @@ class TrustProxies extends Middleware
*
* @var integer
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View file

@ -4,13 +4,14 @@ namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
class VerifyCsrfToken extends \Illuminate\Foundation\Http\Middleware\PreventRequestForgery
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var boolean
*/
protected $addHttpCookie = true;
/**
@ -18,6 +19,7 @@ class VerifyCsrfToken extends Middleware
*
* @var array
*/
protected $except = [
'updatecontact',
'updatebasket',

View file

@ -30,9 +30,7 @@ class StoreNotifCampaign extends FormRequest
'notif_name' => 'min:5|required',
'notif_email' => [
'required',
Rule::unique('notification')->where(function ($query) {
return $query->where('notif_campId', $this->campaign->camp_id);
}),
Rule::unique('notification')->where(fn($query) => $query->where('notif_campId', $this->campaign->camp_id)),
]
];
}

View file

@ -55,21 +55,15 @@ class StoreCoupons extends FormRequest
/**
* Configure the validator instance.
*
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
*/
public function withValidator($validator)
{
$validator->sometimes('coupon_gs1code', 'required|image|mimes:jpeg', function ($input) {
return isset($input->coupon_norme);
});
$validator->sometimes('coupon_gs1code', 'required|image|mimes:jpeg', fn($input) => isset($input->coupon_norme));
$validator->sometimes('coupon_limitquantity', 'integer|required', function ($input) {
return !is_null($input->coupon_enablelimitquantity);
});
$validator->sometimes('coupon_limitquantity', 'integer|required', fn($input) => !is_null($input->coupon_enablelimitquantity));
$validator->sometimes('coupon_limitperiod', 'integer|required', function ($input) {
return !is_null($input->coupon_enablelimitperiod);
});
$validator->sometimes('coupon_limitperiod', 'integer|required', fn($input) => !is_null($input->coupon_enablelimitperiod));
}
}

View file

@ -59,7 +59,7 @@ class UpdateCoupons extends FormRequest
/**
* Configure the validator instance.
*
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
*/
public function withValidator($validator)
@ -71,12 +71,8 @@ class UpdateCoupons extends FormRequest
return isset($input->coupon_norme);
});
$validator->sometimes('coupon_limitquantity', 'integer|required', function ($input) {
return !is_null($input->coupon_enablelimitquantity);
});
$validator->sometimes('coupon_limitquantity', 'integer|required', fn($input) => !is_null($input->coupon_enablelimitquantity));
$validator->sometimes('coupon_limitperiod', 'integer|required', function ($input) {
return !is_null($input->coupon_enablelimitperiod);
});
$validator->sometimes('coupon_limitperiod', 'integer|required', fn($input) => !is_null($input->coupon_enablelimitperiod));
}
}

View file

@ -22,19 +22,11 @@ class PrintRequest extends FormRequest
{
$campagne = $this->basket->campagne;
if (!$campagne->camp_type->equals(CampaignTypes::panier())) {
throw new \Exception('Campaign is not basket.');
}
throw_unless($campagne->camp_type->equals(CampaignTypes::panier()), \Exception::class, 'Campaign is not basket.');
if ($campagne->camp_published === 0) {
throw new \Exception('Campaign is not published.');
}
if ($campagne->site->crm_token === null) {
throw new \Exception('CRM Token is missing.');
}
if ($campagne->site->crm_password === null) {
throw new \Exception('CRM Password is missing.');
}
throw_if($campagne->camp_published === 0, \Exception::class, 'Campaign is not published.');
throw_if($campagne->site->crm_token === null, \Exception::class, 'CRM Token is missing.');
throw_if($campagne->site->crm_password === null, \Exception::class, 'CRM Password is missing.');
}
/**

View file

@ -18,7 +18,7 @@ class CouponsResource extends JsonResource
'code' => $this->coupon_code,
'name' => $this->coupon_name,
'value' => $this->coupon_value,
'used' => isset($this->isUsed) ? $this->isUsed : false,
'used' => $this->isUsed ?? false,
'desktop_image_available' => $this->returnUrl($this->coupon_thumbnail1),
'desktop_image_unavailable' => $this->returnUrl($this->coupon_thumbnail2),
'mobile_image_available' => $this->returnUrl($this->coupon_thumbnail3),

View file

@ -37,10 +37,10 @@ class ArchiveStatsJob implements ShouldQueue
public function handle()
{
try {
DB::transaction(function () {
DB::transaction(function (): void {
Statistique::query()
->where('date', '<', now())
->each(function ($stat) {
->each(function ($stat): void {
$archiveStat = new ArchiveStat();
$archiveStat->quantity = $stat->stat_couponPrinted;
$archiveStat->date = $stat->date;

View file

@ -39,7 +39,7 @@ class CleanOldDatasJob implements ShouldQueue
{
try {
DB::transaction(function () {
DB::transaction(function (): void {
// Delete old contacts.
$deletedContact = Contact::query()
->where('contact_updatedate', '<', now()->subYears(3))

View file

@ -19,20 +19,14 @@ class DeleteCrmCustomerJob implements ShouldQueue
use Queueable;
use SerializesModels;
/**
* @var array $customer
*/
private $customer;
/**
* Create a new job instance.
*
* @param array $customer
*/
public function __construct($customer)
public function __construct(private $customer)
{
$this->onConnection('rabbitmq');
$this->customer = $customer;
}
/**
@ -46,7 +40,7 @@ class DeleteCrmCustomerJob implements ShouldQueue
$email = $this->customer['email'];
try {
DB::transaction(function () use ($hashchode, $email) {
DB::transaction(function () use ($hashchode, $email): void {
// For baskets and old walls.
$contact = Contact::query()->where('contact_ref', $hashchode)->first();
if ($contact) {
@ -88,7 +82,7 @@ class DeleteCrmCustomerJob implements ShouldQueue
$csvPath = \storage_path('/logs/crm.csv');
if (!\file_exists($csvPath)) {
$logFile = fopen($csvPath, 'w');
\fputcsv($logFile, ['date', 'hashcode', 'email', 'action'], ';');
\fputcsv($logFile, ['date', 'hashcode', 'email', 'action'], ';', escape: '\\');
\fclose($logFile);
}
@ -101,7 +95,8 @@ class DeleteCrmCustomerJob implements ShouldQueue
$this->customer['email'],
$message
],
';'
';',
escape: '\\'
);
\fclose($logFile);
}

View file

@ -170,19 +170,12 @@ class ExceptionsHelper
$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]);
}
match ($type) {
'object' => $traceArgs .= sprintf('Object(%s)', $stack['args'][$i]::class),
'array' => $traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i])),
'string' => $traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i])),
default => $traceArgs .= \gettype($stack['args'][$i]),
};
$traceArgs .= ($i !== ($argsCount - 1) ? ',' : '');
}
return $traceArgs;

View file

@ -11,9 +11,6 @@ class AlertBr extends Mailable
use Queueable;
use SerializesModels;
public $couponSeuil;
public $couponDiffusion;
public $subject;
@ -23,10 +20,8 @@ class AlertBr extends Mailable
*
* @return void
*/
public function __construct($couponSeuil, $couponDiffusion, $sitename)
public function __construct(public $couponSeuil, public $couponDiffusion, $sitename)
{
$this->couponSeuil = $couponSeuil;
$this->couponDiffusion = $couponDiffusion;
$this->subject = 'Notification mes BR : ' . $sitename;
}

View file

@ -11,9 +11,6 @@ class AlertBrAdmin extends Mailable
use Queueable;
use SerializesModels;
public $couponSeuil;
public $couponDiffusion;
public $subject;
@ -23,10 +20,8 @@ class AlertBrAdmin extends Mailable
*
* @return void
*/
public function __construct($couponSeuil, $couponDiffusion)
public function __construct(public $couponSeuil, public $couponDiffusion)
{
$this->couponSeuil = $couponSeuil;
$this->couponDiffusion = $couponDiffusion;
$this->subject = 'Notification mes BR : Récapitulatif global';
}

View file

@ -26,6 +26,7 @@ class ArchiveCampaign extends Model
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'campaign_id',
@ -39,7 +40,7 @@ class ArchiveCampaign extends Model
*/
protected static function booted(): void
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$model->assertFieldIsUnique('campaign_id', $model->campaign_id);
$site = Site::query()->where('site_id', $model->archive_site_id)->firstOrFail();
$archiveSite = ArchiveSite::query()->firstOrCreate(
@ -52,10 +53,10 @@ class ArchiveCampaign extends Model
);
$model->archiveSite()->associate($archiveSite);
});
static::updating(function () {
static::updating(function (): void {
throw new \RuntimeException('Updating an archived campaign is not authorized');
});
static::deleting(function () {
static::deleting(function (): void {
throw new \RuntimeException('Deleting an archived campaign is not authorized');
});
}

View file

@ -24,6 +24,7 @@ class ArchiveCoupon extends Model
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'coupon_code',
@ -36,13 +37,13 @@ class ArchiveCoupon extends Model
*/
protected static function booted(): void
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$model->assertFieldIsUnique('coupon_code', $model->coupon_code);
});
static::updating(function () {
static::updating(function (): void {
throw new \RuntimeException('Updating an archived coupon is not authorized');
});
static::deleting(function () {
static::deleting(function (): void {
throw new \RuntimeException('Deleting an archived coupon is not authorized');
});
}

View file

@ -24,6 +24,7 @@ class ArchiveSite extends Model
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'site_id',
@ -36,13 +37,13 @@ class ArchiveSite extends Model
*/
protected static function booted(): void
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$model->assertFieldIsUnique('site_id', $model->site_id);
});
static::updating(function (self $model) {
static::updating(function (self $model): void {
throw new \RuntimeException('Updating an archived site is not authorized');
});
static::deleting(function () {
static::deleting(function (): void {
throw new \RuntimeException('Deleting an archived site is not authorized');
});
}

View file

@ -25,6 +25,7 @@ class ArchiveStat extends Model
*
* @var array<int, string>
*/
protected $fillable = [
'date',
'quantity',
@ -37,7 +38,7 @@ class ArchiveStat extends Model
*/
protected static function booted(): void
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$campaign = Campagne::withTrashed()->where('camp_id', $model->archive_campaign_id)->firstOrFail();
$archiveCampaign = ArchiveCampaign::query()->firstOrCreate(
[
@ -61,10 +62,10 @@ class ArchiveStat extends Model
);
$model->archiveCoupon()->associate($archiveCoupon);
});
static::updating(function () {
static::updating(function (): void {
throw new \RuntimeException('Upating an archived stat is not authorized');
});
static::deleting(function () {
static::deleting(function (): void {
throw new \RuntimeException('Deleting an archived stat is not authorized');
});
}

View file

@ -13,6 +13,7 @@ class Basket extends Model
{
use HasFactory;
protected $fillable = [
'campagne_id'
];

View file

@ -18,7 +18,7 @@ class BasketContent extends Model
*/
protected static function booted()
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$model->printed = 0;
});
}

View file

@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class Calendrier extends Model
@ -9,23 +10,28 @@ class Calendrier extends Model
/**
* @var string
*/
protected $table = 'calendrier';
/**
* @var boolean
*/
public $timestamps = false;
/**
* @var string
*/
protected $primaryKey = 'calendrier_id';
protected $dates = ['calendrier_startdate', 'calendrier_enddate'];
/**
* @var array
*/
protected $fillable = [
'calendrier_startdate',
'calendrier_enddate'
@ -37,7 +43,7 @@ class Calendrier extends Model
*/
public function coupon()
{
return $this->belongsTo('App\Models\Coupon', 'calendrier_couponId');
return $this->belongsTo(\App\Models\Coupon::class, 'calendrier_couponId');
}
// * METHODS
@ -49,6 +55,9 @@ class Calendrier extends Model
*/
public function isPublished(): bool
{
return now()->betweenIncluded($this->calendrier_startdate, $this->calendrier_enddate->endOfDay());
return now()->betweenIncluded(
Carbon::parse($this->calendrier_startdate),
Carbon::parse($this->calendrier_enddate)->endOfDay()
);
}
}

View file

@ -24,6 +24,7 @@ class Campagne extends Model
/**
* @var array
*/
protected $fillable = [
'camp_siteId',
'camp_name',
@ -50,16 +51,19 @@ class Campagne extends Model
/**
* @var string
*/
protected $table = 'campagne';
/**
* @var string
*/
protected $primaryKey = 'camp_id';
/**
* @var array
*/
protected $dates = ['camp_deleted_at'];
@ -70,7 +74,7 @@ class Campagne extends Model
*/
public function notifications()
{
return $this->hasMany('App\Models\Notification', 'notif_campId', 'camp_id');
return $this->hasMany(\App\Models\Notification::class, 'notif_campId', 'camp_id');
}
/**
@ -79,7 +83,7 @@ class Campagne extends Model
*/
public function murs()
{
return $this->hasMany('App\Models\Mur', 'mur_campId', 'camp_id');
return $this->hasMany(\App\Models\Mur::class, 'mur_campId', 'camp_id');
}
/**
@ -88,7 +92,7 @@ class Campagne extends Model
*/
public function paniers()
{
return $this->hasMany('App\Models\Panier', 'panier_campId', 'camp_id');
return $this->hasMany(\App\Models\Panier::class, 'panier_campId', 'camp_id');
}
/**
@ -97,7 +101,7 @@ class Campagne extends Model
*/
public function site()
{
return $this->belongsTo('App\Models\Site', 'camp_siteId', 'site_id');
return $this->belongsTo(\App\Models\Site::class, 'camp_siteId', 'site_id');
}
/**
@ -105,7 +109,7 @@ class Campagne extends Model
*/
public function coupons()
{
return $this->belongsToMany('App\Models\Coupon', 'campagne_coupon', 'campagne_id', 'coup_id');
return $this->belongsToMany(\App\Models\Coupon::class, 'campagne_coupon', 'campagne_id', 'coup_id');
}
/**

View file

@ -24,16 +24,19 @@ class Contact extends Model
/**
* @var string
*/
protected $table = 'contact';
/**
* @var string
*/
protected $primaryKey = 'contact_id';
/**
* @var array
*/
protected $fillable = [
'contact_ref',
'contact_prenom',
@ -50,7 +53,7 @@ class Contact extends Model
*/
public function murs()
{
return $this->hasMany('App\Models\Mur', 'mur_contactId', 'contact_id');
return $this->hasMany(\App\Models\Mur::class, 'mur_contactId', 'contact_id');
}
/**
@ -59,7 +62,7 @@ class Contact extends Model
*/
public function paniers()
{
return $this->hasMany('App\Models\Panier', 'panier_contactId', 'contact_id');
return $this->hasMany(\App\Models\Panier::class, 'panier_contactId', 'contact_id');
}
/**
@ -68,45 +71,63 @@ class Contact extends Model
*/
public function site()
{
return $this->belongsTo('App\Models\Site', 'contact_siteId');
return $this->belongsTo(\App\Models\Site::class, 'contact_siteId');
}
public function scopeSearchName($query, $name)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchName($query, $name)
{
if ($name) {
$query->where('contact_nom', 'like', '%' . $name . '%');
}
}
public function scopeSearchFirstname($query, $firstname)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchFirstname($query, $firstname)
{
if ($firstname) {
$query->where('contact_prenom', 'like', '%' . $firstname . '%');
}
}
public function scopeSearchEmail($query, $email)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchEmail($query, $email)
{
if ($email) {
$query->where('contact_email', 'like', '%' . $email . '%');
}
}
public function scopeSearchVille($query, $ville)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchVille($query, $ville)
{
if ($ville) {
$query->where('contact_ville', 'like', '%' . $ville . '%');
}
}
public function scopeSearchCp($query, $cp)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchCp($query, $cp)
{
if ($cp) {
$query->where('contact_cp', 'like', '%' . $cp . '%');
}
}
public function scopeSearchCountry($query, $country)
/**
* @param \Illuminate\Database\Eloquent\Builder<static> $query
*/
protected function scopeSearchCountry($query, $country)
{
if ($country) {
$query->where('contact_country', $country);

View file

@ -30,16 +30,19 @@ class Coupon extends Model
/**
* @var string
*/
protected $table = 'coupon';
/**
* @var string
*/
protected $primaryKey = 'coupon_id';
/**
* @var array
*/
protected $fillable = [
'coupon_code',
'coupon_norme',
@ -77,7 +80,7 @@ class Coupon extends Model
*/
public function calendriers()
{
return $this->hasMany('App\Models\Calendrier', 'calendrier_couponId', 'coupon_id');
return $this->hasMany(\App\Models\Calendrier::class, 'calendrier_couponId', 'coupon_id');
}
/**
@ -86,7 +89,7 @@ class Coupon extends Model
*/
public function panierContents()
{
return $this->hasMany('App\Models\PanierContent', 'panier_content_couponId', 'coupon_id');
return $this->hasMany(\App\Models\PanierContent::class, 'panier_content_couponId', 'coupon_id');
}
/**
@ -95,7 +98,7 @@ class Coupon extends Model
*/
public function murs()
{
return $this->hasMany('App\Models\Mur', 'mur_couponId', 'coupon_id');
return $this->hasMany(\App\Models\Mur::class, 'mur_couponId', 'coupon_id');
}
/**
@ -104,7 +107,7 @@ class Coupon extends Model
*/
public function mouvements()
{
return $this->hasMany('App\Models\Mouvement', 'mouvement_couponId', 'coupon_id');
return $this->hasMany(\App\Models\Mouvement::class, 'mouvement_couponId', 'coupon_id');
}
/**
@ -113,7 +116,7 @@ class Coupon extends Model
*/
public function site()
{
return $this->belongsTo('App\Models\Site', 'coupon_siteId');
return $this->belongsTo(\App\Models\Site::class, 'coupon_siteId');
}
/**
@ -121,7 +124,7 @@ class Coupon extends Model
*/
public function campagnes()
{
return $this->belongsToMany('App\Models\Campagne', 'campagne_coupon', 'coup_id', 'campagne_id');
return $this->belongsToMany(\App\Models\Campagne::class, 'campagne_coupon', 'coup_id', 'campagne_id');
}
/**

View file

@ -14,16 +14,19 @@ class Customers extends Model
/**
* @var string $primaryKey
*/
protected $primaryKey = 'hashcode';
/**
* @var string $keyType
*/
protected $keyType = 'string';
/**
* @var array $fillable
*/
protected $fillable = ['hashcode', 'email', 'country'];
/**
@ -33,12 +36,12 @@ class Customers extends Model
*/
protected static function booted()
{
static::creating(function ($customer) {
$customer->country = (new Customers())->getIsoCountry($customer->country);
static::creating(function ($customer): void {
$customer->country = new Customers()->getIsoCountry($customer->country);
});
static::updating(function ($customer) {
$customer->country = (new Customers())->getIsoCountry($customer->country);
static::updating(function ($customer): void {
$customer->country = new Customers()->getIsoCountry($customer->country);
});
}
@ -52,16 +55,11 @@ class Customers extends Model
private function getIsoCountry($country)
{
$country = trim(ucfirst(strtolower($country)));
switch ($country) {
case 'Belgique':
$country = 56;
break;
case 'Luxembourg':
$country = 442;
break;
default:
$country = 250;
}
$country = match ($country) {
'Belgique' => 56,
'Luxembourg' => 442,
default => 250,
};
return $country;
}

View file

@ -6,16 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
public $timestamps = false;
/**
* @var string
*/
protected $table = 'logs';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* @var string
@ -25,6 +28,7 @@ class Log extends Model
/**
* @var array
*/
protected $fillable = [
'log_action',
'log_refsite',

View file

@ -9,23 +9,28 @@ class Mouvement extends Model
/**
* @var string
*/
protected $table = 'mouvement';
/**
* @var string
*/
protected $primaryKey = 'mouvement_id';
/**
* @var boolean
*/
public $timestamps = false;
protected $dates = ['mouvement_created_at'];
/**
* @var array
*/
protected $fillable = [
'mouvement_nombre',
'mouvement_created_at'
@ -37,6 +42,6 @@ class Mouvement extends Model
*/
public function coupon()
{
return $this->belongsTo('App\Models\Coupon', 'mouvement_couponId');
return $this->belongsTo(\App\Models\Coupon::class, 'mouvement_couponId');
}
}

View file

@ -9,16 +9,19 @@ class Mur extends Model
/**
* @var string
*/
protected $table = 'mur';
/**
* @var string
*/
protected $primaryKey = 'mur_id';
/**
* @var boolean
*/
public $timestamps = false;
/**
@ -27,7 +30,7 @@ class Mur extends Model
*/
public function campagne()
{
return $this->belongsTo('App\Models\Campagne', 'mur_campId');
return $this->belongsTo(\App\Models\Campagne::class, 'mur_campId');
}
/**
@ -36,7 +39,7 @@ class Mur extends Model
*/
public function contact()
{
return $this->belongsTo('App\Models\Contact', 'mur_contactId');
return $this->belongsTo(\App\Models\Contact::class, 'mur_contactId');
}
/**
@ -45,6 +48,6 @@ class Mur extends Model
*/
public function coupon()
{
return $this->belongsTo('App\Models\Coupon', 'mur_couponId');
return $this->belongsTo(\App\Models\Coupon::class, 'mur_couponId');
}
}

View file

@ -9,18 +9,22 @@ class Notification extends Model
/**
* @var string
*/
protected $table = 'notification';
/**
* @var string
*/
protected $primaryKey = 'notif_id';
/**
* @var boolean
*/
public $timestamps = false;
protected $fillable = ['notif_name', 'notif_email', 'notif_campId'];
/**
@ -29,6 +33,6 @@ class Notification extends Model
*/
public function campagne()
{
return $this->belongsTo('App\Models\Campagne', 'notif_campId');
return $this->belongsTo(\App\Models\Campagne::class, 'notif_campId');
}
}

View file

@ -8,20 +8,23 @@ use Illuminate\Database\Eloquent\Model;
class Panier extends Model
{
use HasFactory;
/**
* @var string
*/
protected $table = 'panier';
/**
* @var string
*/
protected $primaryKey = 'panier_id';
/**
* @var boolean
*/
public $timestamps = false;
// protected $with = ['panierContents'];
@ -31,7 +34,7 @@ class Panier extends Model
*/
public function panierContents()
{
return $this->hasMany('App\Models\PanierContent', 'panier_content_panierId', 'panier_id');
return $this->hasMany(\App\Models\PanierContent::class, 'panier_content_panierId', 'panier_id');
}
/**
@ -40,7 +43,7 @@ class Panier extends Model
*/
public function campagne()
{
return $this->belongsTo('App\Models\Campagne', 'panier_campId');
return $this->belongsTo(\App\Models\Campagne::class, 'panier_campId');
}
/**
@ -49,6 +52,6 @@ class Panier extends Model
*/
public function contact()
{
return $this->belongsTo('App\Models\Contact', 'panier_contactId');
return $this->belongsTo(\App\Models\Contact::class, 'panier_contactId');
}
}

View file

@ -9,16 +9,19 @@ class PanierContent extends Model
/**
* @var string
*/
protected $table = 'panier_content';
/**
* @var string
*/
protected $primaryKey = 'panier_content_id';
/**
* @var boolean
*/
public $timestamps = false;
/**
@ -27,7 +30,7 @@ class PanierContent extends Model
*/
public function panier()
{
return $this->belongsTo('App\Models\Panier', 'panier_content_panierId', 'panier_id');
return $this->belongsTo(\App\Models\Panier::class, 'panier_content_panierId', 'panier_id');
}
/**
@ -36,12 +39,13 @@ class PanierContent extends Model
*/
public function coupon()
{
return $this->belongsTo('App\Models\Coupon', 'panier_content_couponId');
return $this->belongsTo(\App\Models\Coupon::class, 'panier_content_couponId');
}
/**
* @var array
*/
protected $fillable = [
'panier_content_panierId',
'panier_content_couponId',

View file

@ -12,26 +12,31 @@ class Site extends Model
/**
* @var string
*/
protected $table = 'site';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* @var string
*/
protected $keyType = 'string';
/**
* @var boolean
*/
public $timestamps = false;
/**
* @var array
*/
protected $fillable = ['site_nom', 'site_logo', 'site_contact', 'site_rcs', 'site_libelle'];
/**
@ -40,7 +45,7 @@ class Site extends Model
*/
public function campagnes()
{
return $this->hasMany('App\Models\Campagne', 'camp_siteId', 'site_id');
return $this->hasMany(\App\Models\Campagne::class, 'camp_siteId', 'site_id');
}
/**
@ -49,7 +54,7 @@ class Site extends Model
*/
public function contacts()
{
return $this->hasMany('App\Models\Contact', 'contact_siteId', 'site_id');
return $this->hasMany(\App\Models\Contact::class, 'contact_siteId', 'site_id');
}
/**
@ -57,7 +62,7 @@ class Site extends Model
*/
public function users()
{
return $this->belongsToMany('App\Models\User', 'site_user', 'site_id', 'user_id');
return $this->belongsToMany(\App\Models\User::class, 'site_user', 'site_id', 'user_id');
}
/**
@ -66,13 +71,13 @@ class Site extends Model
*/
public function coupons()
{
return $this->hasMany('App\Models\Coupon', 'coupon_siteId', 'id');
return $this->hasMany(\App\Models\Coupon::class, 'coupon_siteId', 'id');
}
/**
* @return string
*/
public function __toString()
public function __toString(): string
{
return $this->site_id . " : " . $this->site_nom;
}

View file

@ -6,16 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Statistique extends Model
{
public $timestamps = false;
/**
* @var string
*/
protected $table = 'statistiques';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* @var string
@ -25,6 +28,7 @@ class Statistique extends Model
/**
* @var array
*/
protected $fillable = [
'stat_campId',
'stat_couponId',
@ -35,6 +39,7 @@ class Statistique extends Model
/**
* @var array
*/
protected $casts = [
'date' => 'date'
];
@ -46,7 +51,7 @@ class Statistique extends Model
*/
protected static function booted(): void
{
static::creating(function (self $model) {
static::creating(function (self $model): void {
$model->date = now()->toDateString();
});
}

View file

@ -23,11 +23,13 @@ class User extends Authenticatable
/**
* @var string
*/
protected $table = 'users';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
@ -35,6 +37,7 @@ class User extends Authenticatable
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'roles',
];
@ -44,6 +47,7 @@ class User extends Authenticatable
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
@ -53,7 +57,7 @@ class User extends Authenticatable
*/
public function sites()
{
return $this->belongsToMany('App\Models\Site', 'site_user', 'user_id', 'site_id');
return $this->belongsToMany(\App\Models\Site::class, 'site_user', 'user_id', 'site_id');
}

View file

@ -30,7 +30,7 @@ class ResetPassword extends ResetPasswordNotification
*/
public function toMail($notifiable)
{
return (new MailMessage())
return new MailMessage()
->subject('MesBR - Réinitialisation du mot de passe')
->line('Vous recevez cet email car nous avons reçu une requête de réinitialisation de mot de passe pour votre compte.')
->action('Réinitialiser votre mot de passe', url(config('app.url') . route('password.reset', $this->token, false)))

View file

@ -11,6 +11,7 @@ class AuthServiceProvider extends ServiceProvider
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];

View file

@ -13,6 +13,7 @@ class EventServiceProvider extends ServiceProvider
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,

View file

@ -14,6 +14,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**

View file

@ -280,7 +280,7 @@ trait CouponTrait
// Paniers
// TODO : Revoir la requete
$campagneId = $campagne->camp_id;
$countPrinted = PanierContent::where('panier_content_couponId', $coupon->coupon_id)->whereHas('panier', function ($query) use ($campagneId) {
$countPrinted = PanierContent::where('panier_content_couponId', $coupon->coupon_id)->whereHas('panier', function ($query) use ($campagneId): void {
$query->where('panier_campId', $campagneId);
})->sum('panier_content_printed');
}
@ -299,7 +299,7 @@ trait CouponTrait
} else {
// Paniers
$campagneId = $campagne->camp_id;
$panierContents = PanierContent::where('panier_content_couponId', $coupon->coupon_id)->whereHas('panier', function ($query) use ($campagneId) {
$panierContents = PanierContent::where('panier_content_couponId', $coupon->coupon_id)->whereHas('panier', function ($query) use ($campagneId): void {
$query->where('panier_campId', $campagneId);
})->get();
$panierContentCountPrinted = $panierContents->sum('panier_content_printed');
@ -323,11 +323,11 @@ trait CouponTrait
$countPrinted = $countPrinted + count($murs);
} else {
// Paniers
$paniers = Panier::where(['panier_campId' => $campagne->camp_id])->where(function ($query) use ($startdate, $enddate) {
$paniers = Panier::where(['panier_campId' => $campagne->camp_id])->where(function ($query) use ($startdate, $enddate): void {
$query->whereBetween('panier_createdate', [$startdate, $enddate])
->orWhereBetween('panier_updatedate', [$startdate, $enddate]);
})->get();
foreach ($paniers as $key => $panier) {
foreach ($paniers as $panier) {
$panierContentCount = $panier->panierContents->sum('panier_content_printed');
$countPrinted = $countPrinted + $panierContentCount;
}

View file

@ -32,7 +32,7 @@ trait GenerateBR
$product_image = public_path() . '/' . $coupon->coupon_decoration_image;
// ---- Masque dans lequel l'image finale sera placée
$mask = imagecreatefrompng($mask_img);
list($maskWidth, $maskHeight) = getimagesize($mask_img);
[$maskWidth, $maskHeight] = getimagesize($mask_img);
// ----- Mentions légales + RCS
if ($coupon->coupon_legal_mentions_splitted == 0) {
@ -184,15 +184,10 @@ trait GenerateBR
// ---- Créer le fichier final
imagepng($mask, storage_path('app/public/modelfiles/coupons') . "/" . $coupon->coupon_code . ".png", 9);
// ---- Libère la mémoire associée aux images manipulées
imagedestroy($logo);
imagedestroy($pdt);
imagedestroy($mask);
return "storage/modelfiles/coupons/" . $coupon->coupon_code . ".png";
}
function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
public function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
{
if ($spacing == 0) {
imagefttext($image, $size, $angle, $x, $y, $color, $font, $text);
@ -212,13 +207,13 @@ trait GenerateBR
function imagettftextContour($image, $fontsize, $angle, $x, $y, $color, $font, $text, $color_contour, $contour_haut = 1, $contour_bas = 1, $contour_gauche = 1, $contour_droite = 1)
public function imagettftextContour($image, $fontsize, $angle, $x, $y, $color, $font, $text, $color_contour, $contour_haut = 1, $contour_bas = 1, $contour_gauche = 1, $contour_droite = 1)
{
$coords_x = array();
$coords_y = array();
$coords_x = [];
$coords_y = [];
for ($i_y = -$contour_haut; $i_y <= $contour_bas; $i_y++) {
$y_temp = @array_fill(0, $contour_gauche + $contour_droite + 1, $i_y);
$x_temp = array();
$x_temp = [];
for ($i_x = -$contour_gauche; $i_x <= $contour_droite; $i_x++) {
$x_temp[] = $i_x;
}
@ -240,7 +235,7 @@ trait GenerateBR
// ---- Masque dans lequel l'image finale sera placée
$mask = imagecreatefrompng($coupon->coupon_image);
list($maskWidth, $maskHeight) = getimagesize($coupon->coupon_image);
[$maskWidth, $maskHeight] = getimagesize($coupon->coupon_image);
// ----- Mentions légales + RCS dépendant de l'user
@ -336,7 +331,7 @@ trait GenerateBR
if (($coupon->coupon_norme == 1 && strlen($contact->contact_cp) == 4) || $coupon->coupon_code == '5425003942648' || $coupon->coupon_code == '5425003941641') {
$codeBarre = imagecreatefromjpeg($coupon->coupon_gs1code);
imageresolution($codeBarre, 72);
list($width, $height) = getimagesize($coupon->coupon_gs1code);
[$width, $height] = getimagesize($coupon->coupon_gs1code);
$r = $width / $height;
$w = 285;
$h = 150;
@ -370,10 +365,6 @@ trait GenerateBR
$contents = ob_get_contents();
ob_end_clean();
$dataUri = "data:image/jpeg;base64," . base64_encode($contents);
// ---- Libère la mémoire associée aux images manipulées
imagedestroy($mask);
imagedestroy($ImageFond);
return $dataUri;
}
@ -385,7 +376,7 @@ trait GenerateBR
// Load base mask image
$mask = imagecreatefrompng($coupon->coupon_image);
list($maskWidth, $maskHeight) = getimagesize($coupon->coupon_image);
[$maskWidth, $maskHeight] = getimagesize($coupon->coupon_image);
// --- Draw Legal Mentions + RCS depending on the user country
if ($coupon->coupon_legal_mentions_splitted == 1) {
@ -418,8 +409,6 @@ trait GenerateBR
}
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
imagedestroy($ImageMentionFond);
}
// --- User inscription and city
@ -455,7 +444,6 @@ trait GenerateBR
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 770, 40, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
imagedestroy($ImageFond);
// --- Validity date inscription
$libelle = "Valable jusqu'au :";
@ -471,7 +459,6 @@ trait GenerateBR
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 780, 142, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
imagedestroy($ImageFond);
// Save printed coupon
$printedCoupon = $this->savePrintedCoupon($campagne, $customer, $coupon);
@ -483,7 +470,6 @@ trait GenerateBR
$barcodeImage = imagecreatefromstring($base64);
imagecopy($mask, $barcodeImage, 660, 355, 0, 0, imagesx($barcodeImage), imagesy($barcodeImage));
imagedestroy($barcodeImage);
// Text below right barcode
$ImageFond = imagecreate(380, 15);
@ -491,7 +477,6 @@ trait GenerateBR
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 11, 0, 0, 14, $black, $arial, $codeBarre);
imagecopy($mask, $ImageFond, 800, 385, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
imagedestroy($ImageFond);
// --- Barcode treatment text
if ($customer->country !== 250) {
@ -510,13 +495,12 @@ trait GenerateBR
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 9, 0, 0, 10, $black, $arialbd, $textReduc);
imagecopy($mask, $ImageFond, $copyPosition[0], $copyPosition[1], 0, 0, imagesx($ImageFond), imagesy($ImageFond));
imagedestroy($ImageFond);
// --- Left barcode
if ($customer->country !== 250) {
$codeBarreImg = imagecreatefromjpeg($coupon->coupon_gs1code);
imageresolution($codeBarreImg, 72);
list($width, $height) = getimagesize($coupon->coupon_gs1code);
[$width, $height] = getimagesize($coupon->coupon_gs1code);
$ratio = $width / $height;
$maxWidth = 285;
$maxHeight = 150;
@ -532,22 +516,18 @@ trait GenerateBR
$resizedImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($resizedImage, $codeBarreImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
imagecopy($mask, $resizedImage, 60, 250, 0, 0, $newWidth, $newHeight);
imagedestroy($codeBarreImg);
imagedestroy($resizedImage);
} else {
$codeBarre = $coupon->coupon_code;
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$base64 = $generator->getBarcode($codeBarre, $generator::TYPE_CODE_128_A, 2, 46);
$barcodeImage = imagecreatefromstring($base64);
imagecopy($mask, $barcodeImage, 10, 342, 0, 0, imagesx($barcodeImage), imagesy($barcodeImage));
imagedestroy($barcodeImage);
$ImageFond = imagecreate(380, 15);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 11, 0, 0, 14, $black, $arial, $codeBarre);
imagecopy($mask, $ImageFond, 52, 390, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
imagedestroy($ImageFond);
}
// Final output as base64 encoded JPEG
@ -556,8 +536,6 @@ trait GenerateBR
$contents = ob_get_contents();
ob_end_clean();
imagedestroy($mask);
// Save stat.
$this->saveStat($campagne, $coupon);

View file

@ -3,33 +3,26 @@
"description": "Webcoupon management system",
"type": "project",
"require": {
"php": "^7.3",
"php": "^8.5",
"ext-curl": "*",
"ext-json": "*",
"barryvdh/laravel-dompdf": "^0.9.0",
"doctrine/dbal": "^2.8",
"fideloper/proxy": "^4.0",
"barryvdh/laravel-dompdf": "^3.1",
"kwaadpepper/enum": "^2.0",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^3.0",
"laravelcollective/html": "6.*",
"ldc/ldccrmv2client": "^3.0.5",
"picqer/php-barcode-generator": "^0.3.0",
"laravel/framework": "^13.0",
"laravel/tinker": "^3.0",
"laravel/ui": "^4.0",
"ldc/ldccrmv4client": "^4.1",
"picqer/php-barcode-generator": "^3.3",
"sentry/sentry-laravel": "^4.13",
"uxweb/sweet-alert": "^2.0",
"vladimir-yuldashev/laravel-queue-rabbitmq": "^11.3"
"uwil/laravel-k8s": "^4.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laracasts/generators": "^1.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.0",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.3"
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^12.0",
"slevomat/coding-standard": "^8.31",
"squizlabs/php_codesniffer": "^4.0"
},
"repositories": [
{
@ -77,8 +70,19 @@
],
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"policy": {
"advisories": {
"ignore": {
"laravel/framework": {
"constraint": "^10.0",
"on-audit": false,
"reason": "Palier temporaire de migration vers une version Laravel maintenue. Ne pas deployer."
}
}
}
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}

6436
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -152,7 +152,6 @@ return [
/*
* Package Service Providers...
*/
Collective\Html\HtmlServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
/*
@ -211,10 +210,8 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
'CampaignTypes' => \App\Enums\CampaignTypes::class,
'Countries' => \App\Enums\Countries::class,
'UserRoles' => \App\Enums\UserRoles::class,

View file

@ -1,7 +1,5 @@
<?php
use Illuminate\Database\DBAL\TimestampType;
return [
/*
@ -124,12 +122,5 @@ return [
'database' => env('REDIS_CACHE_DB', 1),
],
],
'dbal' => [
'types' => [
'timestamp' => TimestampType::class,
],
],
]
];

View file

@ -1,6 +1,6 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
@ -14,7 +14,7 @@ return array(
'show_warnings' => false,
// Throw an Exception on warnings from dompdf
'orientation' => 'portrait',
'defines' => array(
'defines' => [
/**
* The location of the DOMPDF font directory
*
@ -243,7 +243,7 @@ return array(
"DOMPDF_TEMP_DIR" => storage_path('logs/'),
// I need this
"DOMPDF_LOG_OUTPUT_FILE" => storage_path('logs/log.htm'),
),
],
);
];

View file

@ -57,5 +57,5 @@ return [
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate.
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
'before_send' => \App\Lib\Helpers\ExceptionsHelper::sentryEventHandler(...),
];

View file

@ -55,11 +55,6 @@ spec:
containers:
- name: ${CI_PROJECT_PATH_SLUG}-container
image: $IMAGE_TAG
command: ["/bin/sh", "-c"]
args:
- |
php artisan storage:link || true
exec apache2-foreground
envFrom:
- configMapRef:
name: ${CI_PROJECT_PATH_SLUG}-config-map
@ -90,9 +85,9 @@ spec:
imagePullSecrets:
- name: docker-registry-credentials
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
runAsUser: 82
runAsGroup: 82
fsGroup: 82
fsGroupChangePolicy: "OnRootMismatch"
volumes:
- name: storage
@ -108,7 +103,7 @@ spec:
app: ${CI_PROJECT_PATH_SLUG}-app
ports:
- port: 80
targetPort: 443
targetPort: 80
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
@ -173,8 +168,8 @@ spec:
persistentVolumeClaim:
claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
runAsUser: 82
runAsGroup: 82
fsGroup: 82
fsGroupChangePolicy: "OnRootMismatch"
restartPolicy: OnFailure

56
rector.php Normal file
View file

@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use RectorLaravel\Rector\Class_\CommandHiddenPropertyToHiddenAttributeRector;
use RectorLaravel\Rector\Class_\DescriptionPropertyToDescriptionAttributeRector;
use RectorLaravel\Rector\Class_\FillablePropertyToFillableAttributeRector;
use RectorLaravel\Rector\Class_\HiddenPropertyToHiddenAttributeRector;
use RectorLaravel\Rector\Class_\ModelCastsPropertyToCastsMethodRector;
use RectorLaravel\Rector\Class_\SignaturePropertyToSignatureAttributeRector;
use RectorLaravel\Rector\Class_\TablePropertyToTableAttributeRector;
use RectorLaravel\Rector\Class_\WithoutTimestampsPropertyToWithoutTimestampsAttributeRector;
use RectorLaravel\Rector\MethodCall\ValidationRuleArrayStringValueToArrayRector;
use RectorLaravel\Set\LaravelLevelSetList;
use RectorLaravel\Set\LaravelSetList;
return RectorConfig::configure()
->withAutoloadPaths([
__DIR__ . '/app',
__DIR__ . '/vendor/laravel/framework/src',
])
->withPaths([
__DIR__ . '/app',
__DIR__ . '/bootstrap',
__DIR__ . '/config',
__DIR__ . '/routes',
])
->withPhpSets(php85: true)
->withComposerBased(laravel: true)
->withSets([
LaravelLevelSetList::UP_TO_LARAVEL_130,
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_COLLECTION,
LaravelSetList::LARAVEL_IF_HELPERS,
LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES,
LaravelSetList::LARAVEL_TYPE_DECLARATIONS,
])
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0)
->withSkip([
// Disable Laravel notations.
CommandHiddenPropertyToHiddenAttributeRector::class,
DescriptionPropertyToDescriptionAttributeRector::class,
FillablePropertyToFillableAttributeRector::class,
HiddenPropertyToHiddenAttributeRector::class,
ModelCastsPropertyToCastsMethodRector::class,
SignaturePropertyToSignatureAttributeRector::class,
TablePropertyToTableAttributeRector::class,
WithoutTimestampsPropertyToWithoutTimestampsAttributeRector::class,
// Validation.
ValidationRuleArrayStringValueToArrayRector::class,
]);

View file

@ -101,8 +101,8 @@
<h4><i class="fas fa-plus-square addcalendar"></i> {{ __('Calendrier de diffusion') }}</h4>
@foreach ($coupon->calendriers()->get() as $calendrier)
<div class="form-field-calendar">
<input type="date" name="startdate[]" value="{{ $calendrier->calendrier_startdate->format('Y-m-d') }}">
<input type="date" name="enddate[]" value="{{ $calendrier->calendrier_enddate->format('Y-m-d') }}">
<input type="date" name="startdate[]" value="{{ Carbon\Carbon::parse($calendrier->calendrier_startdate)->format('Y-m-d') }}">
<input type="date" name="enddate[]" value="{{ Carbon\Carbon::parse($calendrier->calendrier_enddate)->format('Y-m-d') }}">
<i class="fas fa-minus-square removecalendar"></i>
</div>
@endforeach
@ -117,7 +117,7 @@
</thead>
@foreach ($coupon->mouvements()->get() as $mouvement)
<tr>
<th>{{ $mouvement->mouvement_created_at->format('d/m/Y') }}</th>
<th>{{ Carbon\Carbon::parse($mouvement->mouvement_created_at)->format('d/m/Y') }}</th>
<th>{{ $mouvement->mouvement_nombre }}</th>
<th></th>
</tr>

View file

@ -1,57 +0,0 @@
@extends('layouts.main')
@section('content')
<h2><i class="fas fa-building"></i> Nouveau site</h2>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-wrapper">
{!! Form::open(['route' => 'site.store', 'enctype' => 'multipart/form-data']) !!}
<div class="form-split">
<div class="form-field">
{!! Form::label('site_id', 'Ref *') !!}
{!! Form::input('text', 'site_id', null, ['required']) !!}
</div>
<div class="form-field">
{!! Form::label('site_nom', 'Nom *') !!}
{!! Form::input('text', 'site_nom', null, ['required']) !!}
</div>
</div>
<div class="form-split">
<div class="form-field">
<div class="title">
{!! Form::label('site_logo', 'Logo *') !!}
<span>150x60px</span>
<span>Format: PNG</span>
</div>
{!! Form::file('site_logo', ['class' => 'input-file', 'required']) !!}
</div>
<div class="form-field">
{!! Form::label('site_contact', 'Contact *') !!}
{!! Form::email('site_contact', null, ['required']) !!}
</div>
</div>
<h4>Informations pour génération des BR :</h4>
<div class="form-split">
<div class="form-field">
{!! Form::label('site_libelle', 'Libellé du site *') !!}
{!! Form::input('text', 'site_libelle', null, ['required']) !!}
</div>
<div class="form-field">
{!! Form::label('site_rcs', 'RCS du site *') !!}
{!! Form::input('text', 'site_rcs', null, ['required']) !!}
</div>
</div>
<div class="form-field submit">
<span>Les champs avec un * sont obligatoires</span>
{!! Form::submit('Enregistrer') !!}
</div>
{!! Form::close() !!}
</div>
@endsection

View file

@ -1,71 +0,0 @@
@extends('layouts.main')
@section('content')
<h2><i class="fas fa-building"></i> Editer le site</h2>
<div class="form-wrapper">
<figure><img src="{{ asset($site->site_logo) }}" alt="{{ $site->site_nom }}"></figure>
{!! Form::model($site, ['route' => ['site.update', $site], 'enctype' => 'multipart/form-data']) !!}
@method('PUT')
<div class="form-split">
<div class="form-field">
{!! Form::label('site_id', 'Ref') !!}
{!! Form::input('text', 'site_id', null, ['required', 'readonly']) !!}
</div>
<div class="form-field">
{!! Form::label('site_nom', 'Nom') !!}
{!! Form::input('text', 'site_nom', null, ['required']) !!}
</div>
</div>
<div class="form-split">
<div class="form-field">
<div class="title">
{!! Form::label('site_logo', 'Logo') !!}
<span>150x60px</span>
</div>
{!! Form::file('site_logo', null, ['required']) !!}
{!! Form::input('hidden', 'site_logo_hidden', $site->site_logo) !!}
</div>
<div class="form-field">
{!! Form::label('site_contact', 'Contact') !!}
{!! Form::email('site_contact', null, ['required']) !!}
</div>
</div>
<h4>Informations pour génération des BR :</h4>
<div class="form-split">
<div class="form-field">
{!! Form::label('site_libelle', 'Libellé du site') !!}
{!! Form::input('text', 'site_libelle', null) !!}
</div>
<div class="form-field">
{!! Form::label('site_rcs', 'RCS du site') !!}
{!! Form::input('text', 'site_rcs', null) !!}
</div>
</div>
<div class="form-field submit">
{!! Form::submit('Mettre à jour') !!}
</div>
{!! Form::close() !!}
</div>
<div class="campagne-list">
<h2><i class="fa fa-folder"><i class="fas fa-ticket-alt"></i></i> Campagnes liées</h2>
<table>
<thead>
<tr>
<th>{{__('Ref') }}</th>
<th>{{__('Création') }}</th>
<th>{{__('Nom') }}</th>
</tr>
</thead>
<tbody>
@foreach($site->campagnes as $c)
<tr>
<td>{{ $c->camp_id }}</td>
<td>{{ $c->camp_name }}</td>
<td>{{ $c->camp_createdate }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

View file

@ -1,25 +0,0 @@
@extends('layouts.main')
@section('content')
<h2><i class="fas fa-building"></i> Sites <a href="{{ route('site.create') }}" class="add-button"><i class="fas fa-plus-square"></i> Ajouter</a></h2>
<div class="content-list">
<table>
<thead>
<tr>
<th>{{__('Ref') }}</th>
<th>{{__('Nom') }}</th>
<th>{{__('Contact') }}</th>
</tr>
</thead>
<tbody>
@foreach($sites as $s)
<tr>
<td><a href="{{ route('site.edit', $s) }}">{{ $s->site_id }}</a></td>
<td>{{ $s->site_nom }}</td>
<td>{{ $s->site_contact }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

View file

@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Route;
Route::prefix('v1')
->name('api.v1.')
->group(function () {
->group(function (): void {
Route::get('/customer/mur', 'Api\v1\CustomerController@mur');
Route::get('/customer/basket', 'Api\v1\CustomerController@basket');
Route::get('/customer/basket/update', 'Api\v1\BasketController@updateBasket')->name('basket.update');

View file

@ -9,10 +9,8 @@ Auth::routes(['verify' => false, 'register' => false, 'reset' => false]);
Route::any('/', "RedirectController");
Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function () {
Route::get('/', function () {
return redirect(route('campagne.index'));
});
Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function (): void {
Route::get('/', fn() => redirect(route('campagne.index')));
Route::resource('site', 'SiteController')->except(['destroy', 'show']);
Route::resource('campagne', 'CampagneController')->except(['show']);
@ -57,17 +55,17 @@ Route::post('/publish-coupons-ajax', 'AjaxController@publishCouponsAjax');
/**
* Clean
*/
Route::name('fo.')->group(function() {
Route::name('basket.')->prefix('basket')->group(function () {
Route::name('fo.')->group(function(): void {
Route::name('basket.')->prefix('basket')->group(function (): void {
Route::get('/{basket:uuid}', [BasketController::class, 'show'])->name('show');
Route::get('/{basket:uuid}/print', [BasketController::class, 'print'])->name('print');
});
});
Route::prefix('bo')->name('bo.')->middleware(['auth', 'saveroute'])->group(function() {
Route::name('maintenance.')->prefix('maintenance')->group(function () {
Route::prefix('bo')->name('bo.')->middleware(['auth', 'saveroute'])->group(function(): void {
Route::name('maintenance.')->prefix('maintenance')->group(function (): void {
Route::get('/', [MaintenanceController::class, 'index'])->name('index');
});
Route::resource('users', '\App\Http\Controllers\Bo\UserController');
Route::resource('users', \App\Http\Controllers\Bo\UserController::class);
});