- Squash migration
- Normalize Model names and sql tables - PHPCS clean up - Change analytics form + field
This commit is contained in:
parent
436935af5a
commit
1af96897f3
89 changed files with 631 additions and 764 deletions
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class CreateAdmin extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
|
|
@ -23,20 +22,10 @@ class CreateAdmin extends Command
|
|||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
|
@ -62,5 +51,7 @@ class CreateAdmin extends Command
|
|||
$user->save();
|
||||
|
||||
$this->info('User created.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DeleteNotConfirmedUser extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
|
|
@ -23,20 +22,10 @@ class DeleteNotConfirmedUser extends Command
|
|||
*/
|
||||
protected $description = 'Remove users who have not confirmed their accounts within 24 hours of registration';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
|
@ -44,5 +33,7 @@ class DeleteNotConfirmedUser extends Command
|
|||
foreach ($users as $user) {
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\ExportCodesUniques as MailExportCodesUniques;
|
||||
use App\Models\Codes;
|
||||
use App\Models\Code;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class ExportCodesUniques extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
|
|
@ -25,38 +24,31 @@ class ExportCodesUniques extends Command
|
|||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$nbCodeTot = $this->ask("Combien de code doivent être exporté ?"); // Nombre total de code à exporter
|
||||
// Nombre total de code à exporter.
|
||||
$nbCodeTot = $this->ask("Combien de code doivent être exporté ?");
|
||||
while (empty(intval($nbCodeTot)) || !is_int(intval($nbCodeTot))) {
|
||||
$this->info("Valeur incorrect, veuillez entrer un nombre entier.");
|
||||
$nbCodeTot = $this->ask("Veuillez entrer une nouvelle valeur");
|
||||
}
|
||||
$nbCodeTot = intval($nbCodeTot);
|
||||
|
||||
$nbCodeFic = $this->ask("Combien de code par fichier ?"); // Nombre de code par fichier
|
||||
// Nombre de code par fichier.
|
||||
$nbCodeFic = $this->ask("Combien de code par fichier ?");
|
||||
while (empty(intval($nbCodeFic)) || !is_int(intval($nbCodeFic))) {
|
||||
$this->info("Valeur incorrect, veuillez entrer un nombre entier.");
|
||||
$nbCodeFic = $this->ask("Veuillez entrer une nouvelle valeur");
|
||||
}
|
||||
$nbCodeFic = intval($nbCodeFic);
|
||||
|
||||
$nbCodeLigne = $this->ask("Combien de code par ligne dans un fichier ?"); // Nombre de code par ligne
|
||||
// Nombre de code par ligne.
|
||||
$nbCodeLigne = $this->ask("Combien de code par ligne dans un fichier ?");
|
||||
while (empty(intval($nbCodeLigne)) || !is_int(intval($nbCodeLigne))) {
|
||||
$this->info("Valeur incorrect, veuillez entrer un nombre entier.");
|
||||
$nbCodeLigne = $this->ask("Veuillez entrer une nouvelle valeur");
|
||||
|
|
@ -70,13 +62,26 @@ class ExportCodesUniques extends Command
|
|||
|
||||
$this->info("Traitement en cours, veuillez patienter...");
|
||||
|
||||
$this->process($nbCodeFic, $nbCodeTot, $nbCodeLigne, $totalExportedCodes, $currentFilename, $currentExportedCodes, $currentLineCodes);
|
||||
$this->process(
|
||||
$nbCodeFic,
|
||||
$nbCodeTot,
|
||||
$nbCodeLigne,
|
||||
$totalExportedCodes,
|
||||
$currentFilename,
|
||||
$currentExportedCodes,
|
||||
$currentLineCodes
|
||||
);
|
||||
|
||||
$this->info("Fin du traitement, creation de l'archive...");
|
||||
|
||||
// Compression des fichiers
|
||||
// Compression des fichiers.
|
||||
$zip = new \ZipArchive();
|
||||
if ($zip->open(storage_path('export_codes_uniques/') . "CodesUniques_" . date('dmY') . ".zip", \ZipArchive::CREATE) === true) {
|
||||
if (
|
||||
$zip->open(
|
||||
storage_path('export_codes_uniques/') . "CodesUniques_" . date('dmY') . ".zip",
|
||||
\ZipArchive::CREATE
|
||||
) === true
|
||||
) {
|
||||
if ($handle = opendir(storage_path('export_codes_uniques/tmp'))) {
|
||||
while (false !== ($file_to_zip = readdir($handle))) {
|
||||
if (pathinfo($file_to_zip, PATHINFO_EXTENSION) != 'csv') {
|
||||
|
|
@ -89,7 +94,7 @@ class ExportCodesUniques extends Command
|
|||
$zip->close();
|
||||
}
|
||||
|
||||
// On vide le dossier temporaire des fichiers csv
|
||||
// On vide le dossier temporaire des fichiers csv.
|
||||
if ($handle = opendir(storage_path('export_codes_uniques/tmp'))) {
|
||||
while (false !== ($file_to_zip = readdir($handle))) {
|
||||
if (pathinfo($file_to_zip, PATHINFO_EXTENSION) != 'csv') {
|
||||
|
|
@ -102,8 +107,11 @@ class ExportCodesUniques extends Command
|
|||
|
||||
$this->info("L'archive CodesUniques_" . date('dmY') . ".zip a ete creer.");
|
||||
|
||||
// Envoi de mail à MAIL_ADMIN avec le nom du ZIP "CodesUniques_". date('dmY') .".zip"
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new MailExportCodesUniques(app(Settings::class)->name, $nbCodeFic, $nbCodeTot, $nbCodeLigne));
|
||||
// Envoi de mail à MAIL_ADMIN avec le nom du ZIP "CodesUniques_". date('dmY') .".zip" .
|
||||
Mail::to(config('mail.MAIL_ADMIN'))
|
||||
->send(new MailExportCodesUniques(app(Settings::class)->name, $nbCodeFic, $nbCodeTot, $nbCodeLigne));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function process($nbCodeFic, $nbCodeTot, $nbCodeLigne, $totalExportedCodes, $currentFilename, $currentExportedCodes, $currentLineCodes, $lastExportedCodeId = null)
|
||||
|
|
@ -121,9 +129,9 @@ class ExportCodesUniques extends Command
|
|||
}
|
||||
|
||||
if ($lastExportedCodeId === null) {
|
||||
$codes = Codes::where('code_exported', 0)->take($nbCodeToRetrieve)->get();
|
||||
$codes = Code::where('code_exported', 0)->take($nbCodeToRetrieve)->get();
|
||||
} else {
|
||||
$codes = Codes::where([
|
||||
$codes = Code::where([
|
||||
['code_exported', '=', 0],
|
||||
['id', '>', $lastExportedCodeId]
|
||||
])->take($nbCodeToRetrieve)->get();
|
||||
|
|
@ -136,12 +144,20 @@ class ExportCodesUniques extends Command
|
|||
foreach ($codes as $k => $code) {
|
||||
if ($currentExportedCodes < $nbCodeTot) {
|
||||
if ($currentLineCodes === ($nbCodeLigne === 1 ? 1 : $nbCodeLigne - 1)) {
|
||||
file_put_contents(storage_path('export_codes_uniques/tmp/') . $currentFilename . ".csv", $code->code_unique . PHP_EOL, FILE_APPEND);
|
||||
file_put_contents(
|
||||
storage_path('export_codes_uniques/tmp/') . $currentFilename . ".csv",
|
||||
$code->code_unique . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
$totalExportedCodes++;
|
||||
$currentExportedCodes++;
|
||||
$currentLineCodes = ($nbCodeLigne === 1 ? 1 : 0);
|
||||
} else {
|
||||
file_put_contents(storage_path('export_codes_uniques/tmp/') . $currentFilename . ".csv", $code->code_unique . ";", FILE_APPEND);
|
||||
file_put_contents(
|
||||
storage_path('export_codes_uniques/tmp/') . $currentFilename . ".csv",
|
||||
$code->code_unique . ";",
|
||||
FILE_APPEND
|
||||
);
|
||||
$totalExportedCodes++;
|
||||
$currentExportedCodes++;
|
||||
$currentLineCodes++;
|
||||
|
|
@ -155,13 +171,22 @@ class ExportCodesUniques extends Command
|
|||
$currentExportedCodes = 0;
|
||||
}
|
||||
if ((($k + 1) === $countCodes) && $totalExportedCodes < $nbCodeTot) {
|
||||
Codes::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
return $this->process($nbCodeFic, $nbCodeTot, $nbCodeLigne, $totalExportedCodes, $currentFilename, $currentExportedCodes, $currentLineCodes, $lastExportedCodeId);
|
||||
Code::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
return $this->process(
|
||||
$nbCodeFic,
|
||||
$nbCodeTot,
|
||||
$nbCodeLigne,
|
||||
$totalExportedCodes,
|
||||
$currentFilename,
|
||||
$currentExportedCodes,
|
||||
$currentLineCodes,
|
||||
$lastExportedCodeId
|
||||
);
|
||||
}
|
||||
if (($k + 1) === $countCodes) {
|
||||
Codes::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
Code::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
}//end foreach
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,25 +7,21 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
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)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\BannedIP;
|
||||
use App\Models\BannedIp;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BannedIPController extends Controller
|
||||
class BannedIpController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$ips = BannedIP::all();
|
||||
$ips = BannedIp::all();
|
||||
return view('bo.banned-ip.index', compact('ips'));
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ class BannedIPController extends Controller
|
|||
|
||||
for ($i = 0; $i < count($ips); $i++) {
|
||||
if (!empty($ips[$i]["ip"])) {
|
||||
$ip = BannedIP::updateOrCreate(['ip' => $ips[$i]["ip"]]);
|
||||
$ip = BannedIp::updateOrCreate(['ip' => $ips[$i]["ip"]]);
|
||||
} else {
|
||||
unset($ips[$i]);
|
||||
$i--;
|
||||
|
|
@ -32,7 +32,7 @@ class BannedIPController extends Controller
|
|||
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
$ip = BannedIP::where("ip", $request->ip);
|
||||
$ip = BannedIp::where("ip", $request->ip);
|
||||
$ip->delete();
|
||||
|
||||
return "Suppression terminée !";
|
||||
|
|
@ -8,7 +8,7 @@ use App\Http\Requests\ExportCodesRequest;
|
|||
use App\Http\Requests\GenerateCodesRequest;
|
||||
use App\Jobs\ProcessExportCodesUniques;
|
||||
use App\Jobs\ProcessUniqueCode;
|
||||
use App\Models\Codes;
|
||||
use App\Models\Code;
|
||||
use App\Models\Settings;
|
||||
use Kwaadpepper\Serial\Exceptions\SerialCasterException;
|
||||
|
||||
|
|
@ -22,10 +22,10 @@ class CodesController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$settings = app(Settings::class);
|
||||
$nbCodeBase = Codes::count();
|
||||
$nbCodeUsed = Codes::where('code_used', 1)->count();
|
||||
$nbCodeExported = Codes::where('code_exported', 1)->count();
|
||||
$nbCodeRemainingToExport = Codes::where('code_exported', 0)->count();
|
||||
$nbCodeBase = Code::count();
|
||||
$nbCodeUsed = Code::where('code_used', 1)->count();
|
||||
$nbCodeExported = Code::where('code_exported', 1)->count();
|
||||
$nbCodeRemainingToExport = Code::where('code_exported', 0)->count();
|
||||
return view('bo.codes.index', compact(
|
||||
'settings',
|
||||
'nbCodeBase',
|
||||
|
|
@ -86,7 +86,7 @@ class CodesController extends Controller
|
|||
{
|
||||
$code = null;
|
||||
try {
|
||||
$code = Codes::whereId(Codes::serialToInt($request->code))->first();
|
||||
$code = Code::whereId(Code::serialToInt($request->code))->first();
|
||||
} catch (\Throwable $e) {
|
||||
if (\get_class($e) === SerialCasterException::class) {
|
||||
$code = false;
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CodesEAN;
|
||||
use App\Models\CodeEan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CodesEANController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$ean = CodesEAN::all();
|
||||
$ean = CodeEan::all();
|
||||
return view('bo.codes-ean.index', compact('ean'));
|
||||
}
|
||||
|
||||
|
|
@ -21,13 +21,13 @@ class CodesEANController extends Controller
|
|||
for ($i = 0; $i < count($codes); $i++) {
|
||||
$codeToInsert = !empty($codes[$i]["code"]) && !empty($codes[$i]["product"]);
|
||||
if (isset($codes[$i]["id"]) && $codes[$i]["id"] !== null && $codeToInsert) {
|
||||
$c = CodesEAN::findOrFail($codes[$i]["id"]);
|
||||
$c = CodeEan::findOrFail($codes[$i]["id"]);
|
||||
$c->code = $codes[$i]["code"];
|
||||
$c->product = $codes[$i]["product"];
|
||||
$c->save();
|
||||
} else {
|
||||
if ($codeToInsert) {
|
||||
$c = CodesEAN::updateOrCreate(['code' => $codes[$i]["code"], 'product' => $codes[$i]["product"]]);
|
||||
$c = CodeEan::updateOrCreate(['code' => $codes[$i]["code"], 'product' => $codes[$i]["product"]]);
|
||||
$codes[$i]["id"] = $c->id;
|
||||
} else {
|
||||
unset($codes[$i]);
|
||||
|
|
@ -41,7 +41,7 @@ class CodesEANController extends Controller
|
|||
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
$code = CodesEAN::findOrFail($request->id);
|
||||
$code = CodeEan::findOrFail($request->id);
|
||||
$code->delete();
|
||||
|
||||
return "Suppression terminée !";
|
||||
|
|
|
|||
|
|
@ -12,18 +12,21 @@ class DashboardController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
// Pour les stats
|
||||
// Pour les stats.
|
||||
$settings = app(Settings::class);
|
||||
$participations = Participation::selectRaw("COUNT(*) AS count, DATE(created_at) AS date")->groupByRaw("DATE(created_at)")->get();
|
||||
$participationsUniquePerDay = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count, DATE(created_at) AS date")->groupByRaw("DATE(created_at), user")->get();
|
||||
$participations = Participation::selectRaw("COUNT(*) AS count, DATE(created_at) AS date")
|
||||
->groupByRaw("DATE(created_at)")->get();
|
||||
$participationsUniquePerDay = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count, DATE(created_at) AS date")
|
||||
->groupByRaw("DATE(created_at), user")->get();
|
||||
$statsUnique = [];
|
||||
foreach ($participationsUniquePerDay as $participationPerDay) {
|
||||
$dateUnique = Carbon::parse($participationPerDay->date)->format('d/m/Y');
|
||||
$statsUnique[$dateUnique] = isset($statsUnique[$dateUnique]) ? $statsUnique[$dateUnique] + 1 : 1;
|
||||
}
|
||||
$participationsUnique = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count")->groupBy("user")->orderBy("user")->get();
|
||||
$participationsUnique = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count")
|
||||
->groupBy("user")->orderBy("user")->get();
|
||||
|
||||
// Données calculées à afficher
|
||||
// Données calculées à afficher.
|
||||
$totalParticipation = Participation::count();
|
||||
if (count($participationsUnique) > 0) {
|
||||
$avgParticipUser = round($totalParticipation / count($participationsUnique), 1);
|
||||
|
|
@ -31,29 +34,40 @@ class DashboardController extends Controller
|
|||
$avgParticipUser = 0;
|
||||
}
|
||||
|
||||
// Tableau des dates comprises dans la table participation
|
||||
// Tableau des dates comprises dans la table participation.
|
||||
foreach ($participations as $participation) {
|
||||
$datesParticipations[Carbon::parse($participation->date)->format('d/m/Y')] = $participation->count;
|
||||
}
|
||||
|
||||
// Création des tableaux avec toutes les dates depuis le début du jeu et le nombre de participations associées
|
||||
// Création des tableaux avec toutes les dates depuis le début du jeu et le nombre de participations associées.
|
||||
$date = Carbon::parse($settings->start_date);
|
||||
$dateFin = now() < $settings->end_date ? Carbon::now() : Carbon::parse($settings->end_date);
|
||||
|
||||
// Récupération des 3 codes EAN les plus utilisés
|
||||
$codesEan = Participation::select(DB::raw('COUNT(code_ean_id) AS nb_usage, code_ean_id'))->groupBy('code_ean_id')->orderByDesc('nb_usage')->limit(3)->get();
|
||||
// Récupération des 3 codes EAN les plus utilisés.
|
||||
$codesEan = Participation::select(
|
||||
DB::raw('COUNT(code_ean_id) AS nb_usage, code_ean_id')
|
||||
)->groupBy('code_ean_id')->orderByDesc('nb_usage')->limit(3)->get();
|
||||
|
||||
// Génération des tableaux de date depuis le début du jeu
|
||||
// Génération des tableaux de date depuis le début du jeu.
|
||||
$dates = [];
|
||||
$count = [];
|
||||
$countUnique = [];
|
||||
while ($dateFin > $date) {
|
||||
$dates[] = $date->format('d/m/Y');
|
||||
$count[] = isset($datesParticipations[$date->format('d/m/Y')]) ? $datesParticipations[$date->format('d/m/Y')] : 0;
|
||||
$count[] = isset($datesParticipations[$date->format('d/m/Y')]) ?
|
||||
$datesParticipations[$date->format('d/m/Y')] : 0;
|
||||
$countUnique[] = isset($statsUnique[$date->format('d/m/Y')]) ? $statsUnique[$date->format('d/m/Y')] : 0;
|
||||
$date->addDay();
|
||||
}
|
||||
|
||||
return view('bo.dashboard.index', compact('dates', 'count', 'countUnique', 'totalParticipation', 'avgParticipUser', 'codesEan', 'settings'));
|
||||
return view('bo.dashboard.index', compact(
|
||||
'dates',
|
||||
'count',
|
||||
'countUnique',
|
||||
'totalParticipation',
|
||||
'avgParticipUser',
|
||||
'codesEan',
|
||||
'settings'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,26 +3,26 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FaqQuestions;
|
||||
use App\Models\FaqThemes;
|
||||
use App\Models\FaqQuestion;
|
||||
use App\Models\FaqTheme;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FaqQuestionsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$questions = FaqQuestions::all();
|
||||
$questions = FaqQuestion::all();
|
||||
for ($i = 0; $i < count($questions); $i++) {
|
||||
$questions[$i]['toggle'] = false;
|
||||
}
|
||||
$themes = FaqThemes::all();
|
||||
$themes = FaqTheme::all();
|
||||
return view('bo.faq-questions.index', compact('questions', 'themes'));
|
||||
}
|
||||
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
if ($request->id !== null) {
|
||||
$question = FaqQuestions::findOrFail($request->id);
|
||||
$question = FaqQuestion::findOrFail($request->id);
|
||||
$question->delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ class FaqQuestionsController extends Controller
|
|||
|
||||
for ($i = 0; $i < count($questions); $i++) {
|
||||
if (isset($questions[$i]["id"])) {
|
||||
$q = FaqQuestions::findOrFail($questions[$i]["id"]);
|
||||
$q = FaqQuestion::findOrFail($questions[$i]["id"]);
|
||||
$q->question = $questions[$i]["question"];
|
||||
$q->answer = $questions[$i]["answer"];
|
||||
$q->positive_vote = $questions[$i]["positive_vote"];
|
||||
|
|
@ -41,7 +41,7 @@ class FaqQuestionsController extends Controller
|
|||
$q->theme_id = $questions[$i]["theme_id"];
|
||||
$q->save();
|
||||
} else {
|
||||
$t = FaqQuestions::updateOrCreate(
|
||||
$t = FaqQuestion::updateOrCreate(
|
||||
[
|
||||
'question' => $questions[$i]["question"],
|
||||
'answer' => $questions[$i]["answer"],
|
||||
|
|
@ -52,7 +52,7 @@ class FaqQuestionsController extends Controller
|
|||
);
|
||||
$questions[$i]["id"] = $t->id;
|
||||
}
|
||||
}
|
||||
}//end for
|
||||
|
||||
return $questions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\FaqQuestions;
|
||||
use App\Models\FaqThemes;
|
||||
use App\Models\FaqQuestion;
|
||||
use App\Models\FaqTheme;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FaqThemesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$themes = FaqThemes::all();
|
||||
$themes = FaqTheme::all();
|
||||
return view('bo.faq-themes.index', compact('themes'));
|
||||
}
|
||||
|
||||
|
|
@ -19,10 +19,10 @@ class FaqThemesController extends Controller
|
|||
{
|
||||
$deleteOk = 0;
|
||||
|
||||
if (FaqQuestions::where('theme_id', $request->id)->count() > 0) {
|
||||
if (FaqQuestion::where('theme_id', $request->id)->count() > 0) {
|
||||
$deleteOk = 1;
|
||||
} elseif ($request->id !== null) {
|
||||
$theme = FaqThemes::findOrFail($request->id);
|
||||
$theme = FaqTheme::findOrFail($request->id);
|
||||
$theme->delete();
|
||||
} else {
|
||||
$deleteOk = 2;
|
||||
|
|
@ -37,11 +37,11 @@ class FaqThemesController extends Controller
|
|||
|
||||
for ($i = 0; $i < count($themes); $i++) {
|
||||
if (isset($themes[$i]["id"])) {
|
||||
$t = FaqThemes::findOrFail($themes[$i]["id"]);
|
||||
$t = FaqTheme::findOrFail($themes[$i]["id"]);
|
||||
$t->name = $themes[$i]["name"];
|
||||
$t->save();
|
||||
} else {
|
||||
$t = FaqThemes::updateOrCreate(['name' => $themes[$i]["name"]]);
|
||||
$t = FaqTheme::updateOrCreate(['name' => $themes[$i]["name"]]);
|
||||
$themes[$i]["id"] = $t->id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers\Bo;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\InstantWin;
|
||||
use App\Models\Prizes;
|
||||
use App\Models\Prize;
|
||||
use App\Models\Settings;
|
||||
|
||||
class InstantWinController extends Controller
|
||||
|
|
@ -17,7 +17,7 @@ class InstantWinController extends Controller
|
|||
if (intval($nbInstantWin) > 0) {
|
||||
$canGenerate = 0;
|
||||
} else {
|
||||
$nbLots = Prizes::count();
|
||||
$nbLots = Prize::count();
|
||||
if (intval($nbLots) > 0) {
|
||||
$canGenerate = 1;
|
||||
} else {
|
||||
|
|
@ -37,7 +37,7 @@ class InstantWinController extends Controller
|
|||
{
|
||||
$start_date = Settings::latest()->value("start_date");
|
||||
$end_date = Settings::latest()->value("end_date");
|
||||
$lots = Prizes::all();
|
||||
$lots = Prize::all();
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,7 +52,12 @@ class InstantWinController extends Controller
|
|||
|
||||
foreach ($lots as $k => $lot) {
|
||||
for ($i = 0; $i < $lot->quantity; $i++) {
|
||||
$lotsGlobal[] = ['id' => $lot->id, 'name' => $lot->label_one, 'hour' => str_pad(mt_rand(6, 22), 2, "0", STR_PAD_LEFT) . ":" . str_pad(mt_rand(0, 59), 2, "0", STR_PAD_LEFT) . ":00"];
|
||||
$lotsGlobal[] = [
|
||||
'id' => $lot->id,
|
||||
'name' => $lot->label_one,
|
||||
'hour' => str_pad(mt_rand(6, 22), 2, "0", STR_PAD_LEFT)
|
||||
. ":" . str_pad(mt_rand(0, 59), 2, "0", STR_PAD_LEFT) . ":00"
|
||||
];
|
||||
}
|
||||
}
|
||||
shuffle($lotsGlobal);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers\Bo;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\GainView;
|
||||
use App\Models\Prizes;
|
||||
use App\Models\Prize;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -13,7 +13,7 @@ class PrizesController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
$prizes = Prizes::all();
|
||||
$prizes = Prize::all();
|
||||
$gainViews = GainView::all();
|
||||
return view('bo.prizes.index', compact('prizes', 'gainViews'));
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ class PrizesController extends Controller
|
|||
for ($i = 0; $i < count($prizes); $i++) {
|
||||
$prize = $prizes[$i];
|
||||
if ($prize->id !== null) {
|
||||
$p = Prizes::findOrFail($prize->id);
|
||||
$p = Prize::findOrFail($prize->id);
|
||||
|
||||
$p->arcadia_id = $prize->arcadia_id;
|
||||
$p->label_one = $prize->label_one;
|
||||
|
|
@ -43,7 +43,8 @@ class PrizesController extends Controller
|
|||
$p->gain_view_id = $prize->gain_view_id;
|
||||
|
||||
if (isset($pdfs[$i])) {
|
||||
$fileName = Str::slug($prize->label_one) . '-' . date('d-m-Y') . '.' . $pdfs[$i]->extension();
|
||||
$fileName = Str::slug($prize->label_one) . '-' .
|
||||
date('d-m-Y') . '.' . $pdfs[$i]->extension();
|
||||
$p->pdf_winning_proof = $fileName;
|
||||
$pdfs[$i]->move(public_path('fichiers/pdf/'), $fileName);
|
||||
$prizes[$i]->pdf_winning_proof = $fileName;
|
||||
|
|
@ -51,7 +52,7 @@ class PrizesController extends Controller
|
|||
|
||||
$p->save();
|
||||
} else {
|
||||
$p = new Prizes();
|
||||
$p = new Prize();
|
||||
$p->arcadia_id = $prize->arcadia_id;
|
||||
$p->label_one = $prize->label_one;
|
||||
$p->label_many = $prize->label_many;
|
||||
|
|
@ -62,7 +63,8 @@ class PrizesController extends Controller
|
|||
$p->gain_view_id = $prize->gain_view_id;
|
||||
|
||||
if (isset($pdfs[$i])) {
|
||||
$fileName = Str::slug($prize->label_one) . '-' . date('d-m-Y') . '.' . $pdfs[$i]->extension();
|
||||
$fileName = Str::slug($prize->label_one) . '-' .
|
||||
date('d-m-Y') . '.' . $pdfs[$i]->extension();
|
||||
$p->pdf_winning_proof = $fileName;
|
||||
$pdfs[$i]->move(public_path('fichiers/pdf/'), $fileName);
|
||||
$prizes[$i]->pdf_winning_proof = $fileName;
|
||||
|
|
@ -70,11 +72,11 @@ class PrizesController extends Controller
|
|||
|
||||
$p->save();
|
||||
$prizes[$i]->id = $p->id;
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
}//end for
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
}//end try
|
||||
|
||||
return $prizes;
|
||||
}
|
||||
|
|
@ -85,7 +87,7 @@ class PrizesController extends Controller
|
|||
|
||||
if ($request->id !== null) {
|
||||
try {
|
||||
$prize = Prizes::findOrFail($request->id);
|
||||
$prize = Prize::findOrFail($request->id);
|
||||
$prize->delete();
|
||||
} catch (Exception $e) {
|
||||
$retour = "Erreur lors de la suppression : " . $e->getMessage();
|
||||
|
|
|
|||
|
|
@ -43,20 +43,20 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreProductRequest $request
|
||||
* @param \App\Http\Requests\StoreProductRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreProductRequest $request)
|
||||
{
|
||||
$name = $request->name;
|
||||
$slug = Str::slug($name);
|
||||
$no_art = $request->no_art;
|
||||
$code_ean = $request->code_ean;
|
||||
$picture = $request->picture;
|
||||
$name = $request->name;
|
||||
$slug = Str::slug($name);
|
||||
$no_art = $request->no_art;
|
||||
$code_ean = $request->code_ean;
|
||||
$picture = $request->picture;
|
||||
|
||||
$product = new Product();
|
||||
$product->name = $name;
|
||||
$product->no_art = $no_art;
|
||||
$product = new Product();
|
||||
$product->name = $name;
|
||||
$product->no_art = $no_art;
|
||||
$product->code_ean = $code_ean;
|
||||
$product->range()->associate($request->range_id);
|
||||
$product->save();
|
||||
|
|
@ -74,7 +74,7 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
|
|
@ -85,7 +85,7 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
|
|
@ -105,17 +105,17 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateProductRequest $request
|
||||
* @param int $id
|
||||
* @param \App\Http\Requests\UpdateProductRequest $request
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateProductRequest $request, $id)
|
||||
{
|
||||
$name = $request->name;
|
||||
$slug = Str::slug($name);
|
||||
$no_art = $request->no_art;
|
||||
$name = $request->name;
|
||||
$slug = Str::slug($name);
|
||||
$no_art = $request->no_art;
|
||||
$code_ean = $request->code_ean;
|
||||
$picture = $request->picture;
|
||||
$picture = $request->picture;
|
||||
|
||||
$product = Product::findOrFail($id);
|
||||
$product->range()->associate($request->range_id);
|
||||
|
|
@ -128,8 +128,8 @@ class ProductsController extends Controller
|
|||
$picture->move(public_path('images/produits'), $imageName);
|
||||
}
|
||||
|
||||
$product->name = $name;
|
||||
$product->no_art = $no_art;
|
||||
$product->name = $name;
|
||||
$product->no_art = $no_art;
|
||||
$product->code_ean = $code_ean;
|
||||
|
||||
if ($picture !== null) {
|
||||
|
|
@ -143,7 +143,7 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreRangeRequest $request
|
||||
* @param \App\Http\Requests\StoreRangeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreRangeRequest $request)
|
||||
|
|
@ -43,8 +43,8 @@ class RangeController extends Controller
|
|||
$slug = Str::slug($name);
|
||||
$picture = $request->picture;
|
||||
|
||||
$range = new Range();
|
||||
$range->name = $name;
|
||||
$range = new Range();
|
||||
$range->name = $name;
|
||||
$range->save();
|
||||
|
||||
if ($picture !== null) {
|
||||
|
|
@ -61,7 +61,7 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Range $range
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Range $range)
|
||||
|
|
@ -72,7 +72,7 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Range $range
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Range $range)
|
||||
|
|
@ -83,8 +83,8 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateRangeRequest $request
|
||||
* @param \App\Models\Range $range
|
||||
* @param \App\Http\Requests\UpdateRangeRequest $request
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateRangeRequest $request, Range $range)
|
||||
|
|
@ -101,7 +101,7 @@ class RangeController extends Controller
|
|||
$picture->move(public_path('images/ranges'), $imageName);
|
||||
}
|
||||
|
||||
$range->name = $name;
|
||||
$range->name = $name;
|
||||
|
||||
if ($picture !== null) {
|
||||
$range->picture = $imageName;
|
||||
|
|
@ -116,7 +116,7 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Range $range
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Range $range)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class SettingsController extends Controller
|
|||
$company = $request->company;
|
||||
$analytics = $request->analytics;
|
||||
|
||||
// Check du lien de redirection après fermeture
|
||||
// Check du lien de redirection après fermeture.
|
||||
if (strpos($redirectClose, 'https://') === false && strpos($redirectClose, 'http://') === false) {
|
||||
$redirectClose = 'https://' . $redirectClose;
|
||||
}
|
||||
|
|
@ -77,13 +77,14 @@ class SettingsController extends Controller
|
|||
|
||||
$settings->save();
|
||||
|
||||
$settingsGlobal = app(Settings::class)->select('name', 'company', 'analytics', 'start_date', 'end_date')->first();
|
||||
$settingsGlobal = app(Settings::class)
|
||||
->select('name', 'company', 'analytics', 'start_date', 'end_date')->first();
|
||||
Cache::put('settingsGlobal', $settingsGlobal);
|
||||
|
||||
$success = "Modifications enregistrés !";
|
||||
|
||||
return view('bo.settings.manage', compact('settings', 'success'));
|
||||
}
|
||||
}//end if
|
||||
|
||||
return view('bo.settings.manage', compact('settings'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use Illuminate\Support\Facades\Mail;
|
|||
|
||||
class WinnersListController extends Controller
|
||||
{
|
||||
|
||||
private $apiCrm;
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -21,7 +20,7 @@ class WinnersListController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
$winnersList = Participation::where('instant_win_id', '<>', null)->get();
|
||||
$winnersList = Participation::has('instantWin')->get();
|
||||
$settings = Settings::select('use_ean_codes', 'winning_proof')->first();
|
||||
return view('bo.winners-list.index', compact('winnersList', 'settings'));
|
||||
}
|
||||
|
|
@ -32,7 +31,8 @@ class WinnersListController extends Controller
|
|||
|
||||
$crmUser = $this->apiCrm->getCustomer($participation->user->crm_id);
|
||||
if ($crmUser->status === 'NOK') {
|
||||
return back()->withErrors("Erreur lors de la récupération de l'utilisateur dans la CRM : Code : " . $crmUser->code . " Message : " . $crmUser->message);
|
||||
return back()->withErrors("Erreur lors de la récupération de l'utilisateur dans la CRM : Code : " .
|
||||
$crmUser->code . " Message : " . $crmUser->message);
|
||||
}
|
||||
|
||||
$crmId = $participation->user->crm_id;
|
||||
|
|
@ -66,7 +66,7 @@ class WinnersListController extends Controller
|
|||
public function createCourrierArcadia(Request $request, $id)
|
||||
{
|
||||
$participation = Participation::findOrFail($id);
|
||||
$instantWin = $participation->instant_win;
|
||||
$instantWin = $participation->instantWin;
|
||||
|
||||
if ($instantWin->prize->arcadia_operation_code !== 0 && $instantWin->prize->arcadia_support_code !== 0) {
|
||||
$fields = [
|
||||
|
|
@ -101,16 +101,17 @@ class WinnersListController extends Controller
|
|||
if ($settings->use_ean_codes === 1) {
|
||||
$fields['orderLine'][] = [
|
||||
'fieldName' => 'code_on_pack',
|
||||
'fieldValue' => $participation->code_ean->code
|
||||
'fieldValue' => $participation->codeEan->code
|
||||
];
|
||||
}
|
||||
|
||||
$arcadiaMail = $this->apiCrm->ArcadiaOutgoingMail($participation->user->crm_id, $fields, 'game');
|
||||
if ($arcadiaMail->status === 'NOK') {
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new CourrierArcadiaError($participation->user));
|
||||
return back()->withErrors("Erreur lors de l'envoi du courrier Arcadia. Code : " . $arcadiaMail->code . " Message : " . $arcadiaMail->message);
|
||||
return back()->withErrors("Erreur lors de l'envoi du courrier Arcadia. Code : " .
|
||||
$arcadiaMail->code . " Message : " . $arcadiaMail->message);
|
||||
}
|
||||
}
|
||||
}//end if
|
||||
return back()->with('success', 'Courrier envoyé !');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,14 @@ class EndPageController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
$settings = app(Settings::class)->select('start_date', 'end_date', 'activated_close_page', 'close_page_active_date', 'redirect_close')->first();
|
||||
if ($settings->end_date < now() && $settings->activated_close_page === 1 && $settings->close_page_active_date > now()) {
|
||||
$settings = app(Settings::class)
|
||||
->select('start_date', 'end_date', 'activated_close_page', 'close_page_active_date', 'redirect_close')
|
||||
->first();
|
||||
if (
|
||||
$settings->end_date < now() &&
|
||||
$settings->activated_close_page === 1 &&
|
||||
$settings->close_page_active_date > now()
|
||||
) {
|
||||
return view('front.basic.end', compact('settings'));
|
||||
}
|
||||
return redirect()->route('home');
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ use App\Mail\NotifAdmin;
|
|||
use App\Mail\NotifWinAdmin;
|
||||
use App\Mail\PrizeWon;
|
||||
use App\Mail\ReductionWon;
|
||||
use App\Models\BannedIP;
|
||||
use App\Models\BannedIp;
|
||||
use App\Models\InstantWin;
|
||||
use App\Models\Participation;
|
||||
use App\Models\Reductions;
|
||||
use App\Models\Reduction;
|
||||
use LDCWeb\MesBR;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -62,7 +62,7 @@ class EnterCodeController extends Controller
|
|||
$settings = app(Settings::class);
|
||||
|
||||
// * Cas IP bannie.
|
||||
$ipBanned = BannedIP::where('ip', app('clientIp'))->first() === null ? 0 : 1;
|
||||
$ipBanned = BannedIp::where('ip', app('clientIp'))->first() === null ? 0 : 1;
|
||||
if ($ipBanned) {
|
||||
return view('front.basic.participation-exhausted', compact('settings'));
|
||||
}
|
||||
|
|
@ -82,8 +82,10 @@ class EnterCodeController extends Controller
|
|||
$participation->save();
|
||||
|
||||
// * Gestion des instants gagnants.
|
||||
$userAlreadyWon = Participation::where('instant_win_id', '<>', null)
|
||||
->where('user_id', '=', auth()->user()->id)->first();
|
||||
$userAlreadyWon = Participation::has('participation')
|
||||
->whereHas('user', function ($q) {
|
||||
$q->whereId(auth()->user()->id);
|
||||
})->first();
|
||||
|
||||
// * Si l'utilisateur actuel à déjà gagné un gros lot, pas d'instant gagnant.
|
||||
if ($userAlreadyWon) {
|
||||
|
|
@ -99,7 +101,7 @@ class EnterCodeController extends Controller
|
|||
return $this->instantWin($settings, $request, $participation, $instantWin);
|
||||
} catch (\ErrorException $e) {
|
||||
// Unbind instant gagnant.
|
||||
$participation->instant_win_id = null;
|
||||
$participation->instantWin()->dissociate($participation);
|
||||
} //end try
|
||||
}
|
||||
return $this->serveCouponWin($settings, $participation);
|
||||
|
|
@ -116,11 +118,10 @@ class EnterCodeController extends Controller
|
|||
*/
|
||||
private function instantWin(Settings $settings, Request $request, Participation &$participation, $instantWin)
|
||||
{
|
||||
$instantWin->won = 1;
|
||||
$instantWin->participation_id = $participation->id;
|
||||
$instantWin->won = true;
|
||||
// Should save now to prevent next player win on the same winning moment.
|
||||
$instantWin->save();
|
||||
$participation->instant_win_id = $instantWin->id;
|
||||
$participation->instantWin()->associate($instantWin);
|
||||
// Envoi du courrier Arcadia.
|
||||
if (
|
||||
$instantWin->prize->arcadia_operation_code !== 0 &&
|
||||
|
|
@ -236,7 +237,7 @@ class EnterCodeController extends Controller
|
|||
* @param Settings $settings
|
||||
* @param mixed $coupon
|
||||
* @param Participation $participation
|
||||
* @return \App\Models\Reductions|null
|
||||
* @return \App\Models\Reduction|null
|
||||
*/
|
||||
private function updateCoupon(Settings $settings, $coupon, Participation $participation)
|
||||
{
|
||||
|
|
@ -248,7 +249,7 @@ class EnterCodeController extends Controller
|
|||
$mesBR->updateContact($crmUser->user);
|
||||
$result = $mesBR->updatePanier($crmUser->user, $coupon);
|
||||
if ($result["status"] === "OK") {
|
||||
$reduction = new Reductions();
|
||||
$reduction = new Reduction();
|
||||
$reduction->participation_id = $participation->id;
|
||||
$reduction->link = $result["link"];
|
||||
$reduction->verification = $result["verif"];
|
||||
|
|
@ -277,11 +278,10 @@ class EnterCodeController extends Controller
|
|||
{
|
||||
$participation = Participation::where([
|
||||
['user_id', Auth::user()->id],
|
||||
['instant_win_id', '<>', null],
|
||||
['sticker', null],
|
||||
['ticket', null],
|
||||
['barcode', null]
|
||||
])->first();
|
||||
])->has('instantWin')->first();
|
||||
if ($participation) {
|
||||
return view('front.basic.winning-proof', compact('participation'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\FaqQuestions;
|
||||
use App\Models\FaqThemes;
|
||||
use App\Models\FaqQuestion;
|
||||
use App\Models\FaqTheme;
|
||||
|
||||
class FAQController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$questions = FaqQuestions::all();
|
||||
$themes = FaqThemes::all();
|
||||
$questions = FaqQuestion::all();
|
||||
$themes = FaqTheme::all();
|
||||
if (count($questions) === 0 && count($themes) === 0) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use App\Models\Settings;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
|
@ -48,9 +48,11 @@ class LoginController extends Controller
|
|||
|
||||
if ($connect->status === 'KO') {
|
||||
if ($connect->code === 500) {
|
||||
return back()->withInput($request->except("password"))->withErrors("La connexion est impossible pour le moment, veuillez réessayer plus tard.");
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("La connexion est impossible pour le moment, veuillez réessayer plus tard.");
|
||||
} else {
|
||||
return back()->withInput($request->except("password"))->withErrors("Email ou mot de passe incorrect.");
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("Email ou mot de passe incorrect.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,8 +60,9 @@ class LoginController extends Controller
|
|||
$userLocal->email_verify_token = Str::uuid();
|
||||
$userLocal->save();
|
||||
Mail::to($email)->send(new VerifyEmail($userLocal));
|
||||
return back()->withInput($request->except("password"))->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
}
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
}//end if
|
||||
} else {
|
||||
$connect = $this->apiCrm->loginCustomer($email, $password);
|
||||
|
||||
|
|
@ -70,7 +73,8 @@ class LoginController extends Controller
|
|||
'lastname' => $connect->user->lastname,
|
||||
'birth_date' => $connect->user->birth_date,
|
||||
'email' => $email,
|
||||
'password' => Hash::make("MOTDEPASSE"), // TODO : ???
|
||||
// TODO : MOTDEPASSE ???.
|
||||
'password' => Hash::make("MOTDEPASSE"),
|
||||
'address' => $connect->user->address,
|
||||
'address2' => $connect->user->address2,
|
||||
'town' => $connect->user->city,
|
||||
|
|
@ -79,14 +83,16 @@ class LoginController extends Controller
|
|||
'email_verified' => 1
|
||||
]);
|
||||
} else {
|
||||
if ($connect->code === 116) { // Compte existant mais non activé
|
||||
// Compte existant mais non activé.
|
||||
if ($connect->code === 116) {
|
||||
$userLocal = User::create([
|
||||
'crm_id' => $connect->user->crm_id,
|
||||
'firstname' => $connect->user->firstname,
|
||||
'lastname' => $connect->user->lastname,
|
||||
'birth_date' => $connect->user->birth_date,
|
||||
'email' => $email,
|
||||
'password' => Hash::make("MOTDEPASSE"), // TODO : ???
|
||||
// TODO : MOTDEPASSE ???.
|
||||
'password' => Hash::make("MOTDEPASSE"),
|
||||
'address' => $connect->user->address,
|
||||
'address2' => $connect->user->address2,
|
||||
'town' => $connect->user->city,
|
||||
|
|
@ -97,16 +103,19 @@ class LoginController extends Controller
|
|||
$userLocal->email_verify_token = Str::uuid();
|
||||
$userLocal->save();
|
||||
Mail::to($email)->send(new VerifyEmail($userLocal));
|
||||
return back()->withInput($request->except("password"))->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
} elseif ($connect->code === 500) {
|
||||
return back()->withInput($request->except("password"))->withErrors("La connexion est impossible pour le moment, veuillez réessayer plus tard.");
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("La connexion est impossible pour le moment, veuillez réessayer plus tard.");
|
||||
} else {
|
||||
return back()->withInput($request->except("password"))->withErrors("Email ou mot de passe incorrect.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("Email ou mot de passe incorrect.");
|
||||
} //end if
|
||||
} //end if
|
||||
}//end if
|
||||
|
||||
// TODO : Modifier avec separation guard
|
||||
// TODO : Modifier avec separation guard.
|
||||
$tmpPwd = "MOTDEPASSE";
|
||||
if ($userLocal->role <= 2) {
|
||||
$tmpPwd = $password;
|
||||
|
|
@ -144,7 +153,8 @@ class LoginController extends Controller
|
|||
$user->save();
|
||||
$result = true;
|
||||
} else {
|
||||
if ($activation->code === 110) { // User already active
|
||||
// User already active.
|
||||
if ($activation->code === 110) {
|
||||
$user->email_verified = 1;
|
||||
$user->email_verify_token = null;
|
||||
$user->save();
|
||||
|
|
@ -168,12 +178,14 @@ class LoginController extends Controller
|
|||
public function forgotPasswordReset(Request $request, $token)
|
||||
{
|
||||
if (!$request->hasValidSignature(false)) {
|
||||
return redirect()->route('login')->withErrors("Le lien de changement de votre mot de passe n'est plus valide, veuillez réessayer.");
|
||||
return redirect()->route('login')
|
||||
->withErrors("Le lien de changement de votre mot de passe n'est plus valide, veuillez réessayer.");
|
||||
}
|
||||
$tokenValid = false;
|
||||
$user = User::where('password_token', $token)->first();
|
||||
if (!$user) {
|
||||
return redirect()->route('forgot-password', compact('tokenValid'))->withErrors('Le lien de changement du mot de passe est incorrect.');
|
||||
return redirect()->route('forgot-password', compact('tokenValid'))
|
||||
->withErrors('Le lien de changement du mot de passe est incorrect.');
|
||||
}
|
||||
$tokenValid = true;
|
||||
return redirect()->route('forgot-password', compact('tokenValid', 'token'));
|
||||
|
|
@ -193,7 +205,8 @@ class LoginController extends Controller
|
|||
'lastname' => $userCrm->user->lastname,
|
||||
'birth_date' => $userCrm->user->birth_date,
|
||||
'email' => $email,
|
||||
'password' => Hash::make("MOTDEPASSE"), // TODO : ???
|
||||
// TODO : MOTDEPASSE ???
|
||||
'password' => Hash::make("MOTDEPASSE"),
|
||||
'address' => $userCrm->user->address,
|
||||
'address2' => $userCrm->user->address2,
|
||||
'town' => $userCrm->user->city,
|
||||
|
|
@ -207,23 +220,26 @@ class LoginController extends Controller
|
|||
$user->email_verify_token = Str::uuid();
|
||||
$user->save();
|
||||
Mail::to($email)->send(new VerifyEmail($user));
|
||||
return back()->withInput($request->except("password"))->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
return back()->withInput($request->except("password"))
|
||||
->withErrors("Votre compte existe mais votre email n'est pas confirmé, merci de vérifier vos emails.");
|
||||
}
|
||||
} else {
|
||||
if ($userCrm->code === 101) {
|
||||
return back()->withInput($request->only('email'))->withErrors("Le mail que vous avez entré n'est pas enregistré dans nos services.");
|
||||
return back()->withInput($request->only('email'))
|
||||
->withErrors("Le mail que vous avez entré n'est pas enregistré dans nos services.");
|
||||
} else {
|
||||
return back()->withErrors("Une erreur est survenue, veuillez réessayer plus tard.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
}//end if
|
||||
|
||||
$user->password_token = Str::uuid();
|
||||
$user->save();
|
||||
/** @var \App\Models\Settings $settings */
|
||||
$settings = app(Settings::class);
|
||||
Mail::to($email)->send(new PasswordReset($user, $settings));
|
||||
return redirect()->route('login')->with('success', 'Un mail de réinitialisation de votre mot de passe vous a été envoyé(e).');
|
||||
return redirect()->route('login')
|
||||
->with('success', 'Un mail de réinitialisation de votre mot de passe vous a été envoyé(e).');
|
||||
}
|
||||
|
||||
public function changePassword(Request $request)
|
||||
|
|
@ -237,7 +253,7 @@ class LoginController extends Controller
|
|||
return back()->withErrors('Le lien de changement de votre mot de passe est incorrect, veuillez réessayer.');
|
||||
}
|
||||
|
||||
// TODO : Ajouter controle du contenu du mot de passe
|
||||
// TODO : Ajouter controle du contenu du mot de passe.
|
||||
$newPassword = $request->password;
|
||||
|
||||
$update = $this->apiCrm->changePwdCustomer($user->crm_id, $newPassword);
|
||||
|
|
@ -245,10 +261,12 @@ class LoginController extends Controller
|
|||
if ($update->status === 'OK') {
|
||||
$user->password_token = null;
|
||||
$user->save();
|
||||
return redirect()->route('login')->with('success', 'Vous pouvez désormais vous connecter avec votre nouveau mot de passe.');
|
||||
return redirect()->route('login')
|
||||
->with('success', 'Vous pouvez désormais vous connecter avec votre nouveau mot de passe.');
|
||||
} else {
|
||||
if ($update->code === 123) {
|
||||
return back()->withErrors("Il semblerait que vous ayez déjà utilisé ce mot de passe pour votre compte. Veuillez réessayer en changeant de mot de passe.");
|
||||
return back()
|
||||
->withErrors("Il semblerait que vous ayez déjà utilisé ce mot de passe pour votre compte. Veuillez réessayer en changeant de mot de passe.");
|
||||
} else {
|
||||
return back()->withErrors("Une erreur est survenue, veuillez réessayer plus tard.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Range;
|
||||
|
||||
class ProduitsController extends Controller
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Mail\VerifyEmail;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -122,7 +122,7 @@ class RegisterController extends Controller
|
|||
->withInput($request->except('password'))
|
||||
->withErrors("Une erreur est survenue, merci de recommencer.");
|
||||
}
|
||||
}
|
||||
}//end if
|
||||
}
|
||||
|
||||
private function isSQLDate($date)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ class TeaserController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
$settings = app(Settings::class)->select('start_date', 'end_date', 'activated_teaser', 'teaser_end_activity')->first();
|
||||
$settings = app(Settings::class)
|
||||
->select('start_date', 'end_date', 'activated_teaser', 'teaser_end_activity')->first();
|
||||
if ($settings->activated_teaser === 1 && $settings->teaser_end_activity > now()) {
|
||||
return view('front.basic.teaser', compact('settings'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use App\Mail\NotifAdmin;
|
|||
use App\Mail\WinningProof;
|
||||
use App\Models\Participation;
|
||||
use App\Models\Settings;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
|
@ -27,11 +27,10 @@ class WinningProofController extends Controller
|
|||
// On récupère la participation gagnante en attente des infos
|
||||
$participation = Participation::where([
|
||||
['user_id', Auth::user()->id],
|
||||
['instant_win_id', '<>', null],
|
||||
['sticker', null],
|
||||
['ticket', null],
|
||||
['barcode', null]
|
||||
])->first();
|
||||
])->has('instantWin')->first();
|
||||
if (!$participation) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
|
@ -62,7 +61,7 @@ class WinningProofController extends Controller
|
|||
$ticket = $request->ticket;
|
||||
$barcode = $request->barcode;
|
||||
|
||||
// Mise à jour de l'utilisateur en local
|
||||
// Mise à jour de l'utilisateur en local.
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user->lastname = $lastname;
|
||||
$user->firstname = $firstname;
|
||||
|
|
@ -74,11 +73,27 @@ class WinningProofController extends Controller
|
|||
$user->phone = $phone;
|
||||
$user->save();
|
||||
|
||||
// Mise à jour utilisateur dans la CRM
|
||||
$update = $this->apiCrm->updateCustomer($user->crm_id, $firstname, $lastname, null, null, $phone, $address, $address2, $town, $postalCode, ucfirst($country));
|
||||
// Mise à jour utilisateur dans la CRM.
|
||||
$update = $this->apiCrm->updateCustomer(
|
||||
$user->crm_id,
|
||||
$firstname,
|
||||
$lastname,
|
||||
null,
|
||||
null,
|
||||
$phone,
|
||||
$address,
|
||||
$address2,
|
||||
$town,
|
||||
$postalCode,
|
||||
ucfirst($country)
|
||||
);
|
||||
if ($update->status !== 'OK') {
|
||||
Log::warning('Erreur lors de la mise a jour du user (crm_id : ' . $user->crm_id . ') - code : ' . $update->code . ' - message : ' . $update->message);
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new NotifAdmin('CRM : Erreur lors de la mise a jour du user (crm_id : ' . $user->crm_id . ') - code : ' . $update->code . ' - message : ' . $update->message));
|
||||
Log::warning('Erreur lors de la mise a jour du user (crm_id : ' . $user->crm_id .
|
||||
') - code : ' . $update->code . ' - message : ' . $update->message);
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new NotifAdmin(
|
||||
'CRM : Erreur lors de la mise a jour du user (crm_id : ' .
|
||||
$user->crm_id . ') - code : ' . $update->code . ' - message : ' . $update->message
|
||||
));
|
||||
}
|
||||
|
||||
$participationId = $participation->id;
|
||||
|
|
@ -103,7 +118,14 @@ class WinningProofController extends Controller
|
|||
$settings = app(Settings::class);
|
||||
$mails = json_decode($settings->notification_emails);
|
||||
foreach ($mails as $mail) {
|
||||
Mail::to($mail->email)->send(new WinningProof($stickerPath, $ticketPath, $barcodePath, $participation, $user, $settings));
|
||||
Mail::to($mail->email)->send(new WinningProof(
|
||||
$stickerPath,
|
||||
$ticketPath,
|
||||
$barcodePath,
|
||||
$participation,
|
||||
$user,
|
||||
$settings
|
||||
));
|
||||
}
|
||||
|
||||
return view('front.basic.replay');
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Models\Reductions;
|
||||
use App\Models\Reduction;
|
||||
|
||||
class re7Controller extends Controller
|
||||
{
|
||||
|
|
@ -14,7 +14,8 @@ class re7Controller extends Controller
|
|||
|
||||
public function teaser()
|
||||
{
|
||||
$settings = app(Settings::class)->select('start_date', 'end_date', 'activated_teaser', 'teaser_end_activity')->first();
|
||||
$settings = app(Settings::class)
|
||||
->select('start_date', 'end_date', 'activated_teaser', 'teaser_end_activity')->first();
|
||||
return view('front.basic.teaser', compact('settings'));
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ class re7Controller extends Controller
|
|||
{
|
||||
$settings = app(Settings::class);
|
||||
$coupon = $this->getRandomCoupon($settings);
|
||||
$crmCoupon = new Reductions();
|
||||
$crmCoupon = new Reduction();
|
||||
return view('front.basic.reduction', compact('coupon', 'crmCoupon'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Codes;
|
||||
use App\Models\Code;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ExportCodesRequest extends FormRequest
|
||||
|
|
@ -15,8 +15,8 @@ class ExportCodesRequest extends FormRequest
|
|||
public function authorize()
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder */
|
||||
$codesAvailableToExport = Codes::whereCodeExported(false);
|
||||
$lastExportedId = Codes::whereCodeExported(true)
|
||||
$codesAvailableToExport = Code::whereCodeExported(false);
|
||||
$lastExportedId = Code::whereCodeExported(true)
|
||||
->orderBy('id', 'desc')->first()->id ?? null;
|
||||
if ($lastExportedId) {
|
||||
$codesAvailableToExport = $codesAvailableToExport
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Codes;
|
||||
use App\Models\CodesEAN;
|
||||
use App\Models\Code;
|
||||
use App\Models\CodeEan;
|
||||
use App\Models\Participation;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
|
@ -28,7 +28,7 @@ class ParticipateRequest extends FormRequest
|
|||
if (app(Settings::class)->use_ean_codes) {
|
||||
$this->merge([
|
||||
'code_ean' => \in_array(Str::length($this->code_ean), [13, 8, 7]) ?
|
||||
CodesEAN::where('code', $this->code_ean)
|
||||
CodeEan::where('code', $this->code_ean)
|
||||
->orWhere('code', 'LIKE', Str::limit($this->code_ean, 13, '') . '%')
|
||||
->orWhere('code', 'LIKE', Str::limit($this->code_ean, 8, '') . '%')
|
||||
->orWhere('code', 'LIKE', Str::limit($this->code_ean, 7, '') . '%')
|
||||
|
|
@ -39,7 +39,7 @@ class ParticipateRequest extends FormRequest
|
|||
if (is_string($this->code)) {
|
||||
$this->merge([
|
||||
'serial' => $this->code,
|
||||
'code' => Codes::whereId(Codes::serialToInt(Str::upper($this->code)))->first() ?? false,
|
||||
'code' => Code::whereId(Code::serialToInt(Str::upper($this->code)))->first() ?? false,
|
||||
]);
|
||||
}
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
|
|
@ -120,7 +120,7 @@ class ParticipateRequest extends FormRequest
|
|||
'required',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
function ($attribute, $value, $fail) {
|
||||
if (!\is_object($value) or \get_class($value) !== CodesEAN::class) {
|
||||
if (!\is_object($value) or \get_class($value) !== CodeEan::class) {
|
||||
$fail('Le code barre entré est incorrect, veuillez réessayer.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class StoreProductRequest extends FormRequest
|
|||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
|
|
@ -30,7 +30,9 @@ class StoreProductRequest extends FormRequest
|
|||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
Rule::dimensions()->maxWidth(config('theme.product_image_maxwidth'))->maxHeight(config('theme.product_image_maxheight'))
|
||||
Rule::dimensions()
|
||||
->maxWidth(config('theme.product_image_maxwidth'))
|
||||
->maxHeight(config('theme.product_image_maxheight'))
|
||||
],
|
||||
'range_id' => 'exists:ranges,id'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class StoreRangeRequest extends FormRequest
|
|||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
|
|
@ -30,7 +30,9 @@ class StoreRangeRequest extends FormRequest
|
|||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
Rule::dimensions()->maxWidth(config('theme.product_image_maxwidth'))->maxHeight(config('theme.product_image_maxheight'))
|
||||
Rule::dimensions()
|
||||
->maxWidth(config('theme.product_image_maxwidth'))
|
||||
->maxHeight(config('theme.product_image_maxheight'))
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class UpdateProductRequest extends FormRequest
|
|||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
|
|
@ -30,7 +30,9 @@ class UpdateProductRequest extends FormRequest
|
|||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
Rule::dimensions()->maxWidth(config('theme.product_image_maxwidth'))->maxHeight(config('theme.product_image_maxheight'))
|
||||
Rule::dimensions()
|
||||
->maxWidth(config('theme.product_image_maxwidth'))
|
||||
->maxHeight(config('theme.product_image_maxheight'))
|
||||
],
|
||||
'range_id' => 'exists:ranges,id'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class UpdateRangeRequest extends FormRequest
|
|||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
|
|
@ -30,7 +30,9 @@ class UpdateRangeRequest extends FormRequest
|
|||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
Rule::dimensions()->maxWidth(config('theme.product_image_maxwidth'))->maxHeight(config('theme.product_image_maxheight'))
|
||||
Rule::dimensions()
|
||||
->maxWidth(config('theme.product_image_maxwidth'))
|
||||
->maxHeight(config('theme.product_image_maxheight'))
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Jobs;
|
|||
|
||||
use App\Mail\ExportCodesUniques;
|
||||
use App\Mail\JobFailed;
|
||||
use App\Models\Codes;
|
||||
use App\Models\Code;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
|
@ -85,7 +85,7 @@ class ProcessExportCodesUniques implements ShouldQueue
|
|||
date('dmY_His')
|
||||
);
|
||||
|
||||
$lastExportedCodeId = Codes::whereCodeExported(true)
|
||||
$lastExportedCodeId = Code::whereCodeExported(true)
|
||||
->orderBy('id', 'desc')->first()->id ?? null;
|
||||
|
||||
$filesPath = $this->generateCsvFiles($lastExportedCodeId);
|
||||
|
|
@ -157,10 +157,10 @@ class ProcessExportCodesUniques implements ShouldQueue
|
|||
foreach ($codes as $code) {
|
||||
if ($currentExportedCodes < $this->nbCodeTot) {
|
||||
if ($currentLineCodes === ($this->nbCodeLigne === 1 ? 1 : $this->nbCodeLigne - 1)) {
|
||||
File::append($tempFilePath, Codes::intToSerial($code) . "\n");
|
||||
File::append($tempFilePath, Code::intToSerial($code) . "\n");
|
||||
$currentLineCodes = ($this->nbCodeLigne === 1 ? 1 : 0);
|
||||
} else {
|
||||
File::append($tempFilePath, Codes::intToSerial($code) . ';');
|
||||
File::append($tempFilePath, Code::intToSerial($code) . ';');
|
||||
$currentLineCodes++;
|
||||
} //end if
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ class ProcessExportCodesUniques implements ShouldQueue
|
|||
}
|
||||
// ? Have we reached pagination limit for mass saving ?
|
||||
if (count($exportedCodesId) === $paginate) {
|
||||
Codes::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
Code::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
$exportedCodesId = [];
|
||||
}
|
||||
} //end if
|
||||
|
|
@ -190,7 +190,7 @@ class ProcessExportCodesUniques implements ShouldQueue
|
|||
|
||||
// ? Are there exported codes to save ?
|
||||
if (count($exportedCodesId)) {
|
||||
Codes::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
Code::whereIn('id', $exportedCodesId)->update(['code_exported' => 1]);
|
||||
}
|
||||
return $outPaths;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Jobs;
|
|||
|
||||
use App\Mail\CodeGenerationEnd;
|
||||
use App\Mail\JobFailed;
|
||||
use App\Models\Codes;
|
||||
use App\Models\Code;
|
||||
use App\Models\Settings;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
|
|
@ -72,7 +72,7 @@ class ProcessUniqueCode implements ShouldQueue
|
|||
$maxSQLPlaceholders = 65535;
|
||||
|
||||
$insertColumns = collect(DB::getSchemaBuilder()
|
||||
->getColumnListing((new Codes())->getTable()))
|
||||
->getColumnListing((new Code())->getTable()))
|
||||
->filter(function ($name) {
|
||||
// * Ignorer les colonnes avec valeurs par défaut sur la table.
|
||||
return !in_array($name, ['id', 'code_used', 'code_exported']);
|
||||
|
|
@ -102,7 +102,7 @@ class ProcessUniqueCode implements ShouldQueue
|
|||
} while ($totalGeneratedInserts < $this->quantity and --$insertToGenerate);
|
||||
|
||||
// * Mass insert
|
||||
Codes::insert($inserts);
|
||||
Code::insert($inserts);
|
||||
|
||||
$totalGeneratedInserts += count($inserts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
|
|
@ -12,14 +13,20 @@ class CourrierArcadiaError extends Mailable implements ShouldQueue
|
|||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @var \App\Models\User
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user)
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
|
@ -32,6 +39,7 @@ class CourrierArcadiaError extends Mailable implements ShouldQueue
|
|||
public function build()
|
||||
{
|
||||
$user = $this->user;
|
||||
return $this->subject("Erreur envoi courrier arcadia")->view('front.basic.error-arcadia-email', compact('user'));
|
||||
return $this->subject("Erreur envoi courrier arcadia")
|
||||
->view('front.basic.error-arcadia-email', compact('user'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class JobFailed extends Mailable
|
|||
public $job;
|
||||
|
||||
public $exception;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
|
|
@ -31,6 +32,7 @@ class JobFailed extends Mailable
|
|||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->subject('[JOB FAILED] Une erreur est survenue pendant le job : ' . $this->job)->view('bo.mails.job-failed');
|
||||
return $this->subject('[JOB FAILED] Une erreur est survenue pendant le job : ' . $this->job)
|
||||
->view('bo.mails.job-failed');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class NotifWinAdmin extends Mailable implements ShouldQueue
|
|||
public function build()
|
||||
{
|
||||
$participation = $this->participation;
|
||||
return $this->subject($this->settings->name . " : un lot a été gagné")->view('front.basic.notif-win-admin-email', compact('participation'));
|
||||
return $this->subject($this->settings->name . " : un lot a été gagné")
|
||||
->view('front.basic.notif-win-admin-email', compact('participation'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,11 @@ class WinningProof extends Mailable implements ShouldQueue
|
|||
{
|
||||
$participation = $this->participation;
|
||||
$user = $this->user;
|
||||
return $this->subject($this->settings->name . " : Preuves de gain de " . $this->user->lastname . " " . $this->user->firstname)
|
||||
->view('front.basic.winning-proof-email', compact('participation', 'user'))->attach($this->sticker)->attach($this->ticket)->attach($this->barcode);
|
||||
return $this->subject(
|
||||
$this->settings->name . " : Preuves de gain de " . $this->user->lastname . " " . $this->user->firstname
|
||||
)->view(
|
||||
'front.basic.winning-proof-email',
|
||||
compact('participation', 'user')
|
||||
)->attach($this->sticker)->attach($this->ticket)->attach($this->barcode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BannedIP extends Model
|
||||
{
|
||||
|
||||
protected $table = "banned_ip";
|
||||
|
||||
protected $fillable = ['ip'];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
||||
22
app/Models/BannedIp.php
Normal file
22
app/Models/BannedIp.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BannedIp extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['ip'];
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ namespace App\Models;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kwaadpepper\Serial\SerialCaster;
|
||||
|
||||
class Codes extends Model
|
||||
class Code extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
27
app/Models/CodeEan.php
Normal file
27
app/Models/CodeEan.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CodeEan extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['code', 'product'];
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
public function participations()
|
||||
{
|
||||
return $this->hasMany(Participation::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CodesEAN extends Model
|
||||
{
|
||||
|
||||
protected $table = "codes_ean";
|
||||
|
||||
protected $fillable = ['code', 'product'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function participations()
|
||||
{
|
||||
return $this->hasMany('App\Models\Participation', 'code_ean_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,4 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Content extends Model
|
||||
{
|
||||
|
||||
protected $table = "content";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,21 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaqQuestions extends Model
|
||||
class FaqQuestion extends Model
|
||||
{
|
||||
|
||||
protected $table = "faq_questions";
|
||||
|
||||
protected $fillable = ["question", "answer", "positive_vote", "negative_vote", "theme_id"];
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'question', 'answer', 'positive_vote',
|
||||
'negative_vote', 'theme_id'
|
||||
];
|
||||
|
||||
public function theme()
|
||||
{
|
||||
return $this->belongsTo('App\Models\FaqThemes', 'theme_id');
|
||||
return $this->belongsTo(FaqTheme::class, 'theme_id');
|
||||
}
|
||||
|
||||
public function getUtilityAttribute()
|
||||
27
app/Models/FaqTheme.php
Normal file
27
app/Models/FaqTheme.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaqTheme extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['questions'];
|
||||
|
||||
public function questions()
|
||||
{
|
||||
return $this->hasMany(FaqQuestion::class, 'theme_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaqThemes extends Model
|
||||
{
|
||||
|
||||
protected $table = "faq_themes";
|
||||
|
||||
protected $fillable = ["name"];
|
||||
|
||||
protected $with = ['questions'];
|
||||
|
||||
public function questions()
|
||||
{
|
||||
return $this->hasMany('App\Models\FaqQuestions', 'theme_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -6,11 +6,15 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class GainView extends Model
|
||||
{
|
||||
|
||||
protected $fillable = ["name", "file_name"];
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name', 'file_name'];
|
||||
|
||||
public function prizes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Prizes', 'gain_view_id');
|
||||
return $this->hasMany(Prize::class, 'gain_view_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,20 +6,46 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class InstantWin extends Model
|
||||
{
|
||||
|
||||
protected $table = "instant_win";
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['prize'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'won' => 'bool'
|
||||
];
|
||||
|
||||
/**
|
||||
* BelongsTo Prize relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function prize()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Prizes', 'prize_id');
|
||||
return $this->belongsTo(Prize::class, 'prize_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* One to one relation participation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function participation()
|
||||
{
|
||||
return $this->hasOne('App\Models\Participation', 'instant_win_id');
|
||||
return $this->belongsTo(Participation::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,37 +6,63 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Participation extends Model
|
||||
{
|
||||
|
||||
protected $table = "participation";
|
||||
|
||||
/**
|
||||
* BelongsTo User relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User', 'user_id');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo Codes relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function code()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Codes', 'code_unique_id');
|
||||
return $this->belongsTo(Code::class, 'code_unique_id');
|
||||
}
|
||||
|
||||
public function code_ean()
|
||||
/**
|
||||
* BelongsTo CodesEAN relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function codeEan()
|
||||
{
|
||||
return $this->belongsTo('App\Models\CodesEAN', 'code_ean_id');
|
||||
return $this->belongsTo(CodeEan::class);
|
||||
}
|
||||
|
||||
public function instant_win()
|
||||
/**
|
||||
* One to one InstantWin relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function instantWin()
|
||||
{
|
||||
return $this->hasOne('App\Models\InstantWin', 'participation_id');
|
||||
return $this->hasOne(InstantWin::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* One to one Reduction relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function reduction()
|
||||
{
|
||||
return $this->hasOne('App\Models\Reductions', 'reduction_id');
|
||||
return $this->hasOne(Reduction::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* ean_code_value accessor
|
||||
*
|
||||
* @return integer|null
|
||||
*/
|
||||
public function getCodeEanValueAttribute()
|
||||
{
|
||||
$code = CodesEAN::find($this->code_ean_id)->code;
|
||||
return $code;
|
||||
return optional($this->codeEan)->code;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Prizes extends Model
|
||||
class Prize extends Model
|
||||
{
|
||||
public function gain_view()
|
||||
{
|
||||
return $this->belongsTo('App\Models\GainView', 'gain_view_id');
|
||||
return $this->belongsTo(GainView::class, 'gain_view_id');
|
||||
}
|
||||
|
||||
public function instant_wins()
|
||||
{
|
||||
return $this->hasMany('App\Models\InstantWin', 'prize_id');
|
||||
return $this->hasMany(InstantWin::class, 'prize_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Range extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function products()
|
||||
|
|
|
|||
18
app/Models/Reduction.php
Normal file
18
app/Models/Reduction.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Reduction extends Model
|
||||
{
|
||||
/**
|
||||
* One to one Participation relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function participation()
|
||||
{
|
||||
return $this->belongsTo(Participation::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Reductions extends Model
|
||||
{
|
||||
public function participation()
|
||||
{
|
||||
return $this->hasOne('App\Models\Participation', 'participation_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Settings extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
|
@ -49,8 +49,13 @@ class User extends Authenticatable
|
|||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Has Many Participation relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function participations()
|
||||
{
|
||||
return $this->hasMany('App\Models\Participation', 'user_id');
|
||||
return $this->hasMany(Participation::class, 'user_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Prizes;
|
||||
use App\Models\Prize;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
|
@ -70,7 +70,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
// On ramène aussi tout les prix car on en a besoin sur le header.
|
||||
$prizesGlobal = Cache::get('prizesGlobal');
|
||||
if (!$prizesGlobal) {
|
||||
$prizesGlobal = Prizes::all();
|
||||
$prizesGlobal = Prize::all();
|
||||
Cache::put('prizesGlobal', $prizesGlobal);
|
||||
}
|
||||
View::share('prizesGlobal', $prizesGlobal);
|
||||
|
|
|
|||
|
|
@ -6,15 +6,12 @@ use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvid
|
|||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
protected $policies = [];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
|
|
@ -24,7 +21,5 @@ class AuthServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ return [
|
|||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\User::class,
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserFactory extends Factory
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class CreateFailedJobsTable extends Migration
|
|||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->nullable()->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class CreateSettings extends Migration
|
|||
$table->integer('nb_participation_player');
|
||||
$table->integer('nb_participation_ip');
|
||||
$table->integer('nb_unique_code_use');
|
||||
$table->smallInteger('code_length')
|
||||
->default(config('codes.codeLength'));
|
||||
$table->boolean('use_ean_codes');
|
||||
$table->boolean('activated_teaser');
|
||||
$table->dateTime('teaser_end_activity')->nullable();
|
||||
|
|
@ -37,11 +39,11 @@ class CreateSettings extends Migration
|
|||
$table->text('notification_emails')->nullable();
|
||||
$table->boolean('winning_proof');
|
||||
$table->string('company');
|
||||
$table->text('analytics')->nullable();
|
||||
$table->string('analytics', strlen('UA-XXXXXXXX-1'))->nullable();
|
||||
$table->timestamps();
|
||||
$table->collation = 'utf8mb4_unicode_ci';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGainView extends Migration
|
||||
class CreateGainViews extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInstantWin extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('instant_win', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId("prize_id")->constrained("prizes");
|
||||
$table->dateTime("appear_date");
|
||||
$table->boolean("won")->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('instant_win');
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@ class CreateCodes extends Migration
|
|||
{
|
||||
Schema::create('codes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code_unique')->unique();
|
||||
$table->boolean('code_used')->default(0);
|
||||
$table->boolean('code_exported')->default(0);
|
||||
$table->date('date_creation');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCodesEan extends Migration
|
||||
class CreateCodeEans extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateCodesEan extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('codes_ean', function (Blueprint $table) {
|
||||
Schema::create('code_eans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code');
|
||||
$table->string('product');
|
||||
|
|
@ -28,6 +28,6 @@ class CreateCodesEan extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('codes_ean');
|
||||
Schema::dropIfExists('code_eans');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBannedIp extends Migration
|
||||
class CreateBannedIps extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateBannedIp extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('banned_ip', function (Blueprint $table) {
|
||||
Schema::create('banned_ips', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('ip');
|
||||
$table->unique('ip');
|
||||
|
|
@ -27,6 +27,6 @@ class CreateBannedIp extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('banned_ip');
|
||||
Schema::dropIfExists('banned_ips');
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateContent extends Migration
|
||||
class CreateContents extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateContent extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('content', function (Blueprint $table) {
|
||||
Schema::create('contents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key');
|
||||
$table->text('value');
|
||||
|
|
@ -16,7 +16,7 @@ class CreateFaqQuestions extends Migration
|
|||
Schema::create('faq_questions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('question');
|
||||
$table->string('answer');
|
||||
$table->text('answer');
|
||||
$table->unsignedInteger('positive_vote')->nullable();
|
||||
$table->unsignedInteger('negative_vote')->nullable();
|
||||
$table->foreignId('theme_id')->constrained('faq_themes');
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class CreateReductions extends Migration
|
|||
{
|
||||
Schema::create('reductions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('participation_id')->constrained('participation');
|
||||
$table->string('link');
|
||||
$table->string('basket_id');
|
||||
$table->string('verification');
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateParticipation extends Migration
|
||||
class CreateParticipations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,16 +13,16 @@ class CreateParticipation extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('participation', function (Blueprint $table) {
|
||||
Schema::create('participations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users');
|
||||
$table->foreignId('code_unique_id')->constrained('codes');
|
||||
$table->foreignId('code_ean_id')->nullable()->constrained('codes_ean');
|
||||
$table->foreignId('instant_win_id')->nullable()->constrained('instant_win');
|
||||
$table->string('ip');
|
||||
$table->string('sticker')->nullable();
|
||||
$table->string('ticket')->nullable();
|
||||
$table->string('barcode')->nullable();
|
||||
$table->foreignId('user_id')->constrained('users');
|
||||
$table->foreignId('code_unique_id')->constrained('codes');
|
||||
$table->foreignId('code_ean_id')->nullable()->constrained('code_eans');
|
||||
$table->foreignId('reduction_id')->nullable()->constrained('reductions');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
@ -34,6 +34,6 @@ class CreateParticipation extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('participation');
|
||||
Schema::dropIfExists('participations');
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@ class CreatePrizes extends Migration
|
|||
{
|
||||
Schema::create('prizes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger("arcadia_id");
|
||||
$table->string("label_one");
|
||||
$table->string("label_many");
|
||||
$table->integer("quantity");
|
||||
|
|
@ -23,6 +22,7 @@ class CreatePrizes extends Migration
|
|||
$table->integer("arcadia_support_code");
|
||||
$table->string("pdf_winning_proof")->nullable();
|
||||
$table->boolean("need_proof");
|
||||
$table->unsignedBigInteger("arcadia_id");
|
||||
$table->foreignId("gain_view_id")->constrained("gain_views");
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInstantWins extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('instant_wins', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->dateTime('appear_date');
|
||||
$table->boolean('won')->default(0);
|
||||
$table->foreignId('prize_id')->constrained('prizes');
|
||||
$table->foreignId('participation_id')->nullable()
|
||||
->constrained('participations')->unique();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('instant_wins');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ParticipationAddReductionId extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table("participation", function(Blueprint $table) {
|
||||
$table->foreignId('reduction_id')->after("instant_win_id")->nullable()->constrained('reductions');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table("participation", function(Blueprint $table) {
|
||||
$table->dropForeign(["reduction_id"]);
|
||||
$table->dropColumn("reduction_id");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateInstantWinParticipationId extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table("instant_win", function(Blueprint $table) {
|
||||
$table->foreignId('participation_id')->nullable()->constrained('participation');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table("instant_win", function(Blueprint $table) {
|
||||
$table->dropForeign(["participation_id"]);
|
||||
$table->dropColumn("participation_id");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ExtendAnswerFieldInFaqQuestions extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('faq_questions', function (Blueprint $table) {
|
||||
$table->text('answer')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('faq_questions', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateModelsRangesTable extends Migration
|
||||
class CreateModelRangesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateModelsRangesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('models_ranges', function (Blueprint $table) {
|
||||
Schema::create('model_ranges', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -26,6 +26,6 @@ class CreateModelsRangesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('models_ranges');
|
||||
Schema::dropIfExists('model_ranges');
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ class CreateRangesTable extends Migration
|
|||
Schema::create('ranges', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('picture')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRangeIdToProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->foreignId('range_id')->before('created_at')->references('id')
|
||||
->on('ranges')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropForeign(['range_id']);
|
||||
$table->dropColumn('range_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,9 @@ class CreateProductsTable extends Migration
|
|||
$table->string('name');
|
||||
$table->unsignedInteger('no_art')->nullable();
|
||||
$table->string('picture')->nullable();
|
||||
$table->string('code_ean');
|
||||
$table->foreignId('range_id')->before('created_at')->references('id')
|
||||
->on('ranges')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddImageToRangesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ranges', function (Blueprint $table) {
|
||||
$table->string('picture')->nullable()->before('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ranges', function (Blueprint $table) {
|
||||
$table->dropColumn('picture');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEanToProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->string('code_ean')->before('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('code_ean');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MakeInstantWinUniqueInParticipation extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('participation', function (Blueprint $table) {
|
||||
$table->unique('instant_win_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('participation', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveCodeUniqueFromCodes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('codes', function (Blueprint $table) {
|
||||
$table->dropColumn('code_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('codes', function (Blueprint $table) {
|
||||
$table->string('code_unique')->unique();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCodeLengthToSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->smallInteger('code_length')
|
||||
->default(config('codes.codeLength'))->after('nb_unique_code_use');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->dropColumn('code_length');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class Laravel8UpgradeFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('failed_jobs', function (Blueprint $table) {
|
||||
$table->string('uuid')->after('id')->nullable()->unique();
|
||||
});
|
||||
DB::table('failed_jobs')->whereNull('uuid')->cursor()->each(function ($job) {
|
||||
DB::table('failed_jobs')
|
||||
->where('id', $job->id)
|
||||
->update(['uuid' => (string)Illuminate\Support\Str::uuid()]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -331,11 +331,15 @@
|
|||
<win-notification name="notification_emails" dbdatas="{{$settings->notification_emails}}"></win-notification>
|
||||
<hr>
|
||||
<h5 class="card-subtitle">
|
||||
Script analytics<br/>
|
||||
<small class="text-muted">Insérer ici le code analytics pour le jeu.</small>
|
||||
Google analytics<br/>
|
||||
<small class="text-muted">Insérer ici la clé analytics pour le jeu.</small>
|
||||
</h5>
|
||||
<br/>
|
||||
<textarea name="analytics" class="form-control" rows="7">{{ $settings->analytics }}</textarea>
|
||||
<table class="table table-bordered">
|
||||
<tr class="form-group">
|
||||
<td class="w-50 align-middle">Clé analytics (eg: UA-XX196604-1)</td>
|
||||
<td class="align-middle"><input name="analytics" class="form-control" value="{{ $settings->analytics }}" type="text"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@
|
|||
@foreach($winnersList as $winner)
|
||||
<tr>
|
||||
<td>{{ \Carbon\Carbon::parse($winner->created_at)->format('d/m/Y à H:i') }}</td>
|
||||
<td>{{$winner->instant_win->prize->label_one}}</td>
|
||||
<td>{{$winner->instantWin->prize->label_one}}</td>
|
||||
<td>{{$winner->user->email}}</td>
|
||||
@if ($settings->use_ean_codes === 1)
|
||||
<td>{{$winner->code_ean->code}}</td>
|
||||
<td>{{$winner->code_ean}}</td>
|
||||
@endif
|
||||
<td>{{$winner->code->code_unique}}</td>
|
||||
@if ($settings->winning_proof === 1)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<section>
|
||||
<div>
|
||||
<p>Bonjour,</p>
|
||||
<p>Le lot suivant a été gagné : <b>{{ $participation->instant_win->prize->label_one}}</b> le {{ \Carbon\Carbon::parse($participation->created_at)->format('d/m/Y à H:i') }}</p><br>
|
||||
<p>Le lot suivant a été gagné : <b>{{ $participation->instantWin->prize->label_one}}</b> le {{ \Carbon\Carbon::parse($participation->created_at)->format('d/m/Y à H:i') }}</p><br>
|
||||
<p><b>Gagnant :</b></p>
|
||||
<p>{{ $participation->user->lastname }} {{ $participation->user->firstname }}</p>
|
||||
<p>{{ $participation->user->address }}</p>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<p>{{ $participation->user->email }}</p><br/>
|
||||
<p><b>Codes utilisé@if (isset($participation->code_ean))s @endif :</b></p>
|
||||
@if (isset($participation->code_ean))
|
||||
<p>- Code On Pack : {{ $participation->code_ean->code }}</p>
|
||||
<p>- Code On Pack : {{ $participation->code_ean }}</p>
|
||||
@endif
|
||||
<p>- Code Unique : {{ $participation->code->code_unique }}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Bo\BannedIPController;
|
||||
use App\Http\Controllers\Bo\BannedIpController;
|
||||
use App\Http\Controllers\Bo\CodesController;
|
||||
use App\Http\Controllers\Bo\CodesEANController;
|
||||
use App\Http\Controllers\Bo\ContentController;
|
||||
|
|
@ -49,9 +49,9 @@ Route::prefix('bo')
|
|||
Route::post('/ajax/save-codes-ean', [CodesEANController::class, 'saveDatas'])
|
||||
->withoutMiddleware('is-super-admin');
|
||||
// IP Bannies.
|
||||
Route::get('/banned-ip', [BannedIPController::class, 'index'])->name('banned-ip');
|
||||
Route::post('/ajax/delete-banned-ip', [BannedIPController::class, 'destroy']);
|
||||
Route::post('/ajax/save-banned-ip', [BannedIPController::class, 'saveDatas']);
|
||||
Route::get('/banned-ip', [BannedIpController::class, 'index'])->name('banned-ip');
|
||||
Route::post('/ajax/delete-banned-ip', [BannedIpController::class, 'destroy']);
|
||||
Route::post('/ajax/save-banned-ip', [BannedIpController::class, 'saveDatas']);
|
||||
// FAQ - Thèmes.
|
||||
Route::get('/faq-themes', [FaqThemesController::class, 'index'])->name('faq-themes');
|
||||
Route::post('/ajax/delete-faq-theme', [FaqThemesController::class, 'destroy']);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue