fix: PHPCBF

This commit is contained in:
Vincent BRIDIER 2025-04-03 09:30:16 +02:00
parent 00e6d07482
commit 203922849c
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
89 changed files with 1538 additions and 1588 deletions

View file

@ -6,14 +6,13 @@ use Illuminate\Database\Eloquent\Model;
class Calendrier extends Model
{
/**
* @var string
*/
protected $table = 'calendrier';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;

View file

@ -4,21 +4,14 @@ namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Coupon;
use App\Site;
use App\Panier;
use App\PanierContent;
use App\Mur;
use App\Campagne;
use App\Statistique;
use App\User;
use App\Notification;
use App\Mail\AlertBr;
use App\Mail\AlertBrAdmin;
use Illuminate\Support\Facades\Mail;
use App\Traits\CouponTrait;
use Carbon\Carbon;
use DB;
class Kernel extends ConsoleKernel
{
@ -30,31 +23,31 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
];
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//---- Commande d'alerte appelé tt les jours de la semaine a 7h00
// ---- Commande d'alerte appelé tt les jours de la semaine a 7h00
$schedule->call(function () {
$sites = Site::all();
$couponSeuilGlobal = array();
$sites = Site::all();
$couponSeuilGlobal = array();
$couponDiffusionGlobal = array();
$sendGlobal = false;
foreach ($sites as $site) { // ---- Pour chaque site
$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();
$sendMail = false;
$users = array();
$couponSeuil = array();
$couponDiffusion = array();
$coupons = $campagne->coupons()->get();
$coupons = $campagne->coupons()->get();
foreach ($coupons as $coupon) {
$couponAlert = false;
if ($coupon->coupon_published) {
@ -62,15 +55,16 @@ class Kernel extends ConsoleKernel
if ($coupon->coupon_left < $coupon->coupon_seuil_alert) {
array_push($couponSeuil, $coupon);
array_push($couponSeuilGlobal, [$site->site_nom , $coupon]);
$sendGlobal = true;
$sendGlobal = true;
$couponAlert = true;
}
// --- Check MaxDateDiffusion
if ($coupon->coupon_maxdatediffusion != null && strtotime($coupon->coupon_maxdatediffusion) < (time() + (30 * 24 * 60 * 60))) { //Fin de diffusion dans moins de 30jours
if ($coupon->coupon_maxdatediffusion != null && strtotime($coupon->coupon_maxdatediffusion) < (time() + (30 * 24 * 60 * 60))) {
// Fin de diffusion dans moins de 30jours
array_push($couponDiffusion, $coupon);
array_push($couponDiffusionGlobal, [$site->site_nom , $coupon]);
$sendGlobal = true;
$sendGlobal = true;
$couponAlert = true;
}
@ -78,29 +72,29 @@ class Kernel extends ConsoleKernel
$notifications = Notification::where(['notif_campId' => $campagne->camp_id])->get();
foreach ($notifications as $notification) {
if (!array_key_exists($notification->notif_id, $users)) {
$userObject = [];
$userObject['email'] = $notification->notif_email;
$userObject['name'] = $notification->notif_name;
$userObject = [];
$userObject['email'] = $notification->notif_email;
$userObject['name'] = $notification->notif_name;
$users[$notification->notif_id] = (object)$userObject;
}
}
$sendMail = true;
}
}
}
}//end if
}//end foreach
if ($sendMail) {
Mail::to($users)->send(new AlertBr($couponSeuil, $couponDiffusion, $site->site_nom));
}
}
}
}//end foreach
}//end foreach
if ($sendGlobal) {
$superadmins = array();
$admins = User::where(['roles' => 'superadmin'])->get();
$admins = User::where(['roles' => 'superadmin'])->get();
foreach ($admins as $admin) {
$adminObject = [];
$adminObject = [];
$adminObject['email'] = $admin->email;
$adminObject['name'] = $admin->name;
$adminObject['name'] = $admin->name;
array_push($superadmins, (object)$adminObject);
}
Mail::to($superadmins)->send(new AlertBrAdmin($couponSeuilGlobal, $couponDiffusionGlobal));
@ -109,50 +103,44 @@ class Kernel extends ConsoleKernel
// ---- Sauvegarde des stats tous les jours a 23:45
// $schedule->call(function () {
// $campagnes = Campagne::all();
// foreach ($campagnes as $campagne) {
// $last_stat = Statistique::where(['stat_campId' => $campagne->camp_id])->orderBy('created_at', 'DESC')->first();
// if(isset($last_stat->created_at)){
// $dateStart = $last_stat->created_at;
// } else {
// $dateStart = Carbon::now()->setTime(0,0,0)->subMonth()->format('Y-m-d H:i:s');
// }
// $coupons = $campagne->coupons()->get();
// foreach ($coupons as $coupon) {
// if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { //Calcul des BR consommé pour les murs
// $counts = Mur::selectRaw('count(*) as count, DATE_FORMAT(mur_createdate, "%Y-%m-%d") as date')
// ->where(['mur_couponId' => $coupon->coupon_id, 'mur_campid' => $campagne->camp_id])
// ->whereBetween('mur_createdate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')])
// ->groupBy(DB::raw("DATE_FORMAT(mur_createdate, '%Y-%m-%d')"))
// ->pluck('count', 'date');
// foreach($counts as $date => $count){
// $stat = new Statistique();
// $stat->stat_campId = $campagne->camp_id;
// $stat->stat_couponId = $coupon->coupon_id;
// $stat->stat_couponPrinted = $count;
// $stat->created_at = $date;
// $stat->save();
// }
// }
// // else { //Calcul des BR consommé pour les paniers
// // $count = 0;
// // $paniers = Panier::where('panier_campId', $campagne->camp_id)->where(function($query) use ($dateStart){
// // $query->whereBetween('panier_createdate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')])
// // ->orWhereBetween('panier_updatedate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')]);
// // })->get();
// // foreach ($paniers as $panier) {
// // $panierContentCount = $panier->panierContents()->where(['panier_content_couponId' => $coupon->coupon_id])->sum('panier_content_printed');
// // $count = $count + $panierContentCount;
// // }
// // }
// }
// }
// $campagnes = Campagne::all();
// foreach ($campagnes as $campagne) {
// $last_stat = Statistique::where(['stat_campId' => $campagne->camp_id])->orderBy('created_at', 'DESC')->first();
// if(isset($last_stat->created_at)){
// $dateStart = $last_stat->created_at;
// } else {
// $dateStart = Carbon::now()->setTime(0,0,0)->subMonth()->format('Y-m-d H:i:s');
// }
// $coupons = $campagne->coupons()->get();
// foreach ($coupons as $coupon) {
// if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { //Calcul des BR consommé pour les murs
// $counts = Mur::selectRaw('count(*) as count, DATE_FORMAT(mur_createdate, "%Y-%m-%d") as date')
// ->where(['mur_couponId' => $coupon->coupon_id, 'mur_campid' => $campagne->camp_id])
// ->whereBetween('mur_createdate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')])
// ->groupBy(DB::raw("DATE_FORMAT(mur_createdate, '%Y-%m-%d')"))
// ->pluck('count', 'date');
// foreach($counts as $date => $count){
// $stat = new Statistique();
// $stat->stat_campId = $campagne->camp_id;
// $stat->stat_couponId = $coupon->coupon_id;
// $stat->stat_couponPrinted = $count;
// $stat->created_at = $date;
// $stat->save();
// }
// }
// else { //Calcul des BR consommé pour les paniers
// $count = 0;
// $paniers = Panier::where('panier_campId', $campagne->camp_id)->where(function($query) use ($dateStart){
// $query->whereBetween('panier_createdate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')])
// ->orWhereBetween('panier_updatedate', [$dateStart, Carbon::now()->setTime(23,59,59)->format('Y-m-d H:i:s')]);
// })->get();
// foreach ($paniers as $panier) {
// $panierContentCount = $panier->panierContents()->where(['panier_content_couponId' => $coupon->coupon_id])->sum('panier_content_printed');
// $count = $count + $panierContentCount;
// }
// }
// }
// }
// })->everyFifteenMinutes();
}

View file

@ -51,8 +51,8 @@ class Handler extends ExceptionHandler
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*/
public function render($request, Throwable $exception)
@ -62,5 +62,4 @@ class Handler extends ExceptionHandler
}
return parent::render($request, $exception);
}
}

View file

@ -24,9 +24,9 @@ class AjaxController extends Controller
// ---- Ajoute des coupons à une campagne
public function add_coupons_ajax(Request $request)
{
$camp_id = $request->input('campid');
$camp_id = $request->input('campid');
$campagne = Campagne::where('camp_id', $camp_id)->first();
$ids = $request->input('ids');
$ids = $request->input('ids');
$coupons = Coupon::find($ids);
$campagne->coupons()->attach($coupons);
@ -37,10 +37,10 @@ class AjaxController extends Controller
// ---- Efface des coupons d'une campagne
public function remove_coupons_ajax(Request $request)
{
$camp_id = $request->input('campid');
$campagne = Campagne::where('camp_id', $camp_id)->first();
$camp_id = $request->input('campid');
$campagne = Campagne::where('camp_id', $camp_id)->first();
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$coupon = Coupon::find($coupon_id);
$campagne->coupons()->detach($coupon_id);
@ -50,8 +50,8 @@ class AjaxController extends Controller
// ---- Dépublie un coupon
public function unpublish_coupons_ajax(Request $request)
{
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$coupon->coupon_published = 0;
$coupon->save();
@ -61,8 +61,8 @@ class AjaxController extends Controller
// ---- Publie un coupon
public function publish_coupons_ajax(Request $request)
{
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$coupon->coupon_published = 1;
$coupon->save();
@ -72,8 +72,8 @@ class AjaxController extends Controller
// ---- Dépublie une campagne
public function unpublish_camp_ajax(Request $request)
{
$campid = $request->input('campid');
$campagne = Campagne::find($campid);
$campid = $request->input('campid');
$campagne = Campagne::find($campid);
$campagne->camp_published = 0;
$campagne->save();
@ -83,8 +83,8 @@ class AjaxController extends Controller
// ---- Publie une campagne
public function publish_camp_ajax(Request $request)
{
$campid = $request->input('campid');
$campagne = Campagne::find($campid);
$campid = $request->input('campid');
$campagne = Campagne::find($campid);
$campagne->camp_published = 1;
$campagne->save();
@ -120,19 +120,20 @@ class AjaxController extends Controller
}
// ---- INIT du log
$log = new Log();
$log->log_action = config('constants.impression');
$log->log_source = $source;
$log = new Log();
$log->log_action = config('constants.impression');
$log->log_source = $source;
$log->log_contactId = $contact->contact_id;
$log->log_refsite = $campagne->camp_siteId;
$log->log_params = json_encode(['refcamp' => $campagne->camp_id]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_params = json_encode(['refcamp' => $campagne->camp_id]);
$couponsPrinted = array();
$coupons = '<TABLE width="100%" align="center" cellpadding="0" cellspacing="0" border="0">';
$coupons = '<TABLE width="100%" align="center" cellpadding="0" cellspacing="0" border="0">';
$coupons .= '<TR><TD width="100%" align="center"><div>';
if ($campagne->camp_type == 0) { //---- POUR LES MURS
if ($campagne->camp_type == 0) {
// ---- POUR LES MURS
if (!isset($couponsToPrint)) {
die();
}
@ -145,28 +146,29 @@ class AjaxController extends Controller
array_push($couponsPrinted, ['cp_code' => $cp->coupon_code, 'qty' => 1]);
$imgCoupon = $this->printCp($cp, $contact);
$coupons .= '<img src="' . $imgCoupon . '" border="0" style="display:block;width:165mm;"/>';
$coupons .= '<img src="' . $imgCoupon . '" border="0" style="display:block;width:165mm;"/>';
$nbCoupon++;
if ($nbCoupon % 3 == 0) {
$coupons .= '</div><div>';
}
//----- mémorise l'impression
$mur = new Mur();
$mur->mur_campid = $campagne->camp_id;
// ----- mémorise l'impression
$mur = new Mur();
$mur->mur_campid = $campagne->camp_id;
$mur->mur_contactId = $contact->contact_id;
$mur->mur_couponId = $cp->coupon_id;
$mur->mur_couponId = $cp->coupon_id;
$mur->save();
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = 1;
$stat->save();
}
}
} elseif ($campagne->camp_type == 1) { //---- POUR LES PANIERS
}//end if
}//end foreach
} elseif ($campagne->camp_type == 1) {
// ---- POUR LES PANIERS
if (!isset($panier)) {
die();
}
@ -179,7 +181,7 @@ class AjaxController extends Controller
foreach ($allPanierContent as $panierContent) {
$cp = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
if ($cp && $this->isAvailableToPrint($cp, $campagne)) {
if ($cp && $this->isAvailableToPrint($cp, $campagne)) {
$imgCoupon = $this->printCp($cp, $contact);
// ---- Création du html du contenu à imprimer
if ($campagne->camp_limitedPrinting == 0) {
@ -191,13 +193,13 @@ class AjaxController extends Controller
}
}
$newQtyAvailable = 0;
$newQtyPrinted = $panierContent->panier_content_quantity + $panierContent->panier_content_printed;
$newQtyPrinted = $panierContent->panier_content_quantity + $panierContent->panier_content_printed;
array_push($couponsPrinted, ['cp_code' => $cp->coupon_code, 'qty' => $panierContent->panier_content_quantity]);
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = $panierContent->panier_content_quantity;
$stat->save();
} else {
@ -208,23 +210,23 @@ class AjaxController extends Controller
$coupons .= '</div><div>';
}
$newQtyAvailable = $panierContent->panier_content_quantity - 1;
$newQtyPrinted = $panierContent->panier_content_printed + 1;
$newQtyPrinted = $panierContent->panier_content_printed + 1;
array_push($couponsPrinted, ['cp_code' => $cp->coupon_code, 'qty' => 1]);
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = 1;
$stat->save();
}
}
}//end if
// ---- Mémorise l'impression
$panierContent->panier_content_quantity = $newQtyAvailable;
$panierContent->panier_content_printed = $newQtyPrinted;
$panierContent->panier_content_printed = $newQtyPrinted;
$panierContent->save();
}
}
}//end if
}//end foreach
// ---- Update du status du panier
$qty = $panier->panierContents()->sum('panier_content_quantity');
if ($qty == 0) {
@ -233,37 +235,39 @@ class AjaxController extends Controller
$panier->panier_pending = 1;
}
$panier->save();
} elseif ($campagne->camp_type == 2) { //---- POUR LES MURS SANS SELECTION
} elseif ($campagne->camp_type == 2) {
// ---- POUR LES MURS SANS SELECTION
$nbCoupon = 0;
$cps = $campagne->coupons()->get();
$cps = $campagne->coupons()->get();
foreach ($cps as $cp) {
// ---- Contrôle si le BR a déjà fait l'objet d'une impression
if ($this->isAvailable($cp, $campagne, $contact) && $this->isAvailableToPrint($cp, $campagne)) {
// ---- Génère l'image du BR à imprimer
$imgCoupon = $this->printCp($cp, $contact);
$coupons .= '<img src="' . $imgCoupon . '" border="0" style="display:block;width:165mm;"/>';
$coupons .= '<img src="' . $imgCoupon . '" border="0" style="display:block;width:165mm;"/>';
$nbCoupon++;
if ($nbCoupon % 3 == 0) {
$coupons .= '</div><div>';
}
array_push($couponsPrinted, ['cp_code' => $cp->coupon_code, 'qty' => 1]);
//----- mémorise l'impression
$mur = new Mur();
$mur->mur_campid = $campagne->camp_id;
// ----- mémorise l'impression
$mur = new Mur();
$mur->mur_campid = $campagne->camp_id;
$mur->mur_contactId = $contact->contact_id;
$mur->mur_couponId = $cp->coupon_id;
$mur->mur_couponId = $cp->coupon_id;
$mur->save();
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = 1;
$stat->save();
}
}
} elseif ($campagne->camp_type == 3) { //---- POUR LES PANIERS AVEC SELECTION
}//end if
}//end foreach
} elseif ($campagne->camp_type == 3) {
// ---- POUR LES PANIERS AVEC SELECTION
if (!isset($couponsToPrint)) {
die();
}
@ -275,7 +279,7 @@ class AjaxController extends Controller
$cp = Coupon::where(['coupon_code' => $coupon_code])->first();
if ($this->isAvailable($cp, $campagne, $contact) && $this->isAvailableToPrint($cp, $campagne)) {
$imgCoupon = $this->printCp($cp, $contact);
$imgCoupon = $this->printCp($cp, $contact);
$panierContent = PanierContent::where(['panier_content_couponId' => $cp->coupon_id, 'panier_content_panierId' => $panier->panier_id])->first();
if ($panierContent->panier_content_quantity > 0) {
$coupons .= '<img src="' . $imgCoupon . '" border="0" style="display:block;width:165mm;"/>';
@ -284,22 +288,22 @@ class AjaxController extends Controller
$coupons .= '</div><div>';
}
$newQtyAvailable = $panierContent->panier_content_quantity - 1;
$newQtyPrinted = $panierContent->panier_content_printed + 1;
$newQtyPrinted = $panierContent->panier_content_printed + 1;
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = 1;
$stat->save();
}
array_push($couponsPrinted, ['cp_code' => $cp->coupon_code, 'qty' => 1]);
// ---- Mémorise l'impression
$panierContent->panier_content_quantity = $newQtyAvailable;
$panierContent->panier_content_printed = $newQtyPrinted;
$panierContent->panier_content_printed = $newQtyPrinted;
$panierContent->save();
}
}
}//end if
}//end foreach
// ---- Update du status du panier
$qty = $panier->panierContents()->sum('panier_content_quantity');
if ($qty == 0) {
@ -308,12 +312,12 @@ class AjaxController extends Controller
$panier->panier_pending = 1;
}
$panier->save();
}
}//end if
$coupons .= '</div></TD></TR>';
$coupons .= '</TABLE>';
$log->log_statut = 'OK';
$log->log_statut = 'OK';
$log->log_message = json_encode(['Message' => 'Impressions réussies', 'Coupons' => $couponsPrinted], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$log->save();
@ -366,8 +370,8 @@ class AjaxController extends Controller
}
$campagne = Campagne::where(['camp_id' => $camp_id])->first();
$contact = Contact::where(['contact_hash' => $contact_hash])->first();
$coupons = $campagne->coupons;
$contact = Contact::where(['contact_hash' => $contact_hash])->first();
$coupons = $campagne->coupons;
foreach ($coupons as $key => $coupon) {
if (!$this->isAvailableToPrint($coupon, $campagne)) {
@ -376,7 +380,7 @@ class AjaxController extends Controller
}
$allLogs = Log::where(['log_refsite' => $campagne->camp_siteId, 'log_contactId' => $contact->contact_id, 'log_statut' => 'OK'])->orderBy('created_at', 'DESC')->get();
$logs = array();
$logs = array();
foreach ($allLogs as &$l) {
$params = json_decode($l->log_params);
if ($l->log_action == 3 || $l->log_action == 1) {
@ -387,7 +391,8 @@ class AjaxController extends Controller
}
}
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { // ---- Pour les types murs
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) {
// ---- Pour les types murs
foreach ($coupons as &$coupon) {
$coupon->isAvailable = $this->isAvailable($coupon, $campagne, $contact);
}
@ -396,7 +401,7 @@ class AjaxController extends Controller
// Montant total et Nombre réductions disponible
$montantDispo = 0;
$montantTotal = 0;
$nbCoupon = 0;
$nbCoupon = 0;
foreach ($coupons as $coupon) {
$montantTotal += $coupon->coupon_value;
if ($coupon->isAvailable == true) {
@ -424,7 +429,8 @@ class AjaxController extends Controller
->renderSections()['widget'];
return json_encode(array('success' => true, 'html' => $returnHTML));
} else { // ---- Pour les types paniers
} else {
// ---- Pour les types paniers
$panier = Panier::where(['panier_campId' => $campagne->camp_id, 'panier_contactId' => $contact->contact_id, 'panier_pending' => 1])->first();
if ($panier) {
$panier_ref = $panier->panier_ref;
@ -456,7 +462,7 @@ class AjaxController extends Controller
])
->renderSections()['widget'];
return json_encode(array('success' => true, 'html' => $returnHTML));
}
}//end if
}
// ---- Montre les campagnes avec un compte de démo
@ -468,8 +474,8 @@ class AjaxController extends Controller
die;
}
$campagne = Campagne::where(['camp_id' => $camp_id])->first();
$siteId = $campagne->camp_siteId;
$campagne = Campagne::where(['camp_id' => $camp_id])->first();
$siteId = $campagne->camp_siteId;
$demoContact = Contact::where(['contact_siteId' => $siteId, 'contact_ref' => 'DEMO'])->first();
if (!isset($demoContact)) {
@ -486,8 +492,8 @@ class AjaxController extends Controller
'pays' => 250
]);
$contact = new Controllers\ContactController();
$res = $contact->updateContact($req);
$contact = new Controllers\ContactController();
$res = $contact->updateContact($req);
$demoContact = Contact::where(['contact_siteId' => $siteId, 'contact_ref' => 'DEMO'])->first();
}
@ -521,8 +527,8 @@ class AjaxController extends Controller
}
}
$couponsTotal = sizeof($coupons);
$couponsAdded = 0;
$couponsTotal = sizeof($coupons);
$couponsAdded = 0;
$basketContent = "";
foreach ($coupons as $coupon) {
@ -549,23 +555,22 @@ class AjaxController extends Controller
'admin' => 1
]);
$panier = new Controllers\PanierController();
$res = $panier->updateBasket($req);
$url = "/?basketid=" . $res->original['Panier']->Panier;
}
$res = $panier->updateBasket($req);
$url = "/?basketid=" . $res->original['Panier']->Panier;
}//end if
return json_encode($url);
}
}//end if
}
// ---- MAINTENANCE : CLEAN DE LA BDD
// ---- Fonction de récap des contacts que l'on va effacer
public function get_clean_contacts_detail(Request $request)
{
$contacts = Contact::where('contact_updatedate', '<', Carbon::now()->subMonth())->get();
$date = Carbon::now();
$contacts = Contact::where('contact_updatedate', '<', Carbon::now()->subMonth())->get();
$date = Carbon::now();
$contact_count = 0;
foreach ($contacts as $contact) {
$paniers = $contact->paniers()->get();
$paniers = $contact->paniers()->get();
$canbeDeleted = true;
foreach ($paniers as $panier) {
if ($panier->panier_pending == 1) {
@ -574,7 +579,7 @@ class AjaxController extends Controller
}
if ($canbeDeleted) {
$contact_count++;
//$testcontact .= $contact->contact_id.", ";
// $testcontact .= $contact->contact_id.", ";
}
}
return json_encode(['date' => $date, 'contact_count' => $contact_count]);
@ -583,10 +588,10 @@ class AjaxController extends Controller
// ---- Fonction de nettoyage de la base contact
public function clean_contacts(Request $request)
{
$contacts = Contact::where('contact_updatedate', '<', Carbon::now()->subMonth())->get();
$contacts = Contact::where('contact_updatedate', '<', Carbon::now()->subMonth())->get();
$testcontact = "";
foreach ($contacts as $contact) {
$paniers = $contact->paniers()->get();
$paniers = $contact->paniers()->get();
$canbeDeleted = true;
foreach ($paniers as $panier) {
if ($panier->panier_pending == 1) {
@ -608,7 +613,7 @@ class AjaxController extends Controller
// ---- Fonction de nettoyage de la base mur
public function clean_walls(Request $request)
{
$murs = Mur::where('mur_createdate', '<', Carbon::now()->subYear())->where(['mur_deleted' => 1])->get();
$murs = Mur::where('mur_createdate', '<', Carbon::now()->subYear())->where(['mur_deleted' => 1])->get();
$testmur = "";
foreach ($murs as $mur) {
$mur->delete();
@ -620,10 +625,10 @@ class AjaxController extends Controller
// ---- Fonction de nettoyage de la base panier et panierContent
public function clean_baskets(Request $request)
{
$paniers = Panier::where('panier_createdate', '<', Carbon::now()->subMonth(2))->where(['panier_pending' => 0])->get();
$paniers = Panier::where('panier_createdate', '<', Carbon::now()->subMonth(2))->where(['panier_pending' => 0])->get();
$testpanier = "";
foreach ($paniers as $panier) {
$testpanier .= $panier->panier_id . ": ";
$testpanier .= $panier->panier_id . ": ";
$panierContents = $panier->panierContents()->get();
foreach ($panierContents as $panierContent) {
$testpanier .= $panierContent->panier_content_id . ', ';

View file

@ -13,7 +13,6 @@ use App\Statistique;
use App\Traits\CouponTrait;
use App\Traits\GenerateBR;
use PDF;
use LDC\LDCCRM\CrmApiV2;
class CouponsController extends Controller
@ -23,17 +22,17 @@ class CouponsController extends Controller
public function print(PrintRequest $request)
{
$datas = $request->validated();
$campagne = Campagne::find($datas['refcamp']);
$customer = Customers::find($datas['hashcode']);
$datas = $request->validated();
$campagne = Campagne::find($datas['refcamp']);
$customer = Customers::find($datas['hashcode']);
$couponsToPrint = explode(",", $datas['coupons']);
if ($campagne->site->crm_token === null) {
return new StatusResource(['status' => 'KO', 'code' => 500, 'message' => 'CRM Token is missing for site_id : '. $campagne->site->site_id]);
return new StatusResource(['status' => 'KO', 'code' => 500, 'message' => 'CRM Token is missing for site_id : ' . $campagne->site->site_id]);
}
if ($campagne->site->crm_password === null) {
return new StatusResource(['status' => 'KO', 'code' => 500, 'message' => 'CRM Password is missing for site_id : '. $campagne->site->site_id]);
return new StatusResource(['status' => 'KO', 'code' => 500, 'message' => 'CRM Password is missing for site_id : ' . $campagne->site->site_id]);
}
if (empty($couponsToPrint)) {
@ -47,8 +46,7 @@ class CouponsController extends Controller
* @var \LDC\LDCCRM\Models\Customer
*/
$crmInfos = $crm->getCustomer($customer->hashcode);
}catch (\Exception $e) {
} catch (\Exception $e) {
// TODO : Update error message
return new StatusResource(['status' => 'KO', 'code' => 422, 'message' => 'Customer not found.']);
}
@ -59,31 +57,31 @@ class CouponsController extends Controller
// TODO : Vérifier si les coupons sont dans la campagne
// TODO : Logs
$coupons = [];
if ($campagne->camp_type == 0) { //---- POUR LES MURS
if ($campagne->camp_type == 0) {
// ---- POUR LES MURS
foreach ($couponsToPrint as $key => $coupon_code) {
$cp = Coupon::where(['coupon_code' => $coupon_code])->first();
if (!$this->isUsed($cp, $campagne, $customer)) {
$coupons[] = $this->printCoupon($cp, $customer, $crmInfos);
//----- mémorise l'impression
$mur = new PrintedWalls();
$mur->camp_id = $campagne->camp_id;
// ----- mémorise l'impression
$mur = new PrintedWalls();
$mur->camp_id = $campagne->camp_id;
$mur->customer_id = $customer->id;
$mur->coupon_id = $cp->coupon_id;
$mur->coupon_id = $cp->coupon_id;
$mur->save();
//Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
// Sauvegarde de stat
$stat = new Statistique();
$stat->stat_campId = $campagne->camp_id;
$stat->stat_couponId = $cp->coupon_id;
$stat->stat_couponPrinted = 1;
$stat->save();
}
}
}
}//end foreach
}//end if
$pdf = PDF::loadView('pdf.coupons', ['coupons' => $coupons]);
return new StatusResource(['status' => 'OK', 'pdf' => base64_encode($pdf->stream(sprintf("coupons_%s_%s_%s.pdf", $crmInfos->firstname, $crmInfos->lastname, date('d-m-Y'))))]);

View file

@ -66,7 +66,7 @@ class CustomerController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return StatusResource
*/
public function show($id)
@ -77,7 +77,7 @@ class CustomerController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return StatusResource
*/
public function edit($id)
@ -99,7 +99,7 @@ class CustomerController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return StatusResource
*/
public function destroy($id)
@ -146,7 +146,7 @@ class CustomerController extends Controller
if (!$coupon->isUsed) {
$montantDispo += $coupon->coupon_value;
}
}
}//end foreach
return new StatusResource([
'status' => "OK",

View file

@ -52,7 +52,7 @@ class MurController extends Controller
if (!$coupon->isUsed) {
$montantDispo += $coupon->coupon_value;
}
}
}//end foreach
return new StatusResource([
'status' => "OK",

View file

@ -8,14 +8,14 @@ use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;

View file

@ -4,19 +4,18 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;

View file

@ -11,14 +11,14 @@ use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
@ -42,7 +42,7 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
@ -57,7 +57,7 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @param array $data
* @return \App\User
*/
protected function create(array $data)

View file

@ -8,14 +8,14 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;

View file

@ -8,14 +8,14 @@ use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;

View file

@ -7,18 +7,16 @@ use App\Site;
use App\Coupon;
use App\Contact;
use App\Mur;
use App\Panier;
use App\PanierContent;
use App\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use App\Traits\CouponTrait;
use Response;
class CampagneController extends Controller
{
//use BarcodeGenerator;
// use BarcodeGenerator;
use CouponTrait;
/**
@ -45,15 +43,15 @@ class CampagneController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$campagne = new Campagne();
$campagne->camp_name = $request->input('camp_name');
$campagne->camp_type = $request->input('camp_type');
$campagne = new Campagne();
$campagne->camp_name = $request->input('camp_name');
$campagne->camp_type = $request->input('camp_type');
$campagne->camp_published = $request->input('camp_published');
if (null !== $request->input('camp_limitedPrinting')) {
$campagne->camp_limitedPrinting = $request->input('camp_limitedPrinting');
@ -63,7 +61,7 @@ class CampagneController extends Controller
$site = session()->get('site');
if ($site->campagnes()->save($campagne)) {
//File::makeDirectory(public_path('/landings/' . $campagne->camp_id));
// File::makeDirectory(public_path('/landings/' . $campagne->camp_id));
if ($campagne->camp_type == 0) {
File::copyDirectory(resource_path('/views/template/mur'), public_path('/landings/' . $campagne->camp_id));
} elseif ($campagne->camp_type == 1) {
@ -81,7 +79,7 @@ class CampagneController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Campagne $campagne
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function edit(Campagne $campagne)
@ -89,7 +87,7 @@ class CampagneController extends Controller
$site = Site::findOrFail(session()->get('site')->id)->first();
$couponsLinked = $campagne->coupons()->get();
$campid = $campagne->camp_id;
$campid = $campagne->camp_id;
$couponsNotLinked = Coupon::whereDoesntHave('campagnes', function ($q) use ($campid) {
$q->where('campagne_id', $campid);
@ -101,8 +99,8 @@ class CampagneController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Campagne $campagne
* @param \Illuminate\Http\Request $request
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Campagne $campagne)
@ -110,7 +108,7 @@ class CampagneController extends Controller
$site = Site::findOrFail(session()->get('site')->id)->first();
$couponsLinked = $campagne->coupons()->get();
$campid = $campagne->camp_id;
$campid = $campagne->camp_id;
$couponsNotLinked = Coupon::whereDoesntHave('campagnes', function ($q) use ($campid) {
$q->where('campagne_id', $campid);
@ -133,14 +131,14 @@ class CampagneController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\Campagne $campagne
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function destroy(Campagne $campagne)
{
$campagne->camp_published = 0;
$campagne->save();
//File::deleteDirectory(public_path('/landings/' . $campagne->camp_id));
// File::deleteDirectory(public_path('/landings/' . $campagne->camp_id));
if ($campagne->delete()) {
return redirect(route('campagne.index'));
} else {
@ -150,22 +148,22 @@ class CampagneController extends Controller
}
/**
* @param \Illuminate\Http\Request $request
*
* @return array
*/
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function saveNotification(Request $request)
{
$notification = new Notification();
$notification->notif_name = $request->input('notif_name');
$notification->notif_email = $request->input('notif_email');
$notification = new Notification();
$notification->notif_name = $request->input('notif_name');
$notification->notif_email = $request->input('notif_email');
$notification->notif_campId = $request->input('notif_campId');
$notification->save();
return redirect()->back();
}
/**
* @param \App\Notification $notification
* @param \App\Notification $notification
*
* @return array
*/
@ -187,17 +185,14 @@ class CampagneController extends Controller
*/
// public function deleteCoupon($id)
// {
// $coupon = Coupon::find($id);
// if ($notification->delete()) {
// return redirect()->back();
// } else {
// session()->flash('delete_nok', 'Erreur lors de la suppression');
// return redirect()->back();
// }
// $coupon = Coupon::find($id);
// if ($notification->delete()) {
// return redirect()->back();
// } else {
// session()->flash('delete_nok', 'Erreur lors de la suppression');
// return redirect()->back();
// }
// }
public function getDetail(Request $request)
{
@ -205,7 +200,7 @@ class CampagneController extends Controller
// ---- Contrôle des paramètres
if (isset($request->refcamp) && $request->refcamp != "") {
$refcamp = $request->refcamp;
$refcamp = $request->refcamp;
$campagne = Campagne::where(['camp_id' => $refcamp])->first();
if (!$campagne) {
return Response::json([
@ -219,7 +214,7 @@ class CampagneController extends Controller
}
if (isset($request->refsite) && $request->refsite != "") {
$refsite = $request->refsite;
$site = Site::where(['site_id' => $refsite])->first();
$site = Site::where(['site_id' => $refsite])->first();
if (!$site) {
return Response::json([
'Statut' => 'KO',
@ -275,13 +270,13 @@ class CampagneController extends Controller
if ($coupons->count() > 0) {
foreach ($coupons as $coupon) {
//var_dump($coupon->coupon_id);
// var_dump($coupon->coupon_id);
// ---- Calcul du nombre de BR consommé
$diffuseMur = Mur::where(['mur_campId' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->count();
$diffusePanier01 = PanierContent::where(['panier_content_couponId' => $coupon->coupon_id])->sum('panier_content_quantity');
$diffusePanier02 = PanierContent::where(['panier_content_couponId' => $coupon->coupon_id])->sum('panier_content_printed');
$diffusePanier = $diffusePanier01 + $diffusePanier02;
$diffusePanier = $diffusePanier01 + $diffusePanier02;
if (!$diffusePanier) {
$diffusePanier = 0;
@ -305,7 +300,7 @@ class CampagneController extends Controller
$dateFinValidite = date("d/m/Y", strtotime($coupon->coupon_maxdatevalidity));
}
$codeTraitement = array (
$codeTraitement = array (
"Code traitement" => $coupon->coupon_code,
"Nom" => $coupon->coupon_name,
"Nb à diffuser" => $this->getFullQuantity($coupon),
@ -317,8 +312,8 @@ class CampagneController extends Controller
"Date de fin de validité" => $dateFinValidite,
);
$data['Coupons'][] = $codeTraitement;
}
}
}//end foreach
}//end if
return Response::json([
'Statut' => 'OK',
'Détails Campagne' => $data
@ -330,7 +325,7 @@ class CampagneController extends Controller
$error = false;
// ---- Contrôle des paramètres
if (isset($request->refcamp) && $request->refcamp != "") {
$refcamp = $request->refcamp;
$refcamp = $request->refcamp;
$campagne = Campagne::where(['camp_id' => $refcamp])->first();
if (!$campagne) {
return Response::json([
@ -344,7 +339,7 @@ class CampagneController extends Controller
}
if (isset($request->refsite) && $request->refsite != "") {
$refsite = $request->refsite;
$site = Site::where(['site_id' => $refsite])->first();
$site = Site::where(['site_id' => $refsite])->first();
if (!$site) {
return Response::json([
'Statut' => 'KO',
@ -358,7 +353,7 @@ class CampagneController extends Controller
if (isset($request->refadherent) && $request->refadherent != "") {
$refadherent = $request->refadherent;
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
if (!$contact) {
return Response::json([
'Statut' => 'KO',
@ -396,7 +391,7 @@ class CampagneController extends Controller
} else {
$dispo = 0;
}
$codeTraitement = array (
$codeTraitement = array (
"Code traitement" => $coupon->coupon_code,
"Nom" => $coupon->coupon_name,
"Nb disponible" => $dispo,

View file

@ -9,14 +9,14 @@ class ChangeMarqueController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$siteId = $request->input('site_id');
$siteId = $request->input('site_id');
$currentRoute = $request->input('current_route');
$site = \App\Site::findOrFail($siteId);
$site = \App\Site::findOrFail($siteId);
session()->put('site', $site);
return redirect('/bo/' . $currentRoute);

View file

@ -4,15 +4,12 @@ namespace App\Http\Controllers;
use App\Contact;
use App\Site;
use App\Log;
use App\Panier;
use App\Campagne;
use Response;
use Illuminate\Http\Request;
class ContactController extends Controller
{
/**
* Display a listing of the resource.
*
@ -29,16 +26,16 @@ class ContactController extends Controller
public function search_contact(Request $request)
{
session()->put('active_route', 'contact');
$page = $request->input('page');
$name = $request->input('searchName');
$page = $request->input('page');
$name = $request->input('searchName');
$firstname = $request->input('searchFirstname');
$email = $request->input('searchEmail');
$cp = $request->input('searchCp');
$ville = $request->input('searchVille');
$country = $request->input('searchCountry');
$email = $request->input('searchEmail');
$cp = $request->input('searchCp');
$ville = $request->input('searchVille');
$country = $request->input('searchCountry');
if (isset($name) || isset($firstname) || isset($email) || isset($cp) || isset($ville) || isset($country)) {
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)
->searchFirstname($firstname)
->searchName($name)
->searchEmail($email)
@ -59,7 +56,7 @@ class ContactController extends Controller
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
return view('contact.index')->with('contacts', $contacts)->with('search', false);
}
}//end if
}
/**
@ -75,7 +72,7 @@ class ContactController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -90,24 +87,24 @@ class ContactController extends Controller
'contact_country' => 'required'
]);
$contact = new Contact();
$contact->contact_nom = $request->input('contact_nom');
$contact->contact_prenom = $request->input('contact_prenom');
$contact->contact_ref = $request->input('contact_ref');
$contact->contact_email = $request->input('contact_email');
$contact->contact_cp = $request->input('contact_cp');
$contact->contact_ville = $request->input('contact_ville');
$contact = new Contact();
$contact->contact_nom = $request->input('contact_nom');
$contact->contact_prenom = $request->input('contact_prenom');
$contact->contact_ref = $request->input('contact_ref');
$contact->contact_email = $request->input('contact_email');
$contact->contact_cp = $request->input('contact_cp');
$contact->contact_ville = $request->input('contact_ville');
$contact->contact_country = $request->input('contact_country');
$contact->contact_hash = strtoupper(md5(uniqid(time(), true)));
$contact->contact_hash = strtoupper(md5(uniqid(time(), true)));
//$site = Site::findOrFail(session()->get('site')->id)->first();
// $site = Site::findOrFail(session()->get('site')->id)->first();
$site = session()->get('site');
$contact->contact_siteId = $site->site_id;
$contact->save();
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
$campagnes = Campagne::where(['camp_siteId' => $contact->contact_siteId, 'camp_published' => 1])->get();
return view('contact.edit', ['contact' => $contact, 'created' => true, 'contacts' => $contacts, 'campagnes' => $campagnes]);
@ -118,7 +115,7 @@ class ContactController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Campagne $campagne
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function edit(Contact $contact)
@ -132,8 +129,8 @@ class ContactController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Contact $contact
* @param \Illuminate\Http\Request $request
* @param \App\Contact $contact
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Contact $contact)
@ -169,7 +166,6 @@ class ContactController extends Controller
// $log = new Log();
// $log->log_action = config('constants.updatecontact');
// $log->log_source = $source;
$error = false;
// ---- Contrôle des paramètres
if (isset($request->refadherent) && $request->refadherent != "") {
@ -233,12 +229,12 @@ class ContactController extends Controller
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
if ($contact) {
$contact->contact_prenom = $prenom;
$contact->contact_nom = $nom;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_prenom = $prenom;
$contact->contact_nom = $nom;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_updatedate = date('Y-m-d H:i:s');
if (isset($request->hashcode) && $request->hashcode != "") {
$contact->contact_hash = $request->hashcode;
@ -247,15 +243,15 @@ class ContactController extends Controller
$site = Site::where('site_id', $refsite)->first();
if ($site) {
$contact = new Contact();
$contact->contact_nom = $nom;
$contact->contact_prenom = $prenom;
$contact->contact_ref = $refadherent;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact = new Contact();
$contact->contact_nom = $nom;
$contact->contact_prenom = $prenom;
$contact->contact_ref = $refadherent;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_siteId = $refsite;
$contact->contact_siteId = $refsite;
if (isset($request->hashcode) && $request->hashcode != "") {
$contact->contact_hash = $request->hashcode;
} else {
@ -272,8 +268,8 @@ class ContactController extends Controller
'Code' => 102,
'Message' => 'Le site spécifié n\'existe pas'
]);
}
}
}//end if
}//end if
if ($contact->save()) {
return Response::json([
@ -299,7 +295,7 @@ class ContactController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\Contact $contact
* @param \App\Contact $contact
* @return \Illuminate\Http\Response
*/
public function destroy(Contact $contact)

View file

@ -3,16 +3,12 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use App\Coupon;
use App\Site;
use App\Campagne;
use App\Mur;
use App\Panier;
use App\Mouvement;
use App\Calendrier;
use Illuminate\Support\Facades\Storage;
use App\Traits\GenerateBR;
use App\Traits\CouponTrait;
use Validator;
@ -41,7 +37,8 @@ class CouponController extends Controller
// ---- Calcul de la quantité mise à disposition grace aux fonctions dans CouponTrait.php
$coupon->coupon_quantity = $this->getFullQuantity($coupon);
// ---- Calcul de la quantité restante toutes campagnes comprises grace aux fonctions dans CouponTrait.php
$coupon->coupon_left = 0; //$coupon->coupon_quantity - $this->getUsedQuantity($coupon);
$coupon->coupon_left = 0;
// $coupon->coupon_quantity - $this->getUsedQuantity($coupon);
}
return view('coupon.index', ['coupons' => $coupons, 'camps' => $campIds]);
@ -64,7 +61,7 @@ class CouponController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -95,9 +92,9 @@ class CouponController extends Controller
$datas = $this->saveImg($request);
$coupon = new Coupon();
$coupon->coupon_code = $datas['coupon_code'];
$coupon->coupon_name = $datas['coupon_name'];
$coupon = new Coupon();
$coupon->coupon_code = $datas['coupon_code'];
$coupon->coupon_name = $datas['coupon_name'];
$coupon->coupon_value = $datas['coupon_value'];
if (isset($datas['coupon_thumbnail1'])) {
$coupon->coupon_thumbnail1 = $datas['coupon_thumbnail1'];
@ -115,16 +112,16 @@ class CouponController extends Controller
$coupon->coupon_image = $datas['coupon_image'];
}
if (isset($datas['coupon_norme'])) {
$coupon->coupon_norme = $datas['coupon_norme'];
$coupon->coupon_norme = $datas['coupon_norme'];
$coupon->coupon_gs1code = $datas['coupon_gs1code'];
}
if (isset($datas['coupon_enablelimitquantity'])) {
$coupon->coupon_enablelimitquantity = $datas['coupon_enablelimitquantity'];
$coupon->coupon_limitquantity = $datas['coupon_limitquantity'];
$coupon->coupon_limitquantity = $datas['coupon_limitquantity'];
}
if (isset($datas['coupon_enablelimitperiod'])) {
$coupon->coupon_enablelimitperiod = $datas['coupon_enablelimitperiod'];
$coupon->coupon_limitperiod = $datas['coupon_limitperiod'];
$coupon->coupon_limitperiod = $datas['coupon_limitperiod'];
}
if (isset($datas['coupon_published'])) {
$coupon->coupon_published = $datas['coupon_published'];
@ -136,12 +133,12 @@ class CouponController extends Controller
} else {
$coupon->coupon_legal_mentions_splitted = 0;
}
$coupon->coupon_validity = $datas['coupon_validity'];
$coupon->coupon_validity = $datas['coupon_validity'];
$coupon->coupon_mindatediffusion = $datas['coupon_mindatediffusion'];
$coupon->coupon_maxdatediffusion = $datas['coupon_maxdatediffusion'];
$coupon->coupon_maxdatevalidity = $datas['coupon_maxdatevalidity'];
$coupon->coupon_maxdatevalidity = $datas['coupon_maxdatevalidity'];
$coupon->coupon_validity_text = $datas['coupon_validity_text'];
$coupon->coupon_validity_text = $datas['coupon_validity_text'];
$coupon->coupon_legal_mentions = $datas['coupon_legal_mentions'];
if (isset($datas['coupon_decoration_image'])) {
$coupon->coupon_decoration_image = $datas['coupon_decoration_image'];
@ -149,24 +146,24 @@ class CouponController extends Controller
if (isset($datas['coupon_logo_image'])) {
$coupon->coupon_logo_image = $datas['coupon_logo_image'];
}
$coupon->coupon_rcs = $datas['coupon_rcs'];
$coupon->coupon_rcs = $datas['coupon_rcs'];
$coupon->coupon_site_contact = $datas['coupon_site_contact'];
$coupon->coupon_seuil_alert = $datas['coupon_seuil_alert'];
$coupon->coupon_seuil_alert = $datas['coupon_seuil_alert'];
$site = Site::find($request->input('site_id'));
$site->coupons()->save($coupon);
if (isset($datas['initial_quantity'])) {
$mouvement = new Mouvement();
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $datas['initial_quantity'];
$coupon->mouvements()->save($mouvement);
}
if (isset($datas['mouvementNbre'])) {
foreach ($datas['mouvementNbre'] as $key => $value) {
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement->mouvement_created_at = $datas['mouvementDate'][$key];
$coupon->mouvements()->save($mouvement);
}
@ -174,14 +171,14 @@ class CouponController extends Controller
if (isset($datas['startdate'])) {
foreach ($datas['startdate'] as $key => $value) {
$calendar = new Calendrier();
$calendar = new Calendrier();
$calendar->calendrier_startdate = $value;
$calendar->calendrier_enddate = $datas['enddate'][$key];
$calendar->calendrier_enddate = $datas['enddate'][$key];
$coupon->calendriers()->save($calendar);
}
}
$br_path = $this->generateBase($request, $coupon);
$br_path = $this->generateBase($request, $coupon);
$coupon->coupon_image = $br_path;
$coupon->save();
@ -191,7 +188,7 @@ class CouponController extends Controller
/**
* Display the specified resource.
*
* @param \App\Coupon $coupon
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function show(Coupon $coupon)
@ -202,7 +199,7 @@ class CouponController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Coupon $coupon
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function edit(Coupon $coupon)
@ -213,8 +210,8 @@ class CouponController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Coupon $coupon
* @param \Illuminate\Http\Request $request
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Coupon $coupon)
@ -256,14 +253,14 @@ class CouponController extends Controller
$coupon->coupon_legal_mentions_splitted = 0;
}
if ($coupon->update($this->saveImg($request))) {
$datas = $this->saveImg($request);
$br_path = $this->generateBase($request, $coupon);
$datas = $this->saveImg($request);
$br_path = $this->generateBase($request, $coupon);
$coupon->coupon_image = $br_path;
$coupon->update($this->saveImg($request));
if (isset($datas['mouvementNbre'])) {
foreach ($datas['mouvementNbre'] as $key => $value) {
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement->mouvement_created_at = $datas['mouvementDate'][$key];
$coupon->mouvements()->save($mouvement);
}
@ -271,9 +268,9 @@ class CouponController extends Controller
if (isset($datas['startdate'])) {
$coupon->calendriers()->delete();
foreach ($datas['startdate'] as $key => $value) {
$calendar = new Calendrier();
$calendar = new Calendrier();
$calendar->calendrier_startdate = $value;
$calendar->calendrier_enddate = $datas['enddate'][$key];
$calendar->calendrier_enddate = $datas['enddate'][$key];
$coupon->calendriers()->save($calendar);
}
}
@ -282,7 +279,7 @@ class CouponController extends Controller
return redirect()->route('coupon.edit', ['coupon' => $coupon]);
} else {
return view('holder');
}
}//end if
return redirect()->route('coupon.edit', ['coupon' => $coupon]);
}
@ -290,7 +287,7 @@ class CouponController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\Coupon $coupon
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function destroy(Coupon $coupon)
@ -306,7 +303,7 @@ class CouponController extends Controller
}
/**
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return array
*/

View file

@ -3,12 +3,10 @@
namespace App\Http\Controllers;
use App;
use Illuminate\Support\Facades\Storage;
use CpChart\Data;
use CpChart\Image;
use App\Traits\CouponTrait;
use App\Traits\GraphTrait;
use App\Campagne;
use App\Site;
use App\Coupon;
use Datetime;
@ -22,39 +20,39 @@ class ExportController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function show(Request $request)
{
$sites = Site::all();
$sites = Site::all();
$startdate = new DateTime("first day of last month");
$startdate = $startdate->format('Y-m-d');
$enddate = date('Y-m-d');
$enddate = date('Y-m-d');
return view('export.index')->with(['sites' => $sites, 'startdate' => $startdate, 'enddate' => $enddate]);
}
//------ AJAX Export
// ------ AJAX Export
public function export_coupons(Request $request)
{
$ids = $request->input('ids');
$ids = $request->input('ids');
$startdate = date('Y-m-d', strtotime($request->input('startdate')));
$enddate = date('Y-m-d', strtotime($request->input('enddate')));
$coupons = Coupon::find($ids);
$enddate = date('Y-m-d', strtotime($request->input('enddate')));
$coupons = Coupon::find($ids);
$labels = $this->getLabelsForStats($startdate, $enddate);
$paths = array();
foreach ($coupons as $coupon) {
$cpName = str_replace(' ', '', $coupon->coupon_name);
$now = strtotime(now());
$full_path = 'export/' . $cpName . '_' . $now . '.pdf';
$dataCoupon = $this->getDataForCouponAllCamp($labels, $coupon);
$coupon->couponQuantity = $this->getFullQuantity($coupon);
$cpName = str_replace(' ', '', $coupon->coupon_name);
$now = strtotime(now());
$full_path = 'export/' . $cpName . '_' . $now . '.pdf';
$dataCoupon = $this->getDataForCouponAllCamp($labels, $coupon);
$coupon->couponQuantity = $this->getFullQuantity($coupon);
$coupon->couponFullPrinted = $this->getUsedQuantity($coupon);
$coupon->couponPrinted = $this->getUsedQuantityOnPeriod($coupon, $startdate, $enddate);
$coupon->couponPrinted = $this->getUsedQuantityOnPeriod($coupon, $startdate, $enddate);
$pdf = App::make('dompdf.wrapper');
@ -78,12 +76,11 @@ class ExportController extends Controller
$view = view('export.template')->with(['src' => 'export/temp.png', 'coupon' => $coupon, 'startdate' => $startdate, 'enddate' => $enddate])->render();
//var_dump($view);
// var_dump($view);
$pdf->loadHTML($view);
$pdf->save($full_path);
array_push($paths, $full_path);
}
}//end foreach
return json_encode($paths);
}

View file

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Campagne;
use Barryvdh\Debugbar\Facade as Debugbar;
@ -15,7 +14,7 @@ class HomeController extends Controller
*/
public function __construct()
{
//$this->middleware('auth');
// $this->middleware('auth');
}
/**

View file

@ -2,25 +2,21 @@
namespace App\Http\Controllers;
use App\Campagne;
use App\Coupon;
use App\Site;
use App\User;
use App\Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Carbon\Carbon;
class MaintenanceController extends Controller
{
public function show(Request $request)
{
$users = User::all();
foreach ($users as &$user) {
$sites = $user->sites()->get();
$sites = $user->sites()->get();
$user->linkedSites = "";
foreach ($sites as $site) {
$user->linkedSites .= '<p>' . $site->site_nom . '</p>';
@ -39,13 +35,12 @@ class MaintenanceController extends Controller
// $logArray = array();
// foreach ($logs as $logMonth) {
// $count = count($logMonth);
// foreach ($logMonth as $log) {
// $date = Carbon::parse($log->created_at)->format('m/Y');
// }
// array_push($logArray, [$date, $count]);
// $count = count($logMonth);
// foreach ($logMonth as $log) {
// $date = Carbon::parse($log->created_at)->format('m/Y');
// }
// array_push($logArray, [$date, $count]);
// }
return view('maintenance.index')->with(['users' => $users, 'logs' => $count]);
}
@ -64,34 +59,34 @@ class MaintenanceController extends Controller
'password' => 'required'
]);
$nom = $request->name;
$email = $request->email;
$nom = $request->name;
$email = $request->email;
$password = $request->password;
$role = $request->roles;
$role = $request->roles;
$user = new User();
$user->name = $nom;
$user->email = $email;
$user = new User();
$user->name = $nom;
$user->email = $email;
$user->password = Hash::make($password);
$user->roles = $role;
$user->roles = $role;
$user->save();
//MAJ des sites liés
// MAJ des sites liés
if (isset($request->site)) {
$siteids = $request->site;
$sites = Site::whereIn('site_id', $siteids)->get()->pluck('id')->toArray();
$sites = Site::whereIn('site_id', $siteids)->get()->pluck('id')->toArray();
$user->sites()->sync($sites);
}
$sites = Site::all();
$sites = Site::all();
$usersites = $user->sites()->get()->pluck('site_id')->toArray();
return view('user.edit')->with(['user' => $user, 'sites' => $sites, 'usersites' => $usersites]);
}
public function useredit(User $user)
{
$sites = Site::all();
$sites = Site::all();
$usersites = $user->sites()->get()->pluck('site_id')->toArray();
return view('user.edit')->with(['user' => $user, 'sites' => $sites, 'usersites' => $usersites]);
}
@ -108,18 +103,18 @@ class MaintenanceController extends Controller
public function userupdate(Request $request, User $user)
{
//MAJ du User
$user->name = $request->name;
// MAJ du User
$user->name = $request->name;
$user->email = $request->email;
$user->roles = $request->roles;
$user->save();
//MAJ des sites liés
// MAJ des sites liés
$siteids = $request->site;
$sites = Site::whereIn('site_id', $siteids)->get()->pluck('id')->toArray();
$sites = Site::whereIn('site_id', $siteids)->get()->pluck('id')->toArray();
$user->sites()->sync($sites);
$marques = Auth::user()->sites;
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
@ -129,7 +124,7 @@ class MaintenanceController extends Controller
$users = User::all();
foreach ($users as &$user) {
$sites = $user->sites()->get();
$sites = $user->sites()->get();
$user->linkedSites = "";
foreach ($sites as $site) {
$user->linkedSites .= '<p>' . $site->site_nom . '</p>';

View file

@ -11,14 +11,14 @@ class MouvementController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$mouvement = new Mouvement();
$mouvement->mouvement_type = $request->input('mouvement_type');
$mouvement->mouvement_nombre = $request->input('mouvement_nombre');
$mouvement = new Mouvement();
$mouvement->mouvement_type = $request->input('mouvement_type');
$mouvement->mouvement_nombre = $request->input('mouvement_nombre');
$mouvement->mouvement_commentaire = $request->input('mouvement_commentaire');
$coupon = Coupon::find($request->input('coupon_id'));

View file

@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Campagne;
use app\Coupon;
use App\Contact;
use App\Mur;
use App\Log;
@ -21,7 +20,7 @@ class MurController extends Controller
{
$datas = $request->all();
if (isset($datas['refcamp'])) {
$ref = intval($datas['refcamp']);
$ref = intval($datas['refcamp']);
$campagne = Campagne::where(['camp_id' => $ref])->first();
} else {
abort(404);
@ -44,15 +43,15 @@ class MurController extends Controller
$coupons = $this->getCouponsPublished($campagne);
foreach ($coupons as $coupon) {
$coupon->isAvailable = $this->isAvailable($coupon, $campagne, $contact);
$coupon->isAvailable = $this->isAvailable($coupon, $campagne, $contact);
$coupon->isAvailableToPrint = $this->isAvailableToPrint($coupon, $campagne);
}
unset($coupon);
// Montant total et Nombre réductions disponible
$montantDispo = 0;
$montantTotal = 0;
$nbCoupon = 0;
$montantDispo = 0;
$montantTotal = 0;
$nbCoupon = 0;
$nbCouponToPrint = 0;
foreach ($coupons as $coupon) {
$montantTotal += $coupon->coupon_value;
@ -101,7 +100,7 @@ class MurController extends Controller
}
// ---- INIT du log
$log = new Log();
$log = new Log();
$log->log_action = config('constants.delctrlcontact');
$log->log_source = $source;
@ -119,8 +118,8 @@ class MurController extends Controller
}
// Erreur si paramètres mal renseignés
if ($error) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_statut = 'NOK';
$log->log_message = "Des paramètres de la requête sont mal renseignés ou non présents";
$log->save();
@ -131,12 +130,12 @@ class MurController extends Controller
]);
}
//Check de la campagne
// Check de la campagne
$campagne = Campagne::where('camp_id', $refcamp)->first();
if (!$campagne) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_statut = 'NOK';
$log->log_message = "La campagne n'existe pas";
$log->save();
return Response::json([
@ -147,13 +146,13 @@ class MurController extends Controller
}
//Check du contact
// Check du contact
$contact = Contact::where(['contact_ref' => $refadherent, 'contact_siteId' => $campagne->camp_siteId])->first();
if (!$contact) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_statut = 'NOK';
$log->log_statut = 'NOK';
$log->log_message = "Le contact n'existe pas";
$log->save();
@ -165,33 +164,33 @@ class MurController extends Controller
}
if ($campagne) {
//Update
// Update
$mur = Mur::where(['mur_campId' => $refcamp, 'mur_contactId' => $contact->contact_id])->update(['mur_deleted' => '1']);
if ($mur != 0) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_contactId = $contact->contact_id;
$log->log_statut = 'OK';
$log->log_message = $mur . " enregistrements ont été mis à jour.";
$log->log_statut = 'OK';
$log->log_message = $mur . " enregistrements ont été mis à jour.";
$log->save();
return Response::json([
'Statut' => 'OK',
'Message' => $mur . " enregistrements ont été mis à jour."
]);
} else {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent]);
$log->log_refsite = $campagne->camp_siteId;
$log->log_contactId = $contact->contact_id;
$log->log_statut = 'OK';
$log->log_message = 'Aucun contrôle à effacer';
$log->log_statut = 'OK';
$log->log_message = 'Aucun contrôle à effacer';
$log->save();
return Response::json([
'Statut' => 'KO',
'Code' => 110,
'Message' => 'Aucun contrôle à effacer'
]);
}
}
}//end if
}//end if
return;
}

View file

@ -21,14 +21,14 @@ class PanierController extends Controller
public function showTemplate(Request $request)
{
//$panier = Panier::find($request->query('basketid'));
// $panier = Panier::find($request->query('basketid'));
$panier = Panier::where(['panier_ref' => $request->basketid])->first();
if (!$panier) {
abort(404);
}
session()->put('panier', $panier);
$panierCouponsCount = $this->getCountCouponsPanierPublished($panier);
$contact = Contact::where(['contact_id' => $panier->panier_contactId])->first();
$contact = Contact::where(['contact_id' => $panier->panier_contactId])->first();
if (!$contact) {
abort(404);
}
@ -44,9 +44,9 @@ class PanierController extends Controller
$coupons = $this->getCouponsPublished($campagne);
} else {
$panierContents = $this->getPanierContentPublished($panier);
$coupons = array();
$coupons = array();
foreach ($panierContents as $panierContent) {
$cp = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
$cp = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
$qty = $panierContent->panier_content_quantity;
for ($i = 0; $i < $qty; $i++) {
$coupons[] = $cp;
@ -83,7 +83,7 @@ class PanierController extends Controller
$source = 'API';
}
// ---- INIT du log
$log = new Log();
$log = new Log();
$log->log_action = config('constants.updatebasket');
$log->log_source = $source;
@ -92,8 +92,8 @@ class PanierController extends Controller
if ($basketid != '') {
$panier = Panier::where('panier_ref', $basketid)->first();
if (!$panier) {
$log->log_params = json_encode(['basketid' => $basketid]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid]);
$log->log_statut = 'NOK';
$log->log_message = "Le panier n'existe pas";
$log->save();
@ -105,14 +105,14 @@ class PanierController extends Controller
}
if (isset($request->panier) && $request->panier != "") {
$panier = $request->panier;
$panier = $request->panier;
$panierTab = explode(",", $panier);
$coupons = array();
$coupons = array();
foreach ($panierTab as $panier) {
$pos = strpos($panier, ")");
if ($pos === false || substr_count($panier, ")") != 1) {
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_message = "Des paramètres de la requête sont mal renseignés ou non présents";
$log->save();
return Response::json([
@ -121,8 +121,8 @@ class PanierController extends Controller
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
$quantity = substr($panier, 0, $pos);
$quantity = str_replace("(", "", $quantity);
$quantity = substr($panier, 0, $pos);
$quantity = str_replace("(", "", $quantity);
$couponCode = substr($panier, $pos + 1);
if (is_numeric($quantity) && is_numeric($couponCode)) {
@ -132,8 +132,8 @@ class PanierController extends Controller
$coupons[$couponCode] = $quantity;
}
} else {
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_message = "Des paramètres de la requête sont mal renseignés ou non présents";
$log->save();
return Response::json([
@ -142,8 +142,8 @@ class PanierController extends Controller
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
}
//---- Préparation message de log avec coupons
}//end foreach
// ---- Préparation message de log avec coupons
$panierCoupons = array();
foreach ($coupons as $code => $qty) {
array_push($panierCoupons, ['cp_code' => $code, 'qty' => $qty]);
@ -152,8 +152,8 @@ class PanierController extends Controller
die();
}
} else {
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_message = "Des paramètres de la requête sont mal renseignés ou non présents";
$log->save();
return Response::json([
@ -161,16 +161,16 @@ class PanierController extends Controller
'Code' => 101,
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
}//end if
// ---- MAJ du panier
$panier = Panier::where('panier_ref', $basketid)->first();
if ($panier) {
foreach ($coupons as $couponCode => $quantity) {
$cp = Coupon::where('coupon_code', $couponCode)->first();
$cp = Coupon::where('coupon_code', $couponCode)->first();
$exists = $cp->campagnes->contains($panier->panier_campId);
if ($cp && $exists) {
$site = $cp->coupon_siteId;
$site = $cp->coupon_siteId;
$panierContent = PanierContent::where(['panier_content_panierId' => $panier->panier_id, 'panier_content_couponId' => $cp->coupon_id])->first();
if ($panierContent) {
$quantity += $panierContent->panier_content_quantity;
@ -183,7 +183,7 @@ class PanierController extends Controller
} else {
// Ajout du contenu
if ($quantity > 0) {
$panierNewContent = new PanierContent();
$panierNewContent = new PanierContent();
$panierNewContent->panier_content_panierId = $panier->panier_id;
$panierNewContent->panier_content_couponId = $cp->coupon_id;
$panierNewContent->panier_content_quantity = $quantity;
@ -191,8 +191,8 @@ class PanierController extends Controller
}
}
} else {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_message = "Le coupon ne correspond pas aux coupons liés a la campagne";
$log->save();
@ -201,8 +201,8 @@ class PanierController extends Controller
'Code' => 110,
'Message' => 'Le coupon ne correspond pas aux coupons liés a la campagne'
]);
}
}
}//end if
}//end foreach
// MAJ du status du panier
$qty = $panier->panierContents()->sum('panier_content_quantity');
if ($qty == 0) {
@ -214,16 +214,16 @@ class PanierController extends Controller
$panier->save();
$campagne = Campagne::where(['camp_id' => $panier->panier_campId])->first();
//var_dump($panier->panier_campId);
$log->log_refsite = $campagne->camp_siteId;
// var_dump($panier->panier_campId);
$log->log_refsite = $campagne->camp_siteId;
$log->log_contactId = $panier->panier_contactId;
$log->log_params = json_encode(['refcamp' => $panier->panier_campId, 'basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'OK';
$log->log_message = json_encode(['Message' => 'Le panier a bien été créé/mis à jour', 'Coupons' => $panierCoupons], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$log->log_params = json_encode(['refcamp' => $panier->panier_campId, 'basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'OK';
$log->log_message = json_encode(['Message' => 'Le panier a bien été créé/mis à jour', 'Coupons' => $panierCoupons], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$log->save();
$contact = Contact::where(['contact_id' => $panier->panier_contactId])->first();
$site = Site::where(['site_id' => $campagne->camp_siteId])->first();
$site = Site::where(['site_id' => $campagne->camp_siteId])->first();
if (isset($contact->contact_nom) && isset($site->site_nom)) {
if ($panier->panier_pending == 1) {
@ -231,22 +231,22 @@ class PanierController extends Controller
} else {
$encours = "non";
}
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response->DateCreation = date("d/m/Y", strtotime($panier->panier_createdate));
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$allPanierContent = $panier->panierContents()->get();
foreach ($allPanierContent as $panierContent) {
$panCont = [];
$coupon = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
$coupon = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
if ($coupon) {
array_push($panCont, $coupon->coupon_code . " - " . $coupon->coupon_name . " (x" . $panierContent->panier_content_quantity . ")");
}
@ -263,10 +263,10 @@ class PanierController extends Controller
'Statut' => 'OK',
'Panier' => $panier
]);
}
}//end if
} else {
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_message = "Le panier n'existe pas";
$log->save();
return Response::json([
@ -274,10 +274,10 @@ class PanierController extends Controller
'Code' => 106,
'Message' => 'Le panier n\'existe pas'
]);
}
}//end if
} else {
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['basketid' => $basketid, 'panier' => $panier]);
$log->log_statut = 'NOK';
$log->log_message = "Le panier n'existe pas";
$log->save();
return Response::json([
@ -285,16 +285,16 @@ class PanierController extends Controller
'Code' => 106,
'Message' => 'Le panier n\'existe pas'
]);
}
}//end if
} else {
// ---- Contrôle des paramètres
$error = false;
if (isset($request->refcamp) && $request->refcamp != "") {
$refcamp = $request->refcamp;
$refcamp = $request->refcamp;
$campagne = Campagne::where(['camp_id' => $refcamp])->first();
if (!$campagne || $campagne->camp_published == 0 || ($campagne->camp_type != 1 && $campagne->camp_type != 3)) {
$log->log_params = json_encode(['refcamp' => $refcamp]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $refcamp]);
$log->log_statut = 'NOK';
$log->log_message = "La campagne n'existe pas ou n'est pas un panier";
$log->save();
@ -361,16 +361,16 @@ class PanierController extends Controller
$pays = 250;
}
if (isset($request->panier) && $request->panier != "") {
$panier = $request->panier;
$panier = $request->panier;
$panierTab = explode(",", $panier);
$coupons = array();
$coupons = array();
foreach ($panierTab as $panier) {
$pos = strpos($panier, ")");
if ($pos === false) {
$error = true;
}
$quantity = substr($panier, 0, $pos);
$quantity = str_replace("(", "", $quantity);
$quantity = substr($panier, 0, $pos);
$quantity = str_replace("(", "", $quantity);
$couponCode = substr($panier, $pos + 1);
if (is_numeric($quantity) && is_numeric($couponCode) && $quantity > 0) {
@ -386,9 +386,9 @@ class PanierController extends Controller
}
} else {
$error = true;
}
}//end if
//---- Préparation message de log avec coupons
// ---- Préparation message de log avec coupons
if (isset($coupons)) {
$panierCoupons = array();
foreach ($coupons as $code => $qty) {
@ -398,8 +398,8 @@ class PanierController extends Controller
if ($error) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_message = "Des paramètres de la requête sont mal renseignés ou non présents";
$log->save();
@ -414,31 +414,31 @@ class PanierController extends Controller
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
if ($contact) {
// ---- Mise à jour du contact
$contact->contact_prenom = $prenom;
$contact->contact_nom = $nom;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_prenom = $prenom;
$contact->contact_nom = $nom;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_updatedate = date('Y-m-d H:i:s');
} else {
// ---- Création du contact
$site = Site::where('site_id', $refsite)->first();
if ($site) {
$contact = new Contact();
$contact->contact_nom = $nom;
$contact->contact_prenom = $prenom;
$contact->contact_ref = $refadherent;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact = new Contact();
$contact->contact_nom = $nom;
$contact->contact_prenom = $prenom;
$contact->contact_ref = $refadherent;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_siteId = $refsite;
$contact->contact_hash = strtoupper(md5(uniqid(time(), true)));
$contact->contact_siteId = $refsite;
$contact->contact_hash = strtoupper(md5(uniqid(time(), true)));
} else {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_message = "Le site spécifié n'existe pas";
$log->save();
@ -447,11 +447,11 @@ class PanierController extends Controller
'Code' => 102,
'Message' => 'Le site spécifié n\'existe pas'
]);
}
}
}//end if
}//end if
if (!$contact->save()) {
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_statut = 'NOK';
$log->log_message = "Une erreur est survenue";
$log->save();
return Response::json([
@ -466,19 +466,19 @@ class PanierController extends Controller
if ($panier) {
foreach ($coupons as $couponCode => $quantity) {
$camp = Campagne::where('camp_id', $panier->panier_campId)->first();
$cp = $camp->coupons()->where('coupon_code', $couponCode)->first();
$cp = $camp->coupons()->where('coupon_code', $couponCode)->first();
if ($cp) {
$panierContent = PanierContent::where(['panier_content_panierId' => $panier->panier_id, 'panier_content_couponId' => $cp->coupon_id])->first();
if ($panierContent) {
//$quantity += $panierContent->panier_content_quantity;
// $quantity += $panierContent->panier_content_quantity;
$panierContent->panier_content_quantity = $quantity + $panierContent->panier_content_quantity;
// MAJ du contenu
$panierContent->save();
//$panierContent->update(['panier_content_quantity', $quantity]);
// $panierContent->update(['panier_content_quantity', $quantity]);
} else {
// Ajout du contenu
if ($quantity > 0) {
$panierNewContent = new PanierContent();
$panierNewContent = new PanierContent();
$panierNewContent->panier_content_panierId = $panier->panier_id;
$panierNewContent->panier_content_couponId = $cp->coupon_id;
$panierNewContent->panier_content_quantity = $quantity;
@ -486,14 +486,14 @@ class PanierController extends Controller
}
}
}
}
}//end foreach
} else {
// Ajout du panier et du contenu
$panierRef = strtoupper(md5(uniqid(time(), true)));
$panier = new Panier();
$panier->panier_ref = $panierRef;
$panier->panier_campId = $refcamp;
$panier->panier_contactId = $contact->contact_id;
$panierRef = strtoupper(md5(uniqid(time(), true)));
$panier = new Panier();
$panier->panier_ref = $panierRef;
$panier->panier_campId = $refcamp;
$panier->panier_contactId = $contact->contact_id;
$panier->panier_createdate = date('Y-m-d H:i:s');
$panier->save();
@ -502,7 +502,7 @@ class PanierController extends Controller
if ($cp) {
// Ajout du contenu
if ($quantity > 0) {
$panierNewContent = new PanierContent();
$panierNewContent = new PanierContent();
$panierNewContent->panier_content_panierId = $panier->panier_id;
$panierNewContent->panier_content_couponId = $cp->coupon_id;
$panierNewContent->panier_content_quantity = $quantity;
@ -510,17 +510,17 @@ class PanierController extends Controller
}
}
}
}
}//end if
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_params = json_encode(['refcamp' => $request->refcamp, 'refadherent' => $request->refadherent, 'refsite' => $request->refsite, 'nom' => $request->nom, 'prenom' => $request->prenom, 'email' => $request->email, 'code postal' => $request->code_postal, 'commune' => $request->commune, 'panier' => $request->panier]);
$log->log_contactId = $panier->panier_contactId;
$log->log_refsite = $request->refsite;
$log->log_statut = 'OK';
$log->log_message = json_encode(['Message' => 'Le panier a bien été créé/mis à jour', 'Coupons' => $panierCoupons], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$log->log_refsite = $request->refsite;
$log->log_statut = 'OK';
$log->log_message = json_encode(['Message' => 'Le panier a bien été créé/mis à jour', 'Coupons' => $panierCoupons], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$log->save();
$contact = Contact::where(['contact_id' => $panier->panier_contactId])->first();
$site = Site::where(['site_id' => $campagne->camp_siteId])->first();
$site = Site::where(['site_id' => $campagne->camp_siteId])->first();
if (isset($contact->contact_nom) && isset($site->site_nom)) {
if ($panier->panier_pending == 1) {
@ -528,20 +528,20 @@ class PanierController extends Controller
} else {
$encours = "non";
}
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response->DateCreation = date("d/m/Y", strtotime($panier->panier_createdate));
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$allPanierContent = $panier->panierContents()->get();
$panCont = [];
$panCont = [];
foreach ($allPanierContent as $panierContent) {
$coupon = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
if ($coupon) {
@ -560,8 +560,8 @@ class PanierController extends Controller
'Statut' => 'OK',
'Panier' => $panier
]);
}
}
}//end if
}//end if
}
public function showBasket(Request $request)
@ -628,18 +628,18 @@ class PanierController extends Controller
]);
}
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response = new \stdClass();
$response->Site = $site->site_nom . " (" . $site->site_id . ")";
$response->Campagne = $campagne->camp_name . " (" . $campagne->camp_id . ")";
$response->Panier = $panier->panier_ref;
$response->DateCreation = date("d/m/Y", strtotime($panier->panier_createdate));
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$panCont = [];
$response->EnCours = $encours;
$response->Nom = $contact->contact_nom;
$response->Prenom = $contact->contact_prenom;
$response->Email = $contact->contact_email;
$response->CodePostal = $contact->contact_cp;
$response->Commune = $contact->contact_ville;
$panCont = [];
foreach ($allPanierContent as $panierContent) {
$coupon = Coupon::where(['coupon_id' => $panierContent->panier_content_couponId])->first();
if ($coupon) {

View file

@ -10,16 +10,17 @@ class RedirectController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$mur = new Controllers\MurController();
$mur = new Controllers\MurController();
$panier = new Controllers\PanierController();
if (isset($request->basketid)) {
return $panier->showTemplate($request); //$this->showTemplate($request);
return $panier->showTemplate($request);
// $this->showTemplate($request);
} elseif (isset($request->hash)) {
return $mur->show($request);
} else {

View file

@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use App\Site;
use App\User;
use App\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@ -35,7 +34,7 @@ class SiteController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -49,13 +48,13 @@ class SiteController extends Controller
'site_libelle' => 'required'
]);
$site = new Site();
$datas = $this->saveImg($request);
$site->site_id = $datas['site_id'];
$site->site_nom = $datas['site_nom'];
$site = new Site();
$datas = $this->saveImg($request);
$site->site_id = $datas['site_id'];
$site->site_nom = $datas['site_nom'];
$site->site_contact = $datas['site_contact'];
$site->site_logo = $datas['site_logo'];
$site->site_rcs = $datas['site_rcs'];
$site->site_logo = $datas['site_logo'];
$site->site_rcs = $datas['site_rcs'];
$site->site_libelle = $datas['site_libelle'];
$site->save();
@ -66,7 +65,7 @@ class SiteController extends Controller
$admin->sites()->save($site);
}
// --- MAJ Selecteur marques
$marques = Auth::user()->sites;
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
@ -79,7 +78,7 @@ class SiteController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Site $site
* @param \App\Site $site
* @return \Illuminate\Http\Response
*/
public function edit(Site $site)
@ -90,8 +89,8 @@ class SiteController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Site $site
* @param \Illuminate\Http\Request $request
* @param \App\Site $site
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Site $site)
@ -106,7 +105,7 @@ class SiteController extends Controller
}
/**
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return array
*/

View file

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Statistique;
use App\Campagne;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@ -42,15 +41,15 @@ class StatistiqueController extends Controller
}
$coupons = $campagne->coupons;
foreach ($coupons as $coupon) {
$coupon->quantity = $this->getFullQuantity($coupon);
$coupon->remain = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon);
$coupon->diffused = $this->getDiffusedQuantity($coupon);
$coupon->quantity = $this->getFullQuantity($coupon);
$coupon->remain = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon);
$coupon->diffused = $this->getDiffusedQuantity($coupon);
$coupon->isPrintable = $this->isAvailableToPrint($coupon, $campagne);
$coupon->isPaused = $this->isPausedToPrint($coupon, $campagne);
$coupon->isPaused = $this->isPausedToPrint($coupon, $campagne);
}
}
}
}
}//end foreach
}//end if
}//end foreach
return view('stats.index')->with(['sites' => $sites]);
}
@ -61,7 +60,7 @@ class StatistiqueController extends Controller
*/
public function statdetail(Campagne $campagne)
{
$count = 0;
$count = 0;
$colors = config('constants.colors');
switch ($campagne->camp_type) {
case 0:
@ -80,24 +79,24 @@ class StatistiqueController extends Controller
$coupons = $campagne->coupons;
foreach ($coupons as $coupon) {
$coupon->quantity = $this->getFullQuantity($coupon);
$coupon->remain = $coupon->quantity - $this->getUsedQuantity($coupon);
$coupon->diffused = $this->getDiffusedQuantity($coupon);
$coupon->quantity = $this->getFullQuantity($coupon);
$coupon->remain = $coupon->quantity - $this->getUsedQuantity($coupon);
$coupon->diffused = $this->getDiffusedQuantity($coupon);
$coupon->isPrintable = $this->isAvailableToPrint($coupon, $campagne);
$coupon->isPaused = $this->isPausedToPrint($coupon, $campagne);
$coupon->color = $coupon->color = "#" . str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT) . str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT) . str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
$coupon->isPaused = $this->isPausedToPrint($coupon, $campagne);
$coupon->color = $coupon->color = "#" . str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT);
$count++;
}
$enddate = date('Y-m-d');
$enddate = date('Y-m-d');
$startdate = date('Y-m-d', strtotime("-30 days"));
return view('stats.detail')->with(['campagne' => $campagne, 'startdate' => $startdate, 'enddate' => $enddate]);
}
public function load_stats(Request $request)
{
$campid = $request->campid;
$campid = $request->campid;
$startdate = $request->startdate;
$enddate = $request->enddate;
$enddate = $request->enddate;
// ---- Labels pour la période
$labels = $this->getLabelsForStats($startdate, $enddate);
@ -107,10 +106,10 @@ class StatistiqueController extends Controller
// ---- Data pour le graphique par coupons
$campagne = Campagne::where(['camp_id' => $campid])->first();
$coupons = $campagne->coupons;
$coupons = $campagne->coupons;
$dataSpec = [];
foreach ($coupons as $coupon) {
$dataCoupon = $this->getDataForCoupon($labels, $campid, $coupon);
$dataCoupon = $this->getDataForCoupon($labels, $campid, $coupon);
$dataSpec[$coupon->coupon_code] = $dataCoupon;
}

View file

@ -6,7 +6,6 @@ use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*

View file

@ -10,8 +10,8 @@ class Admin
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)

View file

@ -9,7 +9,7 @@ class Authenticate extends Middleware
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)

View file

@ -6,13 +6,11 @@ use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -6,13 +6,11 @@ use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -2,7 +2,6 @@
namespace App\Http\Middleware;
use Auth;
use Closure;
class Marketing
@ -10,8 +9,8 @@ class Marketing
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)

View file

@ -10,20 +10,20 @@ class ProcessSpecificUrl
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$path = $request->path();
$params = $request->all();
$path = $request->path();
$params = $request->all();
$paramsCount = count($params);
$contact = new Controllers\ContactController();
$mur = new Controllers\MurController();
$panier = new Controllers\PanierController();
$campagne = new Controllers\CampagneController();
$ajax = new Controllers\AjaxController();
$contact = new Controllers\ContactController();
$mur = new Controllers\MurController();
$panier = new Controllers\PanierController();
$campagne = new Controllers\CampagneController();
$ajax = new Controllers\AjaxController();
switch ($path) {
case 'updatecontact':
$res = $contact->updateContact($request);
@ -89,7 +89,7 @@ class ProcessSpecificUrl
break;
}
break;
}
}//end switch
return $res;
}

View file

@ -10,9 +10,9 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)

View file

@ -4,15 +4,14 @@ namespace App\Http\Middleware;
use Auth;
use Closure;
use App\Site;
class SaveCurrentRoute
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
@ -32,7 +31,7 @@ class SaveCurrentRoute
$siteId = session()->get('marques');
if (!isset($siteId)) {
$marques = Auth::user()->sites;
$marques = Auth::user()->sites;
$submarques = $marques->map(function ($marque) {
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});

View file

@ -10,8 +10,8 @@ class SuperAdmin
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)

View file

@ -6,7 +6,6 @@ use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*

View file

@ -7,7 +7,6 @@ use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
@ -18,7 +17,7 @@ class TrustProxies extends Middleware
/**
* The headers that should be used to detect proxies.
*
* @var int
* @var integer
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

View file

@ -6,11 +6,10 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
* @var boolean
*/
protected $addHttpCookie = true;

View file

@ -12,7 +12,7 @@ class PrintRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -12,7 +12,7 @@ class MurRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -12,7 +12,7 @@ class StoreRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -12,7 +12,7 @@ class MursShowRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class CouponsResource extends JsonResource
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)

View file

@ -9,7 +9,7 @@ class CustomersResource extends JsonResource
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return StatusResource
*/
public function toArray($request)

View file

@ -9,7 +9,7 @@ class StatusResource extends JsonResource
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
public $timestamps = false;
/**
@ -24,8 +23,8 @@ class Log extends Model
const CREATED_AT = 'created_at';
/**
* @var array
*/
* @var array
*/
protected $fillable = [
'log_action',
'log_refsite',

View file

@ -5,7 +5,6 @@ namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class AlertBr extends Mailable
{
@ -26,9 +25,9 @@ class AlertBr extends Mailable
*/
public function __construct($couponSeuil, $couponDiffusion, $sitename)
{
$this->couponSeuil = $couponSeuil;
$this->couponSeuil = $couponSeuil;
$this->couponDiffusion = $couponDiffusion;
$this->subject = 'Notification mes BR : ' . $sitename;
$this->subject = 'Notification mes BR : ' . $sitename;
}
/**

View file

@ -5,7 +5,6 @@ namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class AlertBrAdmin extends Mailable
{
@ -26,9 +25,9 @@ class AlertBrAdmin extends Mailable
*/
public function __construct($couponSeuil, $couponDiffusion)
{
$this->couponSeuil = $couponSeuil;
$this->couponSeuil = $couponSeuil;
$this->couponDiffusion = $couponDiffusion;
$this->subject = 'Notification mes BR : Récapitulatif global';
$this->subject = 'Notification mes BR : Récapitulatif global';
}
/**

View file

@ -6,8 +6,8 @@ use Illuminate\Database\Eloquent\Model;
class Customers extends Model
{
protected $primaryKey = 'hashcode';
protected $keyType = 'string';
protected $fillable = ['hashcode', 'email', 'country'];
@ -34,7 +34,8 @@ class Customers extends Model
return 442;
break;
default:
return 250; //France
return 250;
// France
}
}
}

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Mouvement extends Model
{
/**
* @var string
*/

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Mur extends Model
{
/**
* @var string
*/
@ -18,7 +17,7 @@ class Mur extends Model
protected $primaryKey = 'mur_id';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
/**
* @var string
*/
@ -18,7 +17,7 @@ class Notification extends Model
protected $primaryKey = 'notif_id';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;

View file

@ -3,8 +3,6 @@
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
@ -16,7 +14,7 @@ class ResetPassword extends ResetPasswordNotification
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
@ -27,7 +25,7 @@ class ResetPassword extends ResetPasswordNotification
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
@ -42,13 +40,12 @@ class ResetPassword extends ResetPasswordNotification
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
];
}
}

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Panier extends Model
{
/**
* @var string
*/
@ -18,11 +17,11 @@ class Panier extends Model
protected $primaryKey = 'panier_id';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;
//protected $with = ['panierContents'];
// protected $with = ['panierContents'];
/**
* OneToMany
* Panier -> PanierContent

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class PanierContent extends Model
{
/**
* @var string
*/
@ -18,7 +17,7 @@ class PanierContent extends Model
protected $primaryKey = 'panier_content_id';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;

View file

@ -28,6 +28,5 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
}
}

View file

@ -2,12 +2,10 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
@ -25,7 +23,5 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -2,14 +2,12 @@
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
@ -29,7 +27,5 @@ class EventServiceProvider extends ServiceProvider
public function boot()
{
parent::boot();
//
}
}

View file

@ -7,7 +7,6 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvi
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
@ -24,7 +23,6 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot()
{
//
parent::boot();
}
@ -39,8 +37,6 @@ class RouteServiceProvider extends ServiceProvider
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Site extends Model
{
/**
* @var string
*/
@ -23,7 +22,7 @@ class Site extends Model
protected $keyType = 'string';
/**
* @var bool
* @var boolean
*/
public $timestamps = false;
@ -59,9 +58,9 @@ class Site extends Model
}
/**
* OneToMany
* Site -> Coupon
*/
* OneToMany
* Site -> Coupon
*/
public function coupons()
{
return $this->hasMany('App\Coupon', 'coupon_siteId', 'id');

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Statistique extends Model
{
public $timestamps = false;
/**
@ -24,8 +23,8 @@ class Statistique extends Model
const CREATED_AT = 'created_at';
/**
* @var array
*/
* @var array
*/
protected $fillable = [
'stat_campId',
'stat_couponId',

View file

@ -9,14 +9,11 @@ use App\Calendrier;
use App\Models\Customers;
use App\Models\PrintedWalls;
use App\Mur;
use App\Statistique;
use App\Panier;
use App\PanierContent;
use DateTime;
trait CouponTrait
{
public function getCouponsPublished(Campagne $campagne)
{
$coupons = $campagne->coupons()->get();
@ -54,7 +51,7 @@ trait CouponTrait
$coupons->forget($key);
}
}
}
}//end foreach
return $coupons;
}
@ -95,7 +92,7 @@ trait CouponTrait
$panierContents->forget($key);
}
}
}
}//end foreach
return $panierContents;
}
@ -137,7 +134,7 @@ trait CouponTrait
$panierContents->forget($key);
}
}
}
}//end foreach
$count = 0;
@ -267,7 +264,7 @@ trait CouponTrait
public function getFullQuantity(Coupon $coupon)
{
$mouvements = $coupon->mouvements()->get();
$nombre = array();
$nombre = array();
foreach ($mouvements as $mouvement) {
array_push($nombre, $mouvement->mouvement_nombre);
}
@ -277,14 +274,16 @@ trait CouponTrait
public function getUsedQuantity(Coupon $coupon)
{
$countPrinted = 0;
$couponId = $coupon->coupon_id;
$campagnes = $coupon->campagnes()->get();
$couponId = $coupon->coupon_id;
$campagnes = $coupon->campagnes()->get();
foreach ($campagnes as $campagne) {
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { // Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->get();
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) {
// Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->get();
$countPrinted = $countPrinted + count($murs);
} else { // Paniers
$campagneId = $campagne->camp_id;
} else {
// Paniers
$campagneId = $campagne->camp_id;
$countPrinted = PanierContent::where('panier_content_couponId', $couponId)->whereHas('panier', function ($query) use ($campagneId) {
$query->where('panier_campId', $campagneId);
})->sum('panier_content_printed');
@ -296,20 +295,22 @@ trait CouponTrait
public function getDiffusedQuantity(Coupon $coupon)
{
$countPrinted = 0;
$couponId = $coupon->coupon_id;
$campagnes = $coupon->campagnes()->get();
$couponId = $coupon->coupon_id;
$campagnes = $coupon->campagnes()->get();
foreach ($campagnes as $campagne) {
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { // Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->get();
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) {
// Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->get();
$countPrinted = $countPrinted + count($murs);
} else { // Paniers
$campagneId = $campagne->camp_id;
$panierContents = PanierContent::where('panier_content_couponId', $couponId)->whereHas('panier', function ($query) use ($campagneId) {
} else {
// Paniers
$campagneId = $campagne->camp_id;
$panierContents = PanierContent::where('panier_content_couponId', $couponId)->whereHas('panier', function ($query) use ($campagneId) {
$query->where('panier_campId', $campagneId);
})->get();
$panierContentCountPrinted = $panierContents->sum('panier_content_printed');
$panierContentCountPrinted = $panierContents->sum('panier_content_printed');
$panierContentCountDiffused = $panierContents->sum('panier_content_quantity');
$countPrinted = $countPrinted + $panierContentCountPrinted + $panierContentCountDiffused;
$countPrinted = $countPrinted + $panierContentCountPrinted + $panierContentCountDiffused;
}
}
return $countPrinted;
@ -318,21 +319,23 @@ trait CouponTrait
public function getUsedQuantityOnPeriod(Coupon $coupon, $startdate, $enddate)
{
$countPrinted = 0;
$startdate = date('Y-m-d H:i:s', strtotime($startdate));
$enddate = date('Y-m-d H:i:s', strtotime($enddate));
$campagnes = $coupon->campagnes()->get();
$startdate = date('Y-m-d H:i:s', strtotime($startdate));
$enddate = date('Y-m-d H:i:s', strtotime($enddate));
$campagnes = $coupon->campagnes()->get();
foreach ($campagnes as $campagne) {
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) { // Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->whereBetween('mur_createdate', [$startdate, $enddate])->get();
if ($campagne->camp_type == 0 || $campagne->camp_type == 2) {
// Murs
$murs = Mur::where(['mur_campid' => $campagne->camp_id, 'mur_couponId' => $coupon->coupon_id])->whereBetween('mur_createdate', [$startdate, $enddate])->get();
$countPrinted = $countPrinted + count($murs);
} else { // Paniers
} else {
// Paniers
$paniers = Panier::where(['panier_campId' => $campagne->camp_id])->where(function ($query) use ($startdate, $enddate) {
$query->whereBetween('panier_createdate', [$startdate, $enddate])
->orWhereBetween('panier_updatedate', [$startdate, $enddate]);
})->get();
foreach ($paniers as $key => $panier) {
$panierContentCount = $panier->panierContents->sum('panier_content_printed');
$countPrinted = $countPrinted + $panierContentCount;
$countPrinted = $countPrinted + $panierContentCount;
}
}
}

View file

@ -3,15 +3,12 @@
namespace App\Traits;
use App\Models\Customers;
use Picqer\Barcode\BarcodeGenerator;
use Picqer\Barcode\BarcodeGeneratorPNG;
use Illuminate\Http\Request;
use App\Coupon;
use App\Site;
trait GenerateBR
{
public function generateBase(Request $request, Coupon $coupon)
{
putenv('GDFONTPATH=' . public_path() . '/generation/src/');
@ -31,24 +28,24 @@ trait GenerateBR
$product_image = $coupon->coupon_decoration_image;
// ---- Masque dans lequel l'image finale sera placée
$mask = imagecreatefrompng($mask_img);
$mask = imagecreatefrompng($mask_img);
list($maskWidth, $maskHeight) = getimagesize($mask_img);
// ---- Contact distributeur
$text = $coupon->coupon_site_contact;
if (strlen($text) < 30) {
$ImageFond = imagecreate(165, 27);
$box1 = imagettfbbox(8, 0, $arial, $text);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(8, 0, $arial, $text);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$this->imagettftextSp($ImageFond, 8, 0, 5, 23, $black, $arial, $text, 0.01);
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 743, 365, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
} else {
$ImageFond = imagecreate(195, 27);
$box1 = imagettfbbox(7, 0, $arial, $text);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(7, 0, $arial, $text);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$this->imagettftextSp($ImageFond, 7, 0, 5, 23, $black, $arial, $text, 0);
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 713, 365, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
@ -57,20 +54,20 @@ trait GenerateBR
// ----- Mentions légales + RCS
if ($coupon->coupon_legal_mentions_splitted == 0) {
$txt_mentions = $coupon->coupon_legal_mentions . " " . $coupon->coupon_rcs;
$txt_mentions = $coupon->coupon_legal_mentions . " " . $coupon->coupon_rcs;
$ImageMentionFond = imagecreate(415, 100);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$lines_mentions = explode("\r\n", $txt_mentions);
$y = 19;
$y = 19;
foreach ($lines_mentions as $line) {
$this->imagettftextSp($ImageMentionFond, 7, 0, 15, $y, $black, $arial, $line, 0.01);
$y = $y + 9;
}
//imagecolortransparent($ImageMentionFond, $white);
// imagecolortransparent($ImageMentionFond, $white);
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
}
@ -82,13 +79,13 @@ trait GenerateBR
// ---- Inscription du montant du BR
$textMontant = number_format($coupon->coupon_value, 2, ",", " ");
$textEuro = "€";
$libReduc = "DE RÉDUCTION IMMÉDIATE";
$ImageFond = imagecreate(265, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$blue = imagecolorallocate($ImageFond, 8, 169, 223);
$grey = imagecolorallocate($ImageFond, 219, 219, 221);
$textEuro = "€";
$libReduc = "DE RÉDUCTION IMMÉDIATE";
$ImageFond = imagecreate(265, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$blue = imagecolorallocate($ImageFond, 8, 169, 223);
$grey = imagecolorallocate($ImageFond, 219, 219, 221);
$this->imagettftext_contour($ImageFond, 95, 0, 5, 110, $grey, $impact, $textMontant, $blue, 3, 3, 3, 3);
$this->imagettftext_contour($ImageFond, 50, 0, 220, 55, $grey, $arial, $textEuro, $blue, 2, 2, 2, 2);
$this->imagettftext_contour($ImageFond, 16, 0, 0, 150, $grey, $impact, $libReduc, $blue, 1, 1, 1, 1);
@ -96,9 +93,9 @@ trait GenerateBR
imagecopy($mask, $ImageFond, 360, 10, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
// ---- Inscription filigramme
$txt_filigramme = strtoupper($site->site_libelle) . " " . number_format($coupon->coupon_value, 2, ",", " ") . "€";
$txt_filigramme = strtoupper($site->site_libelle) . " " . number_format($coupon->coupon_value, 2, ",", " ") . "€";
$line_filigramme = "";
$textFili = "";
$textFili = "";
for ($i = 0; $i < 11; $i++) {
$line_filigramme .= $txt_filigramme . " ";
}
@ -108,15 +105,15 @@ trait GenerateBR
$textFili .= $line_filigramme;
}
$textFiliLines = explode("\r\n", $textFili);
$ImageFond = imagecreate(402, 240);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$blackOpac = imagecolorallocatealpha($ImageFond, 0, 0, 0, 20);
$y = 0;
$ImageFond = imagecreate(402, 240);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$blackOpac = imagecolorallocatealpha($ImageFond, 0, 0, 0, 20);
$y = 0;
foreach ($textFiliLines as $textFiliLine) {
$y = $y + 20;
$this->imagettftextSp($ImageFond, 11, 25, -100, $y, $black, $arial, $textFiliLine, 0.01);
}
//imagettftext($ImageFond , 11 , 25, -100, 11, $blackOpac, $arial, $textReduc);
// imagettftext($ImageFond , 11 , 25, -100, 11, $blackOpac, $arial, $textReduc);
imagecolortransparent($ImageFond, $white);
imagecopymerge($mask, $ImageFond, 349, 1, 0, 0, imagesx($ImageFond), imagesy($ImageFond), 30);
@ -124,11 +121,11 @@ trait GenerateBR
$textReduc = $coupon->coupon_validity_text;
if (strlen($textReduc) < 100) {
$ImageFond = imagecreate(387, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 14;
$y = 14;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond, 12, 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y = $y + 18;
@ -137,11 +134,11 @@ trait GenerateBR
imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
} elseif (strlen($textReduc) > 200) {
$ImageFond = imagecreate(387, 205);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 10;
$y = 10;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond, 9, 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y = $y + 12;
@ -150,21 +147,19 @@ trait GenerateBR
imagecopy($mask, $ImageFond, 360, 165, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
} else {
$ImageFond = imagecreate(387, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 14;
$y = 14;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond, 10, 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y = $y + 12;
}
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
}
//imagettftext($ImageFond , 12 , 0, 0, 14, $black, $arialbd, $textReduc);
}//end if
// imagettftext($ImageFond , 12 , 0, 0, 14, $black, $arialbd, $textReduc);
// ---- Copie le produit dans le mask
$size = getimagesize($product_image);
switch ($size['mime']) {
@ -181,7 +176,6 @@ trait GenerateBR
// ---- Copie le logo dans le mask
$size_logo = getimagesize($logo_display);
switch ($size_logo['mime']) {
case 'image/jpeg':
@ -214,11 +208,11 @@ trait GenerateBR
} else {
$temp_x = $x;
$temp_y = $y;
//to avoid special char problems
// to avoid special char problems
$char_array = preg_split('//u', $text, -1, PREG_SPLIT_NO_EMPTY);
foreach ($char_array as $char) {
imagefttext($image, $size, $angle, $temp_x, $temp_y, $color, $font, $char);
$bbox = imagettfbbox($size, 0, $font, $char);
$bbox = imagettfbbox($size, 0, $font, $char);
$temp_x += cos(deg2rad($angle)) * ($spacing + ($bbox[2] - $bbox[0]));
$temp_y -= sin(deg2rad($angle)) * ($spacing + ($bbox[2] - $bbox[0]));
}
@ -250,8 +244,8 @@ trait GenerateBR
public function printCp($coupon, $contact)
{
$arial = public_path() . '/build/assets/fonts/coupons/arial.ttf';
$arialbd = public_path() . '/build/assets/fonts/coupons/arialbd.ttf';
$arial = public_path() . '/build/assets/fonts/coupons/arial.ttf';
$arialbd = public_path() . '/build/assets/fonts/coupons/arialbd.ttf';
// ---- Masque dans lequel l'image finale sera placée
$mask = imagecreatefrompng($coupon->coupon_image);
@ -262,49 +256,49 @@ trait GenerateBR
if ($coupon->coupon_legal_mentions_splitted == 1) {
$legalMentions = explode('<nl>', $coupon->coupon_legal_mentions);
if (($coupon->coupon_norme == 1 && strlen($contact->contact_cp) == 4) || $coupon->coupon_code == '5425003942648' || $coupon->coupon_code == '5425003941641') {
//BELGE
$txt_mentions = $legalMentions[0] . "\n\r" . $legalMentions[1] . " " . $coupon->coupon_rcs;
// BELGE
$txt_mentions = $legalMentions[0] . "\n\r" . $legalMentions[1] . " " . $coupon->coupon_rcs;
$ImageMentionFond = imagecreate(420, 145);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$lines_mentions = explode("\r\n", $txt_mentions);
$y = 19;
$y = 19;
foreach ($lines_mentions as $line) {
$this->imagettftextSp($ImageMentionFond, 7, 0, 15, $y, $black, $arial, $line, 0.01);
$y = $y + 9;
}
//imagecolortransparent($ImageMentionFond, $white);
// imagecolortransparent($ImageMentionFond, $white);
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
} else {
//FR
$txt_mentions = $legalMentions[0] . " " . $coupon->coupon_rcs;
// FR
$txt_mentions = $legalMentions[0] . " " . $coupon->coupon_rcs;
$ImageMentionFond = imagecreate(415, 100);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$lines_mentions = explode("\r\n", $txt_mentions);
$y = 19;
$y = 19;
foreach ($lines_mentions as $line) {
$this->imagettftextSp($ImageMentionFond, 7, 0, 15, $y, $black, $arial, $line, 0.01);
$y = $y + 9;
}
//imagecolortransparent($ImageMentionFond, $white);
// imagecolortransparent($ImageMentionFond, $white);
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
}
}
}//end if
}//end if
// ---- Inscription de l'utilisateur et de la ville
$libelle = "OFFRE RÉSERVÉE À";
$user = $contact->contact_prenom . " " . $contact->contact_nom . "\r\n" . $contact->contact_cp . " " . $contact->contact_ville;
$libelle = "OFFRE RÉSERVÉE À";
$user = $contact->contact_prenom . " " . $contact->contact_nom . "\r\n" . $contact->contact_cp . " " . $contact->contact_ville;
$ImageFond = imagecreate(120, 40);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(8, 0, $arial, $user);
$box2 = imagettfbbox(8, 0, $arial, $libelle);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(8, 0, $arial, $user);
$box2 = imagettfbbox(8, 0, $arial, $libelle);
imagettftext($ImageFond, 8, 0, (120 / 2) - (abs($box2[4]) - abs($box2[6])) / 2, 10, $black, $arialbd, $libelle);
imagettftext($ImageFond, 8, 0, (120 / 2) - (abs($box1[4]) - abs($box1[6])) / 2, 25, $black, $arial, $user);
imagecolortransparent($ImageFond, $white);
@ -316,12 +310,13 @@ trait GenerateBR
if ($coupon->coupon_validity != 0) {
$dateValidite = date('d/m/Y', strtotime("+" . $coupon->coupon_validity . " day"));
} else {
$dateValidite = date('d/m/Y', strtotime("+30 day")); // 30 jours par défaut
$dateValidite = date('d/m/Y', strtotime("+30 day"));
// 30 jours par défaut
}
$ImageFond = imagecreate(120, 40);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 8, 0, 1, 8, $black, $arialbd, $libelle);
imagettftext($ImageFond, 8, 0, 20, 23, $black, $arial, $dateValidite);
imagecolortransparent($ImageFond, $white);
@ -337,8 +332,8 @@ trait GenerateBR
}
$ImageFond = imagecreate(270, 20);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 9, 0, 0, 10, $black, $arialbd, $textReduc);
if (($coupon->coupon_norme == 1 && strlen($contact->contact_cp) == 4) || $coupon->coupon_code == '5425003942648' || $coupon->coupon_code == '5425003941641') {
imagecopy($mask, $ImageFond, 70, 230, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
@ -351,37 +346,37 @@ trait GenerateBR
$codeBarre = imagecreatefromjpeg($coupon->coupon_gs1code);
imageresolution($codeBarre, 72);
list($width, $height) = getimagesize($coupon->coupon_gs1code);
$r = $width / $height;
$w = 285;
$h = 150;
$r = $width / $height;
$w = 285;
$h = 150;
if ($w / $h > $r) {
$newwidth = $h * $r;
$newwidth = $h * $r;
$newheight = $h;
} else {
$newheight = $w / $r;
$newwidth = $w;
$newwidth = $w;
}
$test = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($test, $codeBarre, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagecopy($mask, $test, 60, 250, 0, 0, imagesx($test), imagesy($test));
} else {
$codeBarre = $coupon->coupon_code . strtoupper($contact->contact_ref);
$codeBarre = $coupon->coupon_code . strtoupper($contact->contact_ref);
$codeBarrePrint = $codeBarre;
if (strpos($contact->contact_ref, "@") !== false) {
$codeBarre = $coupon->coupon_code . strtolower($contact->contact_ref);
$codeBarre = $coupon->coupon_code . strtolower($contact->contact_ref);
$codeBarrePrint = $coupon->coupon_code . ".@.";
}
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$base64 = $generator->getBarcode($codeBarrePrint, $generator::TYPE_CODE_128_A, 2, 46);
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$base64 = $generator->getBarcode($codeBarrePrint, $generator::TYPE_CODE_128_A, 2, 46);
$barcodeImage = imagecreatefromstring($base64);
imagecopy($mask, $barcodeImage, 52, 342, 0, 0, imagesx($barcodeImage), imagesy($barcodeImage));
$ImageFond = imagecreate(380, 15);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$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));
}
}//end if
ob_start();
imagejpeg($mask, null, 100);
@ -398,8 +393,8 @@ trait GenerateBR
// VB 22/04/2021
public function printCoupon(Coupon $coupon, Customers $customer, $crmInfos)
{
$arial = public_path() . '/build/assets/fonts/coupons/arial.ttf';
$arialbd = public_path() . '/build/assets/fonts/coupons/arialbd.ttf';
$arial = public_path() . '/build/assets/fonts/coupons/arial.ttf';
$arialbd = public_path() . '/build/assets/fonts/coupons/arialbd.ttf';
// ---- Masque dans lequel l'image finale sera placée
$mask = imagecreatefrompng($coupon->coupon_image);
@ -410,49 +405,49 @@ trait GenerateBR
if ($coupon->coupon_legal_mentions_splitted == 1) {
$legalMentions = explode('<nl>', $coupon->coupon_legal_mentions);
if ($customer->country !== 250) {
//BELGIQUE - Luxembourg
$txt_mentions = $legalMentions[0] . "\n\r" . $legalMentions[1] . " " . $coupon->coupon_rcs;
// BELGIQUE - Luxembourg
$txt_mentions = $legalMentions[0] . "\n\r" . $legalMentions[1] . " " . $coupon->coupon_rcs;
$ImageMentionFond = imagecreate(420, 145);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$lines_mentions = explode("\r\n", $txt_mentions);
$y = 19;
$y = 19;
foreach ($lines_mentions as $line) {
$this->imagettftextSp($ImageMentionFond, 7, 0, 15, $y, $black, $arial, $line, 0.01);
$y = $y + 9;
}
//imagecolortransparent($ImageMentionFond, $white);
// imagecolortransparent($ImageMentionFond, $white);
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
} else {
//FR
$txt_mentions = $legalMentions[0] . " " . $coupon->coupon_rcs;
// FR
$txt_mentions = $legalMentions[0] . " " . $coupon->coupon_rcs;
$ImageMentionFond = imagecreate(415, 100);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
$lines_mentions = explode("\r\n", $txt_mentions);
$y = 19;
$y = 19;
foreach ($lines_mentions as $line) {
$this->imagettftextSp($ImageMentionFond, 7, 0, 15, $y, $black, $arial, $line, 0.01);
$y = $y + 9;
}
//imagecolortransparent($ImageMentionFond, $white);
// imagecolortransparent($ImageMentionFond, $white);
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
}
}
}//end if
}//end if
// ---- Inscription de l'utilisateur et de la ville
$libelle = "OFFRE RÉSERVÉE À";
$user = $crmInfos->firstname . " " . $crmInfos->lastname . "\r\n" . $crmInfos->postcode . " " . $crmInfos->city;
$libelle = "OFFRE RÉSERVÉE À";
$user = $crmInfos->firstname . " " . $crmInfos->lastname . "\r\n" . $crmInfos->postcode . " " . $crmInfos->city;
$ImageFond = imagecreate(120, 40);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(8, 0, $arial, $user);
$box2 = imagettfbbox(8, 0, $arial, $libelle);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$box1 = imagettfbbox(8, 0, $arial, $user);
$box2 = imagettfbbox(8, 0, $arial, $libelle);
imagettftext($ImageFond, 8, 0, (120 / 2) - (abs($box2[4]) - abs($box2[6])) / 2, 10, $black, $arialbd, $libelle);
imagettftext($ImageFond, 8, 0, (120 / 2) - (abs($box1[4]) - abs($box1[6])) / 2, 25, $black, $arial, $user);
imagecolortransparent($ImageFond, $white);
@ -464,12 +459,13 @@ trait GenerateBR
if ($coupon->coupon_validity != 0) {
$dateValidite = date('d/m/Y', strtotime("+" . $coupon->coupon_validity . " day"));
} else {
$dateValidite = date('d/m/Y', strtotime("+30 day")); // 30 jours par défaut
$dateValidite = date('d/m/Y', strtotime("+30 day"));
// 30 jours par défaut
}
$ImageFond = imagecreate(120, 40);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 8, 0, 1, 8, $black, $arialbd, $libelle);
imagettftext($ImageFond, 8, 0, 20, 23, $black, $arial, $dateValidite);
imagecolortransparent($ImageFond, $white);
@ -485,8 +481,8 @@ trait GenerateBR
}
$ImageFond = imagecreate(270, 20);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
imagettftext($ImageFond, 9, 0, 0, 10, $black, $arialbd, $textReduc);
if ($customer->country !== 250) {
imagecopy($mask, $ImageFond, 70, 230, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
@ -499,37 +495,37 @@ trait GenerateBR
$codeBarre = imagecreatefromjpeg($coupon->coupon_gs1code);
imageresolution($codeBarre, 72);
list($width, $height) = getimagesize($coupon->coupon_gs1code);
$r = $width / $height;
$w = 285;
$h = 150;
$r = $width / $height;
$w = 285;
$h = 150;
if ($w / $h > $r) {
$newwidth = $h * $r;
$newwidth = $h * $r;
$newheight = $h;
} else {
$newheight = $w / $r;
$newwidth = $w;
$newwidth = $w;
}
$test = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($test, $codeBarre, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagecopy($mask, $test, 60, 250, 0, 0, imagesx($test), imagesy($test));
} else {
$codeBarre = $coupon->coupon_code . strtoupper($customer->crm_id);
$codeBarre = $coupon->coupon_code . strtoupper($customer->crm_id);
$codeBarrePrint = $codeBarre;
if (strpos($customer->crm_id, "@") !== false) {
$codeBarre = $coupon->coupon_code . strtolower($customer->crm_id);
$codeBarre = $coupon->coupon_code . strtolower($customer->crm_id);
$codeBarrePrint = $coupon->coupon_code . ".@.";
}
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$base64 = $generator->getBarcode($codeBarrePrint, $generator::TYPE_CODE_128_A, 2, 46);
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$base64 = $generator->getBarcode($codeBarrePrint, $generator::TYPE_CODE_128_A, 2, 46);
$barcodeImage = imagecreatefromstring($base64);
imagecopy($mask, $barcodeImage, 52, 342, 0, 0, imagesx($barcodeImage), imagesy($barcodeImage));
$ImageFond = imagecreate(380, 15);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$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));
}
}//end if
ob_start();
imagejpeg($mask, null, 100);

View file

@ -2,26 +2,19 @@
namespace App\Traits;
use App\Campagne;
use App\Coupon;
use App\Contact;
use App\Calendrier;
use App\Mur;
use App\Statistique;
use App\Panier;
use DateTime;
trait GraphTrait
{
// ------ Make Labels
public function getLabelsForStats($startdate, $enddate)
{
// ---- Calcul de l'intervalle en jour
$datetime1 = new DateTime($startdate);
$datetime2 = new DateTime($enddate);
$interval = $datetime1->diff($datetime2);
$days = $interval->format('%a');
$interval = $datetime1->diff($datetime2);
$days = $interval->format('%a');
// ---- Labels des graphiques
$labels = [];

View file

@ -2,12 +2,10 @@
namespace App\Traits;
use App\Campagne;
use Illuminate\Http\Request;
trait ThanksTrait
{
public function getThanks(Request $request)
{
if ($request->session()->has('campagne')) {

View file

@ -3,7 +3,6 @@
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Notifications\ResetPassword;
@ -27,8 +26,8 @@ class User extends Authenticatable
protected $table = 'users';
/**
* @var string
*/
* @var string
*/
protected $primaryKey = 'id';
/**

View file

@ -3,105 +3,105 @@
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Mes BR'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'local'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'https://mesbr.test'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Paris',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
@ -109,14 +109,14 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
@ -164,14 +164,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [

View file

@ -3,14 +3,14 @@
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
@ -19,20 +19,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
@ -48,20 +48,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
@ -71,24 +71,24 @@ return [
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [

View file

@ -5,29 +5,29 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
@ -78,14 +78,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),

View file

@ -3,32 +3,32 @@
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
@ -81,27 +81,27 @@ return [
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [

View file

@ -3,199 +3,233 @@
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
//
],
],
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
'driver' => 'file',
// redis, file, pdo, custom
'path' => storage_path('debugbar'),
// For file driver
'connection' => null,
// Leave null for default connection (Redis/PDO)
'provider' => ''
// Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'phpinfo' => true,
// Php version
'messages' => true,
// Messages
'time' => true,
// Time Datalogger
'memory' => true,
// Memory usage
'exceptions' => true,
// Exception displayer
'log' => true,
// Logs from Monolog (merged in messages if enabled)
'db' => true,
// Show database (PDO) queries and bindings
'views' => true,
// Views with their data
'route' => true,
// Current route information
'auth' => true,
// Display Laravel authentication status
'gate' => true,
// Display Laravel Gate checks
'session' => true,
// Display session data
'symfony_request' => true,
// Only one can be enabled..
'mail' => true,
// Catch mail messages
'laravel' => false,
// Laravel version and environment
'events' => false,
// All events fired
'default_request' => false,
// Regular or special Symfony request logger
'logs' => false,
// Add the latest log messages
'files' => false,
// Show the included files
'config' => false,
// Display config settings
'cache' => false,
// Display cache events
],
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => [
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
'show_name' => true,
// Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'with_params' => true,
// Render SQL with the parameters substituted
'backtrace' => true,
// Use a backtrace to find the origin of the query in your files.
'timeline' => false,
// Add the queries to the timeline
'explain' => [
// Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
'types' => ['SELECT'],
// ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
'hints' => true,
// Show hints for common mistakes
],
'mail' => [
'full_log' => false
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
'data' => false,
// Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true // show complete route on bar
'label' => true
// show complete route on bar
],
'logs' => [
'file' => null
],
'cache' => [
'values' => true // collect cache values
'values' => true
// collect cache values
],
],
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
];

View file

@ -3,15 +3,16 @@
return array(
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'show_warnings' => false,
// Throw an Exception on warnings from dompdf
'orientation' => 'portrait',
'defines' => array(
/**
@ -38,7 +39,8 @@ return array(
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
"font_dir" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
"font_dir" => storage_path('fonts/'),
// advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
@ -120,7 +122,7 @@ return array(
* If pdflib present in web server and auto or selected explicitely above,
* a real license code must exist!
*/
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
// "DOMPDF_PDFLIB_LICENSE" => "your license key here",
/**
* html target media view which should be rendered into pdf.
@ -238,7 +240,8 @@ return array(
* Use the more-than-experimental HTML5 Lib parser
*/
"enable_html5_parser" => false,
"DOMPDF_TEMP_DIR" => storage_path('logs/'),//I need this
"DOMPDF_TEMP_DIR" => storage_path('logs/'),
// I need this
"DOMPDF_LOG_OUTPUT_FILE" => storage_path('logs/log.htm'),
),

View file

@ -3,42 +3,42 @@
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
@ -33,14 +33,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [

View file

@ -6,31 +6,31 @@ use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [

View file

@ -3,56 +3,56 @@
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
@ -61,27 +61,27 @@ return [
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', ''),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
@ -89,27 +89,27 @@ return [
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
@ -68,14 +68,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [

View file

@ -3,15 +3,15 @@
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [

View file

@ -5,30 +5,30 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
@ -36,92 +36,92 @@ return [
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
@ -130,68 +130,68 @@ return [
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', null),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,

View file

@ -3,14 +3,14 @@
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
@ -18,14 +18,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),

View file

@ -4,6 +4,5 @@ use Faker\Generator as Faker;
$factory->define(App\Statistique::class, function (Faker $faker) {
return [
//
];
];
});

View file

@ -3,14 +3,14 @@
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
@ -18,7 +18,8 @@ $factory->define(App\User::class, function (Faker $faker) {
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm',
// secret
'remember_token' => str_random(10),
];
});

View file

@ -1,16 +1,14 @@
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::prefix('v1')

View file

@ -1,14 +1,14 @@
<?php
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.User.{id}', function ($user, $id) {

View file

@ -3,14 +3,14 @@
use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {

View file

@ -1,16 +1,14 @@
<?php
use App\Http\Middleware\ProcessSpecificUrl;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// ---- Routes de l'authentification sans la partie inscription
@ -103,5 +101,5 @@ Route::any('/index', 'AjaxController@backToIndex');
Route::any('/', "RedirectController");
// ---- Routes spécifiques : API
// Route::any('/{param?}', function ($param = null) {
// return;
// return;
// })->middleware(ProcessSpecificUrl::class);

View file

@ -3,7 +3,6 @@
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{

View file

@ -3,7 +3,6 @@
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{