first clean -> 1.0.1

This commit is contained in:
Vincent BRIDIER 2022-08-25 12:26:43 +02:00
parent 7ffa7f67a6
commit 78b5a223a7
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
122 changed files with 2516 additions and 86885 deletions

View file

@ -3,19 +3,17 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=
APP_THEME=
PROJECT_UUID=
ANALYTICS_GOOGLE_ID=
APP_THEME=basic
LOG_CHANNEL=daily
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=dev-mariadb
DB_PORT=3306
DB_DATABASE=laravel
DB_DATABASE=
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@ -23,38 +21,23 @@ QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_HOST=dev-mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=equipe.web@ldc.fr
MAIL_FROM_NAME="${APP_NAME}"
MAIL_ADMIN=informatique.internet@ldc.fr
MAIL_LIST_SERVICEWEB=informatique.internet@ldc.fr
MAIL_LIST_INVALIDINCO=informatique.internet@ldc.fr,vincent.pierre@ldc.fr,christelle.manceau@ldc.fr
MAIL_LIST_SERVICEWEB=equipe.web@ldc.fr
MAIL_LIST_INVALIDINCO=equipe.web@ldc.fr,vincent.pierre@ldc.fr,christelle.manceau@ldc.fr
# CRM
CRM_ENDPOINT=https://ldcldccrm:K5cJmTsG@dev.ldc-crm.fr
# service boutique
# Service boutique
CRM_TOKEN=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# LDC Web Status Checker
PROJECT_UUID=
# Google Analytics
ANALYTICS_GOOGLE_ID=

3
.gitignore vendored
View file

@ -5,6 +5,8 @@
/public/images/gammes
/public/images/produits
/public/images/slides
/public/b-o/
/public/mix-manifest.json
/storage/*.key
/vendor
.env
@ -16,3 +18,4 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
auth.json

View file

@ -1,7 +1,20 @@
## 1.0.1
- Change LDC CRM Client repository
- composer update
- Update .gitignore
- Delete compiled assets
- Replace informatique.internet -> equipe.web
- Complete README.md
- Delete credentials from front folder..
- Delete tests folder and PHPUnit file
- Update PHPCS file
- Add mix() for assets
- PHPCBF
## 1.0.0
Init versioning
## 19-03-2022
* legal RGPD routes always accessible
* privatisable routes
* quickorder route
* quickorder route
* quickorder route activated by theme settings
* improved tooltip for product reference wher regate orders are active

View file

@ -1,23 +1,38 @@
## Boutique Click N Collect
## Required systems
* supervisor
# Boutique Click N Collect
## Installation
```
composer install
php artisan storage:link
cd /ressources/views/front/
mkdir <theme-folder>
cd <theme-folder>
git clone <theme-repo> .
cd ../../../.../
npm install && npm run prod
cp .env.example .env
php artisan key:generate
```
Edit .env file then :
```
php artisan migrate --seed
```
## Theme
```
cd resources/views/front/
git clone [REPO_URL] --branch=[THEME_BRANCH_NAME] [THEME_NAME]
```
Ex:
```
git clone [REPO_URL] --branch=develop-mairet mairet
```
Update APP_THEME value in .env :
```
APP_THEME=[THEME_NAME]
```
Ex:
```
APP_THEME=mairet
```
Project root :
```
npm install && npm run prod
```
## Back-Office
Création de compte
@ -27,3 +42,6 @@ php artisan create:admin
```
URL : /bo
## Required systems
* supervisor

View file

@ -35,23 +35,23 @@ class CreateAdmin extends Command
/**
* Execute the console command.
*
* @return int
* @return integer
*/
public function handle()
{
$firstname = $this->ask('What is the firstname?','Equipe');
$lastname = $this->ask('What is the lastname?','Web');
$email = $this->ask('What is the email?', 'equipe.web@ldc.fr');
$pwd = $this->secret('What is the password?');
$firstname = $this->ask('What is the firstname?', 'Equipe');
$lastname = $this->ask('What is the lastname?', 'Web');
$email = $this->ask('What is the email?', 'equipe.web@ldc.fr');
$pwd = $this->secret('What is the password?');
$user = new User();
$user->firstname = $firstname;
$user->lastname = $lastname;
$user->date_of_birth = now();
$user->email = $email;
$user->password = Hash::make($pwd);
$user = new User();
$user->firstname = $firstname;
$user->lastname = $lastname;
$user->date_of_birth = now();
$user->email = $email;
$user->password = Hash::make($pwd);
$user->email_verified_at = now();
$user->role = 1;
$user->role = 1;
$user->save();
$this->info('User created.');

View file

@ -7,7 +7,6 @@ use App\Jobs\CsvSalariesReader as JobCsvSalarieReader;
class ImportSalaries extends Command
{
/**
* The name and signature of the console command.
*
@ -35,16 +34,14 @@ class ImportSalaries extends Command
/**
* Execute the console command.
*
* @return int
* @return integer
*/
public function handle()
{
$this->info('Running the Job, this could take some time.');
$job = new JobCsvSalarieReader();
$job = new JobCsvSalarieReader();
$job->console = $this;
$job->handle();
$this->info('Job completed');
}
}

View file

@ -1,11 +1,12 @@
<?php
/*
* Command Name: LDC Web Status Checker
* Description: Envoi des infos Serveur/Laravel vers LDC Web
* Version: 1.0
* Author: Vincent BRIDIER
* Author URI: vincent.bridier@ldc.fr
*/
* Command Name: LDC Web Status Checker
* Description: Envoi des infos Serveur/Laravel vers LDC Web
* Version: 1.0
* Author: Vincent BRIDIER
* Author URI: vincent.bridier@ldc.fr
*/
namespace App\Console\Commands;
@ -44,28 +45,28 @@ class LDCWebStatusChecker extends Command
*/
public function handle()
{
$data = [];
$data = [];
$data['uuid'] = config('ldcweb.project_uuid');
// Sitemap.xml ?
if (file_exists(public_path() . '/sitemap.xml')) {
$data['sitemap'] = 'true';
}else{
} else {
$data['sitemap'] = 'false';
}
// Robots.txt ?
if (file_exists(public_path() . '/robots.txt')) {
$data['robots'] = 'true';
}else{
} else {
$data['robots'] = 'false';
}
//Check logs
// Check logs
$data['logs'] = 0;
$patherror = storage_path('/logs');
$files = glob($patherror.'/*.log');
if(count($files) > 0){
$patherror = storage_path('/logs');
$files = glob($patherror . '/*.log');
if (count($files) > 0) {
foreach ($files as $file) {
$data['logs'] = $data['logs'] + filesize($file);
}
@ -74,8 +75,8 @@ class LDCWebStatusChecker extends Command
$data['code']['version'] = app()->version();
// Send by cURL
$url = 'https://ldc-web.ldc.fr/api/status-checker';
$ch = curl_init($url);
$url = 'https://ldc-web.ldc.fr/api/status-checker';
$ch = curl_init($url);
$payload = ['token' => 'CE8S52Qq7stf5k8frF4T', 'datas' => json_encode($data)];
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

View file

@ -7,7 +7,6 @@ use Illuminate\Console\Command;
class RefreshSiteMap extends Command
{
/**
* The name and signature of the console command.
*
@ -25,12 +24,12 @@ class RefreshSiteMap extends Command
/**
* Execute the console command.
*
* @return int
* @return integer
*/
public function handle()
{
$this->info('Running the Job, this could take some time.');
$job = new JobsRefreshSiteMap();
$job = new JobsRefreshSiteMap();
$job->console = $this;
$job->handle();
$this->info('Job completed');

View file

@ -7,7 +7,6 @@ use Illuminate\Console\Command;
class XmlIncoReader extends Command
{
/**
* The name and signature of the console command.
*
@ -30,7 +29,7 @@ class XmlIncoReader extends Command
public function handle()
{
$this->info('Running the Job, this could take some time.');
$job = new JobsXmlIncoReader();
$job = new JobsXmlIncoReader();
$job->console = $this;
$job->handle();
$this->info('Job completed');

View file

@ -14,13 +14,12 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
];
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
@ -28,7 +27,7 @@ class Kernel extends ConsoleKernel
$schedule->command('sitemap:refresh')->dailyAt('16:13');
$schedule->command('ldcweb:statuschecker')->everyFifteenMinutes();
$schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->onOneServer()->dailyAt('15:00');
//$schedule->job(new XmlIncoReader)->weeklyOn(1, '8:00');
// $schedule->job(new XmlIncoReader)->weeklyOn(1, '8:00');
}
/**
@ -38,7 +37,7 @@ class Kernel extends ConsoleKernel
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');
require base_path('routes/console.php');
}

View file

@ -6,5 +6,4 @@ use Exception;
class AbortCsvImportException extends Exception
{
//
}

View file

@ -5,7 +5,6 @@ namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use RuntimeException;
use Throwable;
@ -17,8 +16,7 @@ class Handler extends ExceptionHandler
* @var array
*/
protected $dontReport = [
//
];
];
/**
* A list of the inputs that are never flashed for validation exceptions.
@ -37,7 +35,6 @@ class Handler extends ExceptionHandler
*/
public function register()
{
//
}
protected function unauthenticated($request, AuthenticationException $exception)
@ -54,15 +51,15 @@ class Handler extends ExceptionHandler
$login = 'auth.login';
break;
}
//cf. issue https://stackoverflow.com/questions/52417438/laravel-unauthenticated-redirect-issue-with-multiple-authentication
//Session::forget('url.intented');
// cf. issue https://stackoverflow.com/questions/52417438/laravel-unauthenticated-redirect-issue-with-multiple-authentication
// Session::forget('url.intented');
return redirect()->guest(route($login));
}
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @param \Throwable $exception
* @return void
*
* @throws \Exception
@ -95,6 +92,6 @@ class Handler extends ExceptionHandler
// do nothing, mail send error, let laravel only handle this
} finally {
parent::report($e);
}
}//end try
}
}

View file

@ -35,7 +35,6 @@ class RegisterController extends Controller
]);
// Envoi mail activation
return redirect()->route('auth.register')->with('success', 'Mail envoyé pour confirmation');
}
}

View file

@ -16,7 +16,7 @@ class BasketController extends Controller
public function addToCart(Request $request)
{
$instance = $request->instance ?? "panier";
$product = Product::find($request->id);
$product = Product::find($request->id);
Cart::instance($instance);
Cart::add($product, $request->qty);
return $this->getCart($instance);
@ -30,7 +30,7 @@ class BasketController extends Controller
$instance = $request->instance ?? "panier";
Cart::instance($instance);
$lot = $request->items;
foreach($lot as $item) {
foreach ($lot as $item) {
$product = Product::find($item["cartItem"]["id"]);
Cart::add($product, $item["cartItem"]["qty"]);
}
@ -43,7 +43,7 @@ class BasketController extends Controller
public function removeFromCart(Request $request)
{
$instance = $request->instance ?? "panier";
$rowId = $request->rowId;
$rowId = $request->rowId;
Cart::instance($instance);
Cart::remove($rowId);
return $this->getCart($instance);
@ -52,7 +52,8 @@ class BasketController extends Controller
/**
* vidage de panier
*/
public function emptyCart(Request $request) {
public function emptyCart(Request $request)
{
$instance = $request->instance ?? "panier";
Cart::instance($instance);
Cart::destroy();
@ -76,7 +77,7 @@ class BasketController extends Controller
$dbpanier = new Collection();
foreach (Cart::content() as $row) {
$product = $row->model;
//$product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
// $product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
$product->calculatedPrices = $product->getCalcPrices();
$row->setTaxRate($product->tax->rate);
@ -91,30 +92,42 @@ class BasketController extends Controller
$cartInfos = array(
"totalTTC" => Cart::total(),
'totalTVA' => Cart::tax(), //total des taxes
'totalHT' => Cart::subtotal(), //total sans les taxes
'totalweight' => Cart::weight(), //poids total des items
'totalHTbefore' => Cart::priceTotal(), //total avant taxes et remises
'totaldiscount' => Cart::discount(), //total des remises
'countItems' => Cart::count(), //nb de produits dans le cart
'totalTVA' => Cart::tax(),
// total des taxes
'totalHT' => Cart::subtotal(),
// total sans les taxes
'totalweight' => Cart::weight(),
// poids total des items
'totalHTbefore' => Cart::priceTotal(),
// total avant taxes et remises
'totaldiscount' => Cart::discount(),
// total des remises
'countItems' => Cart::count(),
// nb de produits dans le cart
);
$cartInfosNoPrice = array(
"totalTTC" => "-.--",
'totalTVA' => "-.--", //total des taxes
'totalHT' => "-.--", //total sans les taxes
'totalweight' => Cart::weight(), //poids total des items
'totalHTbefore' => "-.--", //total avant taxes et remises
'totaldiscount' => "-.--", //total des remises
'countItems' => Cart::count(), //nb de produits dans le cart
'totalTVA' => "-.--",
// total des taxes
'totalHT' => "-.--",
// total sans les taxes
'totalweight' => Cart::weight(),
// poids total des items
'totalHTbefore' => "-.--",
// total avant taxes et remises
'totaldiscount' => "-.--",
// total des remises
'countItems' => Cart::count(),
// nb de produits dans le cart
);
$cartReturn = array($dbpanier,$cartInfosNoPrice);
if (config('bosettings.show_prices_authenticated') == "authenticated") {
{
if (Auth::guard('customer')->check()) {
$cartReturn = array($dbpanier,$cartInfos);
}
if (Auth::guard('customer')->check()) {
$cartReturn = array($dbpanier,$cartInfos);
}
}
}
if (config('bosettings.show_prices_guest') == "guest") {

View file

@ -13,9 +13,9 @@ class ContentController extends Controller
$content = Content::where('key', $key)->first();
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$banner = $request->banner;
$title = $request->title;
$chapeau = $request->chapeau;
$banner = $request->banner;
$title = $request->title;
$chapeau = $request->chapeau;
$maintext = $request->value;
$request->validate([
@ -34,14 +34,14 @@ class ContentController extends Controller
$content->banner = $imageName;
}
$content->title = $title;
$content->title = $title;
$content->chapeau = $chapeau;
$content->value = $maintext;
$content->value = $maintext;
$content->save();
return redirect()->route('bo.content', ['key' => $content->key, 'content' => $content])
->with('success', 'Modifications enregistrés !');
}
}//end if
return view('bo.content.manage', compact('content'));
}

View file

@ -9,46 +9,47 @@ use Illuminate\Http\Request;
class CreneauxController extends Controller
{
public function settings(Request $request,$id)
public function settings(Request $request, $id)
{
$magasin = Magasin::findOrFail($id);
$timeslotSettings = $magasin->timeslotSettings;
$magasin = Magasin::findOrFail($id);
$timeslotSettings = $magasin->timeslotSettings;
if ($timeslotSettings->count() === 0) {
//Aucun settings pour ce magasin
// Aucun settings pour ce magasin
$timeslotSettings = $this->makeCreneauxSettings($id);
}
return view('bo.creneaux.settings', compact('timeslotSettings', 'magasin'));
}
public function makeCreneauxSettings($id) {
for ($i=0;$i<7;$i++) {
$dayset = new TimeslotSetting();
public function makeCreneauxSettings($id)
{
for ($i = 0; $i < 7; $i++) {
$dayset = new TimeslotSetting();
$dayset->magasin_id = $id;
$dayset->day_index = ''.$i;
$dayset->day_index = '' . $i;
$dayset->save();
}
return Magasin::findOrFail($id)->timeslotSettings;
}
public function updateSettings(Request $request,$id)
public function updateSettings(Request $request, $id)
{
$plage = $request->plage;
$plage = $request->plage;
$magasin_id = $id;
foreach($plage as $index => $day) {
$setting = TimeslotSetting::where('day_index', ''.$index)
foreach ($plage as $index => $day) {
$setting = TimeslotSetting::where('day_index', '' . $index)
->where('magasin_id', $magasin_id)
->firstOrFail();
//$setting->magasin_id = $magasin_id; ne doit pas changer
$setting->morning_start = $day['morning_start'];
$setting->morning_end = $day['morning_end'];
$setting->afternoon_start = $day['afternoon_start'];
$setting->afternoon_end = $day['afternoon_end'];
$setting->interval = $day['interval'];
// $setting->magasin_id = $magasin_id; ne doit pas changer
$setting->morning_start = $day['morning_start'];
$setting->morning_end = $day['morning_end'];
$setting->afternoon_start = $day['afternoon_start'];
$setting->afternoon_end = $day['afternoon_end'];
$setting->interval = $day['interval'];
$setting->max_orders_per_interval = $day['max_orders_per_interval'];
$setting->min_order_preparation = $day['min_order_preparation'];
$setting->min_order_preparation = $day['min_order_preparation'];
$setting->save();
}

View file

@ -8,24 +8,26 @@ use Illuminate\Http\Request;
class FaqController extends Controller
{
public function index() {
public function index()
{
$faq = Faq::all();
return view('bo.faq.index', compact('faq'));
}
public function saveDatas(Request $request) {
public function saveDatas(Request $request)
{
$faq = $request->faq;
for ($i = 0; $i < count($faq); $i++) {
$faqToInsert = !empty($faq[$i]["question"]) && !empty($faq[$i]["answer"]);
if (isset($faq[$i]["id"]) && $faq[$i]["id"] !== null && $faqToInsert) {
$f = Faq::findOrFail($faq[$i]["id"]);
$f = Faq::findOrFail($faq[$i]["id"]);
$f->question = $faq[$i]["question"];
$f->answer = $faq[$i]["answer"];
$f->answer = $faq[$i]["answer"];
$f->save();
} else {
if ($faqToInsert) {
$c = Faq::updateOrCreate(['question' => $faq[$i]["question"], 'answer' => $faq[$i]["answer"]]);
$c = Faq::updateOrCreate(['question' => $faq[$i]["question"], 'answer' => $faq[$i]["answer"]]);
$faq[$i]["id"] = $c->id;
} else {
unset($faq[$i]);
@ -37,7 +39,8 @@ class FaqController extends Controller
return $faq;
}
public function destroy(Request $request) {
public function destroy(Request $request)
{
$faq = Faq::findOrFail($request->id);
$faq->delete();

View file

@ -33,7 +33,7 @@ class MagasinsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -52,23 +52,22 @@ class MagasinsController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$magasin = Magasin::findOrFail($id);
$magasin = Magasin::findOrFail($id);
$exceptionsCollecte = $magasin->collecteExceptions()->orderBy('date')->get();
return view('bo.magasins.edit', compact('magasin', 'exceptionsCollecte'));
}
@ -76,8 +75,8 @@ class MagasinsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
@ -97,7 +96,7 @@ class MagasinsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
@ -110,7 +109,6 @@ class MagasinsController extends Controller
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 point de retrait.");
}
// @todo : controller les crenaux settings liés
$shop->delete();
return redirect()->route('bo.magasins.index');
}
@ -122,11 +120,11 @@ class MagasinsController extends Controller
public function getMagasinInfo($id, $mode = null)
{
$magasin = Magasin::findOrFail($id);
if(!is_null($mode)) {
if($mode=="tippy") {
if (!is_null($mode)) {
if ($mode == "tippy") {
return view('bo.magasins.tippy-card', compact('magasin'));
}
if($mode=="json") {
if ($mode == "json") {
return $magasin;
}
return view('bo.magasins.info-card', compact('magasin'));
@ -141,41 +139,40 @@ class MagasinsController extends Controller
for ($i = 0; $i < count($collecteException); $i++) {
$collecteExceptionToInsert = !empty($collecteException[$i]["date"]);
if (isset($collecteException[$i]["id"]) && $collecteException[$i]["id"] !== null && $collecteExceptionToInsert) {
$ce = CollecteException::findOrFail($collecteException[$i]["id"]);
$ce->date = $collecteException[$i]["date"];
$ce->comment = $collecteException[$i]["comment"];
$ce = CollecteException::findOrFail($collecteException[$i]["id"]);
$ce->date = $collecteException[$i]["date"];
$ce->comment = $collecteException[$i]["comment"];
$ce->magasin_id = $collecteException[$i]["magasin_id"];
$ce->save();
} else {
if ($collecteExceptionToInsert) {
$ce = CollecteException::updateOrCreate([
$ce = CollecteException::updateOrCreate([
'date' => $collecteException[$i]["date"],
'comment' => $collecteException[$i]["comment"],
'magasin_id' => $collecteException[$i]["magasin_id"]
]);
$collecteException[$i]["id"] = $ce->id;
} else {
unset($collecteException[$i]);
$i--;
}
}
}
}//end for
//remet dans l'ordre avant de renvoyer
//$collecteException = CollecteException::where('magasin_id',)->orderBy('date')->get();
// remet dans l'ordre avant de renvoyer
// $collecteException = CollecteException::where('magasin_id',)->orderBy('date')->get();
$this->arraySortByColumn($collecteException, "date");
return $collecteException;
}
/**
* helper function
*/
public function arraySortByColumn(&$array, $column, $direction = SORT_ASC) {
public function arraySortByColumn(&$array, $column, $direction = SORT_ASC)
{
$reference_array = array();
foreach($array as $key => $row) {
foreach ($array as $key => $row) {
$reference_array[$key] = $row[$column];
}

View file

@ -22,10 +22,8 @@ use Carbon\CarbonImmutable;
use Carbon\CarbonInterval;
use Gloudemans\Shoppingcart\Facades\Cart;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Exception;
class OrdersController extends Controller
{
@ -34,8 +32,7 @@ class OrdersController extends Controller
*/
public function index(SortOrders $request)
{
//$orders = Order::orderBy('date', 'DESC')->get();
// $orders = Order::orderBy('date', 'DESC')->get();
$orders = $this->filterOrders($request);
$orders = $orders->paginate(10);
@ -45,19 +42,18 @@ class OrdersController extends Controller
public function today(SortOrders $request)
{
//$orders = Order::orderBy('date', 'DESC')->get();
// $orders = Order::orderBy('date', 'DESC')->get();
$orders = $this->filterOrders($request);
//filter today
// filter today
$today = CarbonImmutable::now()->startOfDay();
$orders = $orders->whereHas('timeslot', function ($q) use ($today) {
$q->where('day', '=', $today->format('d/m/Y'));
});
$orders = $orders->get(); //paginate(20);
$orders = $orders->get();
// paginate(20);
return view('bo.orders.index', compact('orders', 'today'));
}
@ -102,8 +98,8 @@ class OrdersController extends Controller
case 'customer_id':
$orders = $orders->orderBy('customer_id', Session::get('orders.sort_way'));
break;
}
}
}//end switch
}//end if
return $orders;
}
@ -111,7 +107,7 @@ class OrdersController extends Controller
/**
* action de changement de statut vers l'avant
* envoi de mails transctionnels
* @param String $reference reference de la commande
* @param string $reference reference de la commande
*/
public function changeStatus($reference)
{
@ -119,10 +115,10 @@ class OrdersController extends Controller
$order->status_id = $order->status_id + 1;
$order->save();
//send confirm mail
// send confirm mail
Mail::to($order->customer->email)->send(new OrderStatusMail($order));
//return redirect()->route('bo.orders')->with('success', "Changement de status enregistré pour la commande " . $order->reference . ".");
// return redirect()->route('bo.orders')->with('success', "Changement de status enregistré pour la commande " . $order->reference . ".");
return back()->with('success', "Changement de status enregistré pour la commande " . $order->reference . ".");
}
@ -135,7 +131,7 @@ class OrdersController extends Controller
$order->status_id = 7;
$order->save();
//return redirect()->route('bo.orders')->with('success', "La commande à été annulée.");
// return redirect()->route('bo.orders')->with('success', "La commande à été annulée.");
return back()->with('success', "La commande " . $order->reference . " à été annulée.");
}
@ -173,12 +169,18 @@ class OrdersController extends Controller
$cartInfos = array(
"totalTTC" => Cart::total(),
'totalTVA' => Cart::tax(), //total des taxes
'totalHT' => Cart::subtotal(), //total sans les taxes
'totalweight' => Cart::weight(), //poids total des items
'totalHTbefore' => Cart::priceTotal(), //total avant taxes et remises
'totaldiscount' => Cart::discount(), //total des remises
'countItems' => Cart::count(), //nb de produits dans le cart
'totalTVA' => Cart::tax(),
// total des taxes
'totalHT' => Cart::subtotal(),
// total sans les taxes
'totalweight' => Cart::weight(),
// poids total des items
'totalHTbefore' => Cart::priceTotal(),
// total avant taxes et remises
'totaldiscount' => Cart::discount(),
// total des remises
'countItems' => Cart::count(),
// nb de produits dans le cart
);
return view('sales.recap', compact('activestep', 'cart', 'cartInfos'));
@ -190,10 +192,10 @@ class OrdersController extends Controller
*/
public function store()
{
//save
// save
Cart::instance('panier');
$order = new Order();
//generate order ref
// generate order ref
$order->reference = $this->generateOrderRef();
$order->date = Carbon::now();
$order->status_id = 1;
@ -202,7 +204,7 @@ class OrdersController extends Controller
$order->save();
//order_id
// order_id
Cart::instance('panier');
$cart = Cart::content();
foreach ($cart as $cartItem) {
@ -210,29 +212,29 @@ class OrdersController extends Controller
$order_line->order_id = $order->id;
$order_line->product_id = $cartItem->model->id;
$order_line->quantity = $cartItem->qty;
//gross unit price
// gross unit price
$order_line->unit_price = $cartItem->model->priceHt;
//discount per unit
// discount per unit
$order_line->unit_discount = $cartItem->model->discountAmount;
//tax rate for this line
// tax rate for this line
$order_line->tax_rate = $cartItem->taxRate;
//tax amount par unit
// tax amount par unit
$order_line->unit_tax = round(( ($order_line->unit_price - $order_line->unit_discount) * ($order_line->tax_rate / 100) ) * 100) / 100;
//discount amount for the line
// discount amount for the line
$order_line->total_discount = $order_line->unit_discount * $order_line->quantity;
//gross amount for the line
// gross amount for the line
$order_line->total_ht = ($order_line->unit_price - $order_line->unit_discount) * $order_line->quantity;
//tax amount for the line
// tax amount for the line
$order_line->total_tax = $order_line->unit_tax * $order_line->quantity;
//total TTC avec remises de la ligne
// total TTC avec remises de la ligne
$order_line->total_ttc = $order_line->total_ht + $order_line->total_tax;
$order_line->save();
}
}//end foreach
//empty cart
// empty cart
Cart::destroy();
//then redirect
// then redirect
return redirect()->route('sales.pick-slot', ['reference' => $order->reference]);
}
@ -243,14 +245,14 @@ class OrdersController extends Controller
public function generateOrderRef()
{
//Avant
//Str::uuid();
//maintenant
//format : YYYYMMDDHHMM000
// Avant
// Str::uuid();
// maintenant
// format : YYYYMMDDHHMM000
$now = Carbon::now();
//count todays orders
// count todays orders
$countorders = Order::whereDate('created_at', Carbon::today())->count();
//add one
// add one
$countorders++;
$ref = $now->isoFormat('YYYYMMDDHHmm') . str_pad($countorders, 3, "0", STR_PAD_LEFT);
return $ref;
@ -269,9 +271,8 @@ class OrdersController extends Controller
}
$availCreneaux = array();
//plus besoin car chargé par le composant vue.
//$availCreneaux = $this->getAvailableCreneauxByShop($magasin->id);
// plus besoin car chargé par le composant vue.
// $availCreneaux = $this->getAvailableCreneauxByShop($magasin->id);
$order = Order::where('reference', '=', $reference)->firstOrFail();
return view('sales.pick-slot', compact('activestep', 'availCreneaux', 'order', 'magasin'));
@ -282,13 +283,13 @@ class OrdersController extends Controller
*/
public function getAvailableCreneauxByShop($id)
{
//setting à stocker et réutiliser
// setting à stocker et réutiliser
$plage_days = Setting::where('key', 'order_withdrawal_period')->firstOrFail()->value;
$magasin = Magasin::findOrFail($id);
$timeslotSettings = $magasin->timeslotSettings;
//$timeslotSettings = TimeslotSetting::all();
//fabriquons un tableau recap
// $timeslotSettings = TimeslotSetting::all();
// fabriquons un tableau recap
$plage = array();
foreach ($timeslotSettings as $day) {
$plage[$day->day_index] = array(
@ -302,18 +303,18 @@ class OrdersController extends Controller
);
}
//génération des plages
//start today
// génération des plages
// start today
$today = CarbonImmutable::now()->startOfDay();
$weekDay = $today->weekday();
//final boundary (permet de limiter la liste des jours d'exception)
// final boundary (permet de limiter la liste des jours d'exception)
$finalday = $today->add($plage_days, 'day');
$now = CarbonImmutable::now();
//jours exceptions
// jours exceptions
// $noCollectDays = CollecteException::where('magasin_id',$magasin->id)
// ->whereDate('date', '>', $now)
// ->whereDate('date', '<=', $finalday)
// ->orderBy('date')->get();
// ->whereDate('date', '>', $now)
// ->whereDate('date', '<=', $finalday)
// ->orderBy('date')->get();
$noCollectDays = $magasin->collecteExceptions()
->whereDate('date', '>', $now)
->whereDate('date', '<=', $finalday)
@ -329,7 +330,7 @@ class OrdersController extends Controller
$weekDay = $current->weekday();
$interval = CarbonInterval::createFromFormat('h:i', $plage[$weekDay]['interval'] ?? '00:15');
//si c'est un jour exception skip
// si c'est un jour exception skip
$skip = false;
foreach ($noCollectDays as $not_today) {
if ($current->isSameDay($not_today->date)) {
@ -339,7 +340,7 @@ class OrdersController extends Controller
if ($skip) {
continue;
}
//matinée
// matinée
if (!empty($plage[$weekDay]['morning_start'])) {
$currentTime = Carbon::createFromTimeString($plage[$weekDay]['morning_start']);
$endTime = Carbon::createFromTimeString($plage[$weekDay]['morning_end']);
@ -350,8 +351,7 @@ class OrdersController extends Controller
->where('time', $creneau)->count();
// $nbtakens = Timeslot::where('day', $current->format('d/m/Y'))
// ->where('time', $creneau)->count();
// ->where('time', $creneau)->count();
if ($nbtakens >= $plage[$weekDay]['max_orders_per_interval']) {
$isDispo = false;
} else {
@ -361,14 +361,14 @@ class OrdersController extends Controller
if ($current->addHours($currentTime->format('H'))->addMinutes($currentTime->format('i')) < $now->add($delaiPrepa)) {
$isDispo = false;
}
//attention si la date est passée (today mais avant maintenant) : pas de créneau
// attention si la date est passée (today mais avant maintenant) : pas de créneau
if ($current > $today || $currentTime >= $now) {
$availCreneaux[$current->format('d/m/Y')][] = array($creneau,$isDispo);
}
$currentTime->add($interval);
} while ($currentTime <= $endTime);
}
//aprem
}//end if
// aprem
if (!empty($plage[$weekDay]['afternoon_start'])) {
$currentTime = Carbon::createFromTimeString($plage[$weekDay]['afternoon_start']);
$endTime = Carbon::createFromTimeString($plage[$weekDay]['afternoon_end']);
@ -385,18 +385,18 @@ class OrdersController extends Controller
$isDispo = false;
}
//attention si la date est passée (today mais avant maintenant) : pas de créneau
// attention si la date est passée (today mais avant maintenant) : pas de créneau
if ($current > $today || $currentTime >= $now) {
$availCreneaux[$current->format('d/m/Y')][] = array($creneau,$isDispo);
}
$currentTime->add($interval);
} while ($currentTime <= $endTime);
}
}
}//end if
}//end for
return $availCreneaux;
}
//call ajax pour le composant vue de timeslots
// call ajax pour le composant vue de timeslots
public function getAvailableCreneaux(Request $request)
{
return $this->getAvailableCreneauxByShop($request->id);
@ -424,7 +424,7 @@ class OrdersController extends Controller
if ($order->status_id == 1) {
// on ne traite l'enregistrement que pour les commandes en attente venant de l'étape de récap
//save timeslot
// save timeslot
$timeslot = Timeslot::firstOrNew(['order_id' => $order->id]);
$timeslot->order_id = $order->id;
$timeslot->magasin_id = $magasin_id;
@ -432,14 +432,14 @@ class OrdersController extends Controller
$timeslot->time = $tstime;
$timeslot->save();
//save order status
// save order status
$order->status_id = 3;
$order->save();
//send confirm mail
// send confirm mail
Mail::to($order->customer->email)->queue(new OrderConfirmMail($order));
//envoi du mail de confirmation aux admins site
// envoi du mail de confirmation aux admins site
$toMailSetting = Setting::where('key', 'send_order_confirm_mail_to')->first();
if (empty($toMailSetting->value)) {
$toMail = config('mail.from.address');
@ -448,13 +448,13 @@ class OrdersController extends Controller
}
Mail::to($toMail)->queue(new OrderConfirmAdminMail($order));
//export commande
// export commande
if (config('bosettings.regate_orders')) {
CsvOrderWrite::dispatch($order);
}
}
}//end if
//redirect to final confirmation
// redirect to final confirmation
return redirect()->route('sales.confirm', ['reference' => $order->reference]);
}
@ -477,7 +477,7 @@ class OrdersController extends Controller
$idcommande = Session::get('idcommande');
$order = Order::where('reference', '=', $reference)->firstOrFail();
//1 seul magasin en base pour le moment
// 1 seul magasin en base pour le moment
$magasin = Magasin::find($order->timeslot->magasin->id);
return view('sales.confirm', compact('activestep', 'order', 'magasin'));

View file

@ -40,13 +40,13 @@ class ProductsController extends Controller
}
$products = $products->paginate(10);
//ici récupération des infos additionnelles pour affichage dans la liste
// ici récupération des infos additionnelles pour affichage dans la liste
// @todo : parametrer l'occurence de ces affichages car ça n'aura aucun sens selon le type de produit
foreach ($products as &$product) {
if(!empty($product->product_type)) {
if (!empty($product->product_type)) {
$product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
if ($product->additionnalProductInfo === null) {
//n'existe pas on renseigne un vide
// n'existe pas on renseigne un vide
$product_type = $product->product_type;
$modelClass = 'App\Models\\' . ucfirst($product_type);
$product->$product_type = new $modelClass();
@ -64,15 +64,15 @@ class ProductsController extends Controller
{
if (!empty($product_type) && !array_key_exists($product_type, config('theme.enum_product_types'))) {
abort(404, "Cette page n'existe pas.");
//return redirect()->route('bo.products.index');
// return redirect()->route('bo.products.index');
}
$modelClass = 'App\Models\\' . ucfirst($product_type);
$product = new Product();
if(!empty($product_type)) {
$modelClass = 'App\Models\\' . ucfirst($product_type);
$product = new Product();
if (!empty($product_type)) {
$product->$product_type = new $modelClass();
}
$ranges = Range::all();
$taxes = TaxRate::all();
$ranges = Range::all();
$taxes = TaxRate::all();
return view('bo.products.create', compact('product_type', 'product', 'ranges', 'taxes'));
}
@ -83,7 +83,7 @@ class ProductsController extends Controller
*/
public function store(ProductRequest $request)
{
//products fields
// products fields
$name = $request->name;
$description = $request->description;
$picture = $request->picture;
@ -99,7 +99,7 @@ class ProductsController extends Controller
$weight_unit = $request->weight_unit;
$status = $request->status === null ? 0 : 1;
$orderable_start = $request->orderable_start_date === null ? null : $request->orderable_start_date . " " . $request->orderable_start_time;
$orderable_end = $request->orderable_end_date === null ? null : $request->orderable_end_date . " " . $request->orderable_end_time;
$orderable_end = $request->orderable_end_date === null ? null : $request->orderable_end_date . " " . $request->orderable_end_time;
$star = $request->star === null ? 0 : 1;
$slug = Str::slug($name);
$rangeId = $request->range_id;
@ -163,7 +163,7 @@ class ProductsController extends Controller
$product->save();
}
//ajout des infos additionnelles
// ajout des infos additionnelles
$product_type = $request->product_type;
if ($product_type !== null) {
@ -174,7 +174,7 @@ class ProductsController extends Controller
}
//additionnal product info (foodProduct)
// additionnal product info (foodProduct)
return redirect()->route('bo.products.index');
}
@ -184,13 +184,12 @@ class ProductsController extends Controller
public function edit($id)
{
$product = Product::findOrFail($id);
if(!empty($product->product_type)) {
if (!empty($product->product_type)) {
$product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
//above lines equivalent to :
//$product = Product::with('additionnalProductInfo')->findOrFail($id);
// above lines equivalent to :
// $product = Product::with('additionnalProductInfo')->findOrFail($id);
if ($product->additionnalProductInfo === null) {
//n'existe pas on renseigne un vide
// n'existe pas on renseigne un vide
$product_type = $product->product_type;
$modelClass = 'App\Models\\' . ucfirst($product_type);
$product->$product_type = new $modelClass();
@ -215,8 +214,7 @@ class ProductsController extends Controller
public function update(Product $product, ProductRequest $request)
{
//$product = Product::findOrFail($id);
// $product = Product::findOrFail($id);
$orderable_end_time = $request->orderable_end_time === null ? "23:59" : $request->orderable_end_time;
$name = $request->name;
@ -234,7 +232,7 @@ class ProductsController extends Controller
$weight_unit = $request->weight_unit;
$status = $request->status === null ? 0 : 1;
$orderable_start = $request->orderable_start_date === null ? null : $request->orderable_start_date . " " . $request->orderable_start_time;
$orderable_end = $request->orderable_end_date === null ? null : $request->orderable_end_date . " " . $orderable_end_time;
$orderable_end = $request->orderable_end_date === null ? null : $request->orderable_end_date . " " . $orderable_end_time;
$star = $request->star === null ? 0 : 1;
$slug = Str::slug($name);
$rangeId = $request->range_id;
@ -312,37 +310,37 @@ class ProductsController extends Controller
$oldSlug->delete();
}
//ajout des infos additionnelles
// ajout des infos additionnelles
$product_type = $request->product_type;
//save additionnal
// save additionnal
if ($product_type !== null) {
$methodName = "save" . ucfirst($product_type);
$this->$methodName($request, $product->id);
}
//tags associés
// tags associés
if (!empty($tags)) {
$arTagIds = array();
foreach ($tags as $tag) {
$oTag = json_decode($tag);
if (empty($oTag->id)) {
//we need a new tag
// we need a new tag
$arTagIds[] = $this->storeTag($oTag);
} else {
$arTagIds[] = $oTag->id;
}
}
//prise en charge de la liaison avec les produits
// prise en charge de la liaison avec les produits
$product->tags()->sync($arTagIds);
} else {
$product->tags()->sync(array());
}
//produits associés
// produits associés
if (!empty($request->prods)) {
$productIds = explode(",", $request->prods);
//prise en charge de la liaison avec les produits
// prise en charge de la liaison avec les produits
$product->products()->sync($productIds);
} else {
$product->products()->sync(array());
@ -360,12 +358,13 @@ class ProductsController extends Controller
$slug = Str::slug($oTag->label);
$tag = Tag::where('slug', $slug)->first();
if ($tag === null) {
//si on pas encore ce tag on le crée
// si on pas encore ce tag on le crée
$tag = new Tag();
$tag->label = $oTag->label;
$tag->slug = Str::slug($oTag->label);
$tag->status = 1; //a new tag is published by default
$tag->order = TagsController::getLastOrder();
$tag->status = 1;
// a new tag is published by default
$tag->order = TagsController::getLastOrder();
$tag->save();
}
return $tag->id;
@ -395,22 +394,24 @@ class ProductsController extends Controller
/**
* check if inco data exists
*/
public function checkIncoData(Request $request) {
$id = $request->id;
public function checkIncoData(Request $request)
{
$id = $request->id;
$xmlInco = XmlInco::find($id);
if(!empty($xmlInco)) {
//we have data
$hasInco = __("Des données Inco sont disponibles, souhaitez vous les associer à ce produit ?");
if (!empty($xmlInco)) {
// we have data
$hasInco = __("Des données Inco sont disponibles, souhaitez vous les associer à ce produit ?");
$preparedImages = $this->prepareIncoImages($xmlInco->picture);
return view('bo.products.load-inco',compact('hasInco','xmlInco','preparedImages'));
return view('bo.products.load-inco', compact('hasInco', 'xmlInco', 'preparedImages'));
} else {
return array("data"=> array());
return array("data" => array());
}
}
public function getPrepareIncoImages(Request $request) {
$picture = $request->picture;
public function getPrepareIncoImages(Request $request)
{
$picture = $request->picture;
$preparedImages = $this->prepareIncoImages($picture);
return view('bo.products.inco-images', compact('preparedImages'));
}
@ -418,17 +419,18 @@ class ProductsController extends Controller
/**
* prepare Inco Images
*/
public function prepareIncoImages($picture) {
public function prepareIncoImages($picture)
{
$preparedImages = array();
foreach ($picture as $incoImage) {
//charge
if(File::exists(storage_path($incoImage))) {
// charge
if (File::exists(storage_path($incoImage))) {
$imagePath = storage_path($incoImage);
//redimensionne
//create mask
//Resize original image into mask
// redimensionne
// create mask
// Resize original image into mask
$this->resizeImg(
$imagePath,
config('theme.product_image_large_maxwidth'),
@ -445,8 +447,8 @@ class ProductsController extends Controller
$preparedImages[] = "inco/images/" . File::name($incoImage) . "_large.png";
}
}
}//end if
}//end foreach
return $preparedImages;
}
@ -479,30 +481,30 @@ class ProductsController extends Controller
}
// ---- Chargement de l'image source
$img = $image_create_func($imagePath);
$img = $image_create_func($imagePath);
list($imgWidth, $imgHeight) = getimagesize($imagePath);
// ---- Calcul les nouvelles dimensions de l'image
if($imgWidth > $imgHeight){
$finalWidth = $maskWidth;
$finalHeight = ($finalWidth*$imgHeight)/$imgWidth;
}else{
if ($imgWidth > $imgHeight) {
$finalWidth = $maskWidth;
$finalHeight = ($finalWidth * $imgHeight) / $imgWidth;
} else {
$finalHeight = $maskHeight;
$finalWidth = ($finalHeight*$imgWidth)/$imgHeight;
$finalWidth = ($finalHeight * $imgWidth) / $imgHeight;
}
// ---- Redimensionne l'image source
$resizeImg = imagecreatetruecolor($finalWidth, $finalHeight);
imagealphablending( $resizeImg, false );
imagesavealpha( $resizeImg, true );
imagealphablending($resizeImg, false);
imagesavealpha($resizeImg, true);
imagecopyresampled($resizeImg, $img, 0, 0, 0, 0, $finalWidth, $finalHeight, $imgWidth, $imgHeight);
// ---- Copie l'image redimensionnée dans le mask
imagecopy($mask, $resizeImg, ($maskWidth-$finalWidth)/2, ($maskHeight-$finalHeight)/2, 0, 0, imagesx($resizeImg), imagesy($resizeImg));
imagealphablending( $mask, false );
imagesavealpha( $mask, true );
imagecopy($mask, $resizeImg, ($maskWidth - $finalWidth) / 2, ($maskHeight - $finalHeight) / 2, 0, 0, imagesx($resizeImg), imagesy($resizeImg));
imagealphablending($mask, false);
imagesavealpha($mask, true);
//écrit dans storage/app/public
// écrit dans storage/app/public
// ---- Créer le fichier final
imagepng($mask, storage_path('app/public/inco/images/' . $resizedName), 5);
@ -522,21 +524,21 @@ class ProductsController extends Controller
$imagePath = storage_path("app/public/" . $imagePath);
$product_id = $request->product;
$product = Product::findOrFail($product_id);
$product = Product::findOrFail($product_id);
$str_random = Str::random(5);
//default is large image
// default is large image
$finalImageName = $product->id . '_' . $str_random . '_large.' . File::extension($imagePath);
$productimagespath = public_path('images/produits');
if(!File::isDirectory($productimagespath)) {
if (!File::isDirectory($productimagespath)) {
File::makeDirectory($productimagespath, 0644, true);
}
File::copy($imagePath, $productimagespath . "/" . $finalImageName);
//suppression de l'ancien fichier
// suppression de l'ancien fichier
if ($product->picture_large !== null && file_exists(public_path('images/produits/') . $product->picture_large)) {
unlink(public_path('images/produits/') . $product->picture_large);
}
@ -544,12 +546,12 @@ class ProductsController extends Controller
$product->picture_large = $finalImageName;
//now set small image
$imagePath = str_replace("_large", "_small", $imagePath);
// now set small image
$imagePath = str_replace("_large", "_small", $imagePath);
$finalImageName = $product->id . '_' . $str_random . '.' . File::extension($imagePath);
File::copy($imagePath, $productimagespath . "/" . $finalImageName);
//suppression de l'ancien fichier
// suppression de l'ancien fichier
if ($product->picture !== null && file_exists(public_path('images/produits/') . $product->picture)) {
unlink(public_path('images/produits/') . $product->picture);
}
@ -558,7 +560,7 @@ class ProductsController extends Controller
$product->save();
//@TODO : envoyer une réponse pour maj de l'interface
// @TODO : envoyer une réponse pour maj de l'interface
return $product;
}
@ -641,7 +643,7 @@ class ProductsController extends Controller
]);
$anifoodProduct->composition = $request->composition;
$anifoodProduct->servings = $request->servings;
$anifoodProduct->servings = $request->servings;
$anifoodProduct->save();
}
@ -655,8 +657,8 @@ class ProductsController extends Controller
'product_id' => $product_id,
]);
$garmentProduct->size = $request->size;
$garmentProduct->color = $request->color;
$garmentProduct->size = $request->size;
$garmentProduct->color = $request->color;
$garmentProduct->material = $request->material;
$garmentProduct->save();
}
@ -666,7 +668,7 @@ class ProductsController extends Controller
*/
public function show()
{
//not in use
// not in use
}
/**
@ -682,7 +684,7 @@ class ProductsController extends Controller
* working method to start the mapping of inco fields into foodproduct
*/
/*
public function mapIncoFieldsToFoodProduct () {
public function mapIncoFieldsToFoodProduct () {
}*/
}

View file

@ -31,17 +31,16 @@ class PromotionsController extends Controller
$discTypes = DiscountType::all();
$existingProds = Product::all();
$promotion = new Promotion();
$promotion = new Promotion();
$selectedProds = $promotion->products;
//$existingProds = $existingProds->diff($selectedProds);
// $existingProds = $existingProds->diff($selectedProds);
return view('bo.promotions.create', compact('discTypes', 'existingProds', 'selectedProds'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -52,19 +51,19 @@ class PromotionsController extends Controller
]);
$productIds = explode(",", $request->product_id);
$discType = $request->discount_type_id;
$value = $request->discount_value;
$discType = $request->discount_type_id;
$value = $request->discount_value;
$date_start = $request->date_start_date . " " . $request->date_start_time;
$date_end = $request->date_end_date . " " . $request->date_end_time;
$date_end = $request->date_end_date . " " . $request->date_end_time;
$promotion = new Promotion();
$promotion = new Promotion();
$promotion->discount_type_id = $discType;
$promotion->discount_value = $value;
$promotion->date_start = $date_start;
$promotion->date_end = $date_end;
$promotion->discount_value = $value;
$promotion->date_start = $date_start;
$promotion->date_end = $date_end;
$promotion->save();
//prise en charge de la liaison avec les produits
// prise en charge de la liaison avec les produits
$promotion->products()->sync($productIds);
return redirect()->route('bo.promotions.index');
@ -73,18 +72,17 @@ class PromotionsController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
@ -102,8 +100,8 @@ class PromotionsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
@ -115,35 +113,34 @@ class PromotionsController extends Controller
]);
$productIds = explode(",", $request->product_id);
$discType = $request->discount_type_id;
$value = $request->discount_value;
$discType = $request->discount_type_id;
$value = $request->discount_value;
$date_start = $request->date_start_date . " " . $request->date_start_time;
$date_end = $request->date_end_date . " " . $request->date_end_time;
$date_end = $request->date_end_date . " " . $request->date_end_time;
$promotion->discount_type_id = $discType;
$promotion->discount_value = $value;
$promotion->date_start = $date_start;
$promotion->date_end = $date_end;
$promotion->discount_value = $value;
$promotion->date_start = $date_start;
$promotion->date_end = $date_end;
$promotion->save();
//prise en charge de la liaison avec les produits
// prise en charge de la liaison avec les produits
$promotion->products()->sync($productIds);
return redirect()->route('bo.promotions.edit', $promotion->id)->with('success', 'Modifications enregistrés !');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$p = Promotion::findOrFail($id);
//prise en charge de la liaison avec les produits
// prise en charge de la liaison avec les produits
$p->products()->detach();
$p->delete();

View file

@ -24,11 +24,11 @@ class RangesController extends Controller
public function store(Request $request)
{
$name = $request->name;
$slug = Str::slug($name);
$name = $request->name;
$slug = Str::slug($name);
$description = $request->description;
$picture = $request->picture;
$status = $request->status === null ? 0 : 1;
$picture = $request->picture;
$status = $request->status === null ? 0 : 1;
$request->validate([
'name' => 'required|string|max:255',
@ -38,11 +38,11 @@ class RangesController extends Controller
config('theme.range_image_maxheight'),
]);
$range = new Range();
$range->name = $name;
$range->slug = $slug;
$range = new Range();
$range->name = $name;
$range->slug = $slug;
$range->description = $description;
$range->status = $status;
$range->status = $status;
$range->save();
if ($picture !== null) {
@ -63,11 +63,11 @@ class RangesController extends Controller
public function update(Request $request, $id)
{
$name = $request->name;
$slug = Str::slug($name);
$name = $request->name;
$slug = Str::slug($name);
$description = $request->description;
$picture = $request->picture;
$status = $request->status === null ? 0 : 1;
$picture = $request->picture;
$status = $request->status === null ? 0 : 1;
$request->validate([
'name' => 'required|string|max:255',
@ -80,8 +80,9 @@ class RangesController extends Controller
$range = Range::findOrFail($id);
if ($picture !== null) {
if ($range->picture !== null && file_exists(public_path('images/gammes/') . $range->picture))
if ($range->picture !== null && file_exists(public_path('images/gammes/') . $range->picture)) {
unlink(public_path('images/gammes/') . $range->picture);
}
$imageName = $range->id . '_' . $slug . '_' . Str::random(5) . '.' . $picture->extension();
$picture->move(public_path('images/gammes'), $imageName);
}
@ -91,17 +92,18 @@ class RangesController extends Controller
if ($range->slug != $slug) {
$exist = OldSlug::where('slug', $range->slug)->first();
if ($exist === null) {
$oldSlug = new OldSlug();
$oldSlug = new OldSlug();
$oldSlug->range_id = $range->id;
$oldSlug->slug = $range->slug;
$oldSlug->slug = $range->slug;
$oldSlug->save();
}
}
$range->slug = $slug;
$range->slug = $slug;
$range->description = $description;
if ($picture !== null)
if ($picture !== null) {
$range->picture = $imageName;
}
$range->status = $status;
$range->save();

View file

@ -10,9 +10,10 @@ use Illuminate\Support\Facades\Config;
class SettingsController extends Controller
{
public function manage(Request $request) {
public function manage(Request $request)
{
$settings = Setting::all();
$settings = Setting::all();
$settingsToPrint = [];
foreach ($settings as $setting) {
$settingsToPrint[$setting->key] = $setting->value;
@ -21,22 +22,23 @@ class SettingsController extends Controller
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$input = $request->all();
//comparer les settingsToPrint (en base) avec les inputs (pour trouver un nouveau)
foreach($input as $key=>$value) {
if(!isset($settingsToPrint[$key])
// comparer les settingsToPrint (en base) avec les inputs (pour trouver un nouveau)
foreach ($input as $key => $value) {
if (
!isset($settingsToPrint[$key])
&& $key != "_method"
&& $key != "_token")
{
//new setting
$setting = new Setting();
$setting->key = $key;
&& $key != "_token"
) {
// new setting
$setting = new Setting();
$setting->key = $key;
$setting->value = $value ?? 0;
$setting->save();
}
}
}
for($i = 0; $i < count($settings); $i++) {
if(is_array($request->input($settings[$i]->key))) {
for ($i = 0; $i < count($settings); $i++) {
if (is_array($request->input($settings[$i]->key))) {
$settings[$i]->value = implode(',', $request->input($settings[$i]->key));
} else {
$settings[$i]->value = $request->input($settings[$i]->key) === null ? 0 : $request->input($settings[$i]->key);
@ -44,15 +46,14 @@ class SettingsController extends Controller
$settings[$i]->save();
}
//store redirector to keep flash message from being wipe pby artisan call below
// store redirector to keep flash message from being wipe pby artisan call below
$redirector = redirect()->route('bo.settings')->with('success', 'Modifications enregistrés !');
//all settings saved : cache routes
// all settings saved : cache routes
Artisan::call('route:clear');
//programmer un php artisan optimize ? (une fois par jour la nuit par exemple)
// programmer un php artisan optimize ? (une fois par jour la nuit par exemple)
return $redirector;
}
}//end if
return view('bo.settings', compact('settingsToPrint'));
}
@ -60,8 +61,9 @@ class SettingsController extends Controller
/**
* Management des settings dont la clé est préfixée theme_
*/
public function manageTheme(Request $request) {
$settings = Setting::where('key', 'LIKE', 'theme_%')->get();
public function manageTheme(Request $request)
{
$settings = Setting::where('key', 'LIKE', 'theme_%')->get();
$settingsToPrint = [];
foreach ($settings as $setting) {
$settingsToPrint[$setting->key] = $setting->value;
@ -69,21 +71,21 @@ class SettingsController extends Controller
$config_settings = Config::get(('theme.bo_theme_settings'));
//check if, for each of the theme defined settings we have a database setting
// check if, for each of the theme defined settings we have a database setting
foreach ($config_settings as $onekey => $params) {
if (!isset($settingsToPrint['theme_' . $onekey])) {
$dbsetting = new Setting();
$dbsetting->key = 'theme_' . $onekey;
$dbsetting = new Setting();
$dbsetting->key = 'theme_' . $onekey;
$dbsetting->value = $params['default_value'];
$dbsetting->save();
//injection dans settings to print
// injection dans settings to print
$settingsToPrint[$dbsetting->key] = $dbsetting->value;
}
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {
for($i = 0; $i < count($settings); $i++) {
//attention pour les booléens/checkbox on enregistre 'on'
for ($i = 0; $i < count($settings); $i++) {
// attention pour les booléens/checkbox on enregistre 'on'
$settings[$i]->value = $request->input($settings[$i]->key) === null ? 0 : $request->input($settings[$i]->key);
$settings[$i]->save();
}

View file

@ -33,7 +33,7 @@ class SlidersController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -62,18 +62,17 @@ class SlidersController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
@ -85,8 +84,8 @@ class SlidersController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
@ -113,7 +112,7 @@ class SlidersController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
@ -126,7 +125,6 @@ class SlidersController extends Controller
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
}
// @todo : controller les slides liés
$slider->delete();
return redirect()->route('bo.sliders.index');
}

View file

@ -37,7 +37,7 @@ class SlidesController extends Controller
*
* @todo : validation des dates
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -104,18 +104,17 @@ class SlidesController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
@ -128,8 +127,8 @@ class SlidesController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
@ -198,7 +197,7 @@ class SlidesController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
@ -230,7 +229,7 @@ class SlidesController extends Controller
$current->save();
return back();
//return redirect()->route('bo.slides.index');
// return redirect()->route('bo.slides.index');
}
/**

View file

@ -33,20 +33,20 @@ class TagsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$label = $request->label;
$slug = Str::slug($label);
$label = $request->label;
$slug = Str::slug($label);
$status = $request->status === null ? 0 : 1;
$request->validate([
'label' => 'required|string|max:255',
]);
$tag = new Tag();
$tag = new Tag();
$tag->label = $label;
$tag->slug = $slug;
$tag->status = $status;
@ -59,18 +59,17 @@ class TagsController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
@ -82,14 +81,14 @@ class TagsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$label = $request->label;
$slug = Str::slug($label);
$label = $request->label;
$slug = Str::slug($label);
$status = $request->status === null ? 0 : 1;
$request->validate([
@ -98,8 +97,8 @@ class TagsController extends Controller
$tag = Tag::findOrFail($id);
$tag->label = $label;
$tag->slug = $slug;
$tag->label = $label;
$tag->slug = $slug;
$tag->status = $status;
$tag->save();
@ -109,7 +108,7 @@ class TagsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param integer $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
@ -145,11 +144,12 @@ class TagsController extends Controller
$current->save();
return back();
//return redirect()->route('bo.slides.index');
// return redirect()->route('bo.slides.index');
}
public function toggleStatus($id) {
$tag = Tag::findOrFail($id);
public function toggleStatus($id)
{
$tag = Tag::findOrFail($id);
$tag->status = !($tag->status);
$tag->save();
return back();

View file

@ -16,7 +16,7 @@ class ContactController extends Controller
{
$status = $request->session()->get('status');
//1er magasin en base pour le moment
// 1er magasin en base pour le moment
$magasin = Magasin::first();
$content = Content::where('key', 'contact')->first();
@ -28,12 +28,12 @@ class ContactController extends Controller
$data = $request->all();
$toMailSetting = Setting::where('key', 'send_contact_mail_to')->first();
if(empty($toMailSetting->value)) {
if (empty($toMailSetting->value)) {
$toMail = config('mail.from.address');
} else {
$toMail = $toMailSetting->value;
}
//envoi du mail d'alerte
// envoi du mail d'alerte
Mail::to($toMail)->send(new SendContactMail($request));
return back()->with('status', true);

View file

@ -9,5 +9,7 @@ use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}

View file

@ -255,8 +255,9 @@ class CustomerController extends Controller
$passwordReset->save();
Mail::to($email)->send(new PasswordResetMail($token));
return back()->with('success',
__("La procédure pour changer votre mot de passe a été envoyé sur votre email.")
return back()->with(
'success',
__("La procédure pour changer votre mot de passe a été envoyé sur votre email.")
);
} else {
return back()->withErrors(__("Cette adresse email n'est pas enregistrée dans nos services."));
@ -338,7 +339,7 @@ class CustomerController extends Controller
public function dashboard(Request $request)
{
//show Profile
// show Profile
/** @var \App\Models\Customers|null $customer */
$customer = Auth::guard('customer')->user();
if (!$customer) {
@ -405,7 +406,7 @@ class CustomerController extends Controller
public function orderDetail($reference)
{
$order = Order::where('reference', '=', $reference)
$order = Order::where('reference', '=', $reference)
->where('customer_id', Auth::guard('customer')->user()->id)
->firstOrFail();
@ -430,7 +431,6 @@ class CustomerController extends Controller
$customer->forums()->delete();
// TODO : Suppression via la CRM
if (Auth::guard('customer')->user()->id === $customer->id) {
Auth::guard('customer')->logout();
}

View file

@ -7,7 +7,6 @@ use App\Models\Product;
use App\Models\Slider;
use App\Models\Range;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use LDC\LDCCRM\Enums\ApiError;
use LDC\LDCCRM\Exceptions\ApiErrorException;
@ -19,7 +18,7 @@ class HomeController extends Controller
public function index(Request $request)
{
$content = Content::where('key', 'accueil')->first();
//star products
// star products
$products = Product::where('status', 1)->where('star', 1)->get();
$slider = Slider::where('slug', 'home')->first();
@ -37,8 +36,8 @@ class HomeController extends Controller
/**
* Call the CRM to add a single optin
* @param String $email Email to add as a single optin
* @return String Message to print to the customer
* @param string $email Email to add as a single optin
* @return string Message to print to the customer
*/
public function addOptIn(Request $request)
{

View file

@ -8,7 +8,6 @@ use Illuminate\Http\Request;
class IndexController extends Controller
{
/**
* deprecated
*/
@ -39,7 +38,7 @@ class IndexController extends Controller
public function faq(Request $request)
{
$content = Content::where('key', 'faq')->first();
$faq = Faq::all();
return view('faq', compact('faq','content'));
$faq = Faq::all();
return view('faq', compact('faq', 'content'));
}
}

View file

@ -6,19 +6,17 @@ use App\Models\Product;
use App\Models\Range;
use App\Models\Tag;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class ProductsController extends Controller
{
/**
* page des gammes
*/
public function ranges(Request $request)
{
//now in AppServiceProvider
//$ranges = Range::all();
//return view('ranges', compact('ranges'));
// now in AppServiceProvider
// $ranges = Range::all();
// return view('ranges', compact('ranges'));
return view('ranges');
}
@ -32,7 +30,7 @@ class ProductsController extends Controller
abort(404);
}
$products = Product::where('range_id', $range->id)->where('status', 1)->paginate(9);
//find promo within range
// find promo within range
$offres = Product::where('range_id', $range->id)->where('status', 1)->has('promotions')->with('promotions')->get();
return view('range', compact('range', 'products', 'offres'));
}
@ -48,7 +46,7 @@ class ProductsController extends Controller
}
$product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
if ($product->additionnalProductInfo === null && !empty($product_type)) {
//n'existe pas on renseigne un vide
// n'existe pas on renseigne un vide
$product_type = $product->product_type;
$modelClass = 'App\Models\\' . ucfirst($product_type);
$product->$product_type = new $modelClass();

View file

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

View file

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

View file

@ -12,6 +12,5 @@ class PreventRequestsDuringMaintenance extends Middleware
* @var array
*/
protected $except = [
//
];
];
}

View file

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

View file

@ -12,14 +12,14 @@ class RedirectOldSlugs
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$productSlug = $request->route('productSlug');
$rangeSlug = $request->route('rangeSlug');
$rangeSlug = $request->route('rangeSlug');
if ($productSlug !== null) {
$product = Product::where('slug', $productSlug)->first();

View file

@ -17,7 +17,7 @@ class TrustProxies extends Middleware
/**
* The headers that should be used to detect proxies.
*
* @var int
* @var integer
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

View file

@ -12,6 +12,5 @@ class VerifyCsrfToken extends Middleware
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -10,15 +10,16 @@ class isAdmin
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$role = Auth::user()->role;
if ($role === 1 || $role === 2)
if ($role === 1 || $role === 2) {
return $next($request);
}
abort(404, "Cette page n'existe pas.");
}
}

View file

@ -2,8 +2,6 @@
namespace App\Http\Requests;
use App\Enums\ContactFormCivility;
use App\Enums\ContactFormType;
use Illuminate\Foundation\Http\FormRequest;
class ContactFormRequest extends FormRequest
@ -11,7 +9,7 @@ class ContactFormRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

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

View file

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

View file

@ -4,16 +4,16 @@ namespace App\Jobs;
abstract class CsvJobs extends XArcadiaFlux
{
/**
* parse csv file
*/
protected function parseCsv($csvFile) {
protected function parseCsv($csvFile)
{
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ";");
if(!end($line_of_text)) {
//supprime les lignes vides du csv
if (!end($line_of_text)) {
// supprime les lignes vides du csv
array_pop($line_of_text);
}
}

View file

@ -4,13 +4,9 @@ namespace App\Jobs;
use Illuminate\Support\Carbon;
use App\Models\Order;
use App\Models\OrderLine;
use App\Models\Customers;
use App\Models\Timeslot;
class CsvOrderWrite extends CsvJobs
{
protected $disk = 'orders';
/** @var Order */
@ -70,41 +66,46 @@ class CsvOrderWrite extends CsvJobs
/** @var Timeslot */
$timeslot = $this->order->timeslot;
//insertion de la ligne d'en-têtes
// insertion de la ligne d'en-têtes
$csvlines[] = $this->header;
foreach ($orderlines as $orderline) {
$product = $orderline->product;
$unité_commande = $product->order_unit ?? 'PCE'; //COLIS, KGM, PCE (faut il introduire un nouveau champs type unité de commande)
$code_client = preg_replace('/[^\d]/', '', $customer->salarie->matricule); //matricule rh transmis sans les lettres de l'identifiant windows
//convert to date object
$unité_commande = $product->order_unit ?? 'PCE';
// COLIS, KGM, PCE (faut il introduire un nouveau champs type unité de commande)
$code_client = preg_replace('/[^\d]/', '', $customer->salarie->matricule);
// matricule rh transmis sans les lettres de l'identifiant windows
// convert to date object
$datLivraison = Carbon::createFromFormat('d/m/Y H:i', $timeslot->day . " " . $timeslot->time);
$oneline = [
$product->foodProduct->no_art, //21/01/2022 : suppression du pcb ici
$product->foodProduct->no_art,
// 21/01/2022 : suppression du pcb ici
$code_client,
$product->reference,
"commande ferme",
$unité_commande,
$this->mode_commande[$unité_commande], //UEA,KGM,UB (respectivement selon le champ précédent)
"", //on vide la colonne pcb comme demandé
$datLivraison->format('d/m/Y'), //dd/mm/yyyy
$this->mode_commande[$unité_commande],
// UEA,KGM,UB (respectivement selon le champ précédent)
"",
// on vide la colonne pcb comme demandé
$datLivraison->format('d/m/Y'),
// dd/mm/yyyy
$orderline->quantity,
$this->order->reference,
];
$csvlines[] = $oneline;
}
}//end foreach
$data = $this->array2csv($csvlines, ";");
//$outputfilename = date("Ymd_His") . microtime(true) . ".csv";
// $outputfilename = date("Ymd_His") . microtime(true) . ".csv";
$outputfilename = "BTQ_" . $this->order->reference . "_" . $code_client . "_" . $customer->salarie->nom . "_" . $customer->salarie->prenom . "_" . str_pad($customer->salarie->code_societe, 3, "0", STR_PAD_LEFT) . ".csv";
$disk->put($outputfilename, $data);
//send this file by mail
// send this file by mail
}
}

View file

@ -8,12 +8,10 @@ use ErrorException;
use TypeError;
use Illuminate\Database\QueryException;
use App\Exceptions\AbortCsvImportException;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Str;
class CsvSalariesReader extends CsvJobs
{
/**
* This is for Laravel Console usage
*/
@ -28,7 +26,6 @@ class CsvSalariesReader extends CsvJobs
*/
public function __construct()
{
//
}
/**
@ -44,7 +41,7 @@ class CsvSalariesReader extends CsvJobs
$files = $disk->files();
$progress = 1;
$total = count(array_filter($files, function ($filename) {
$total = count(array_filter($files, function ($filename) {
if ($this->fileHasToBeIgnored($filename)) {
return false;
}
@ -63,17 +60,17 @@ class CsvSalariesReader extends CsvJobs
try {
$data = $this->parseCsv($filepath);
//first line is header (mandatory)
// first line is header (mandatory)
$header = array_flip(array_shift($data));
foreach ($data as $line) {
$matricule = $line[$header['matricule']];
$prenom = $line[$header['prenom']];
$nom = $line[$header['nom']];
$salarie = Salarie::firstOrNew(['matricule' => $matricule ]);
$matricule = $line[$header['matricule']];
$prenom = $line[$header['prenom']];
$nom = $line[$header['nom']];
$salarie = Salarie::firstOrNew(['matricule' => $matricule ]);
$salarie->matricule = $matricule;
$salarie->nom = $nom;
$salarie->prenom = $prenom;
$salarie->code = $salarie->code ?? $this->generateCode();
$salarie->nom = $nom;
$salarie->prenom = $prenom;
$salarie->code = $salarie->code ?? $this->generateCode();
$salarie->save();
}
} catch (ErrorException | TypeError | QueryException $e) {
@ -90,7 +87,8 @@ class CsvSalariesReader extends CsvJobs
),
LogType::critical()
);
continue; // ignore the file
continue;
// ignore the file
} catch (AbortCsvImportException $e) {
$this->log(
sprintf(
@ -101,10 +99,11 @@ class CsvSalariesReader extends CsvJobs
),
LogType::error()
);
continue; // ignore the file
}
continue;
// ignore the file
}//end try
$this->moveToArchives($filename);
}
}//end foreach
// Clear old archives
$this->clearOldArchives();
@ -113,7 +112,8 @@ class CsvSalariesReader extends CsvJobs
/**
* Génère un code d'inscription
*/
protected function generateCode() {
protected function generateCode()
{
return Str::random(5);
}
}

View file

@ -47,10 +47,14 @@ class RefreshSiteMap implements ShouldQueue
// '/la-marque/tracabilite/search',
// '/frame',
// '/map',
'/_debugbar', // Hack ignore laravel debug bar
'_ignition/health-check', //ignore ignition route
'_ignition/scripts/{script}', //ignore ignition route
'_ignition/styles/{style}' //ignore ignition route
'/_debugbar',
// Hack ignore laravel debug bar
'_ignition/health-check',
// ignore ignition route
'_ignition/scripts/{script}',
// ignore ignition route
'_ignition/styles/{style}'
// ignore ignition route
];
/**
@ -73,7 +77,7 @@ class RefreshSiteMap implements ShouldQueue
/**
* Execute the job.
*
*! Ici c'est du sale !!
* ! Ici c'est du sale !!
* TODO: mettre tout ça dans un package pour le rendre plus générique
*
* @return void
@ -136,7 +140,7 @@ class RefreshSiteMap implements ShouldQueue
$this->setParamsForModel($rParams, $modelClassName, $pName);
continue;
}
}
}//end foreach
// If the route has no dynamic models as parameters
if (!count($params) or !$hasModels) {
@ -145,10 +149,11 @@ class RefreshSiteMap implements ShouldQueue
Url::CHANGE_FREQUENCY_MONTHLY,
0.1
];
} else { // If the route has dynamic models as parameters
} else {
// If the route has dynamic models as parameters
$this->genRoute($route, $siteMap, $rParams);
}
}
}//end foreach
$sm = Sitemap::create();
foreach ($siteMap as $smRules) {
@ -164,7 +169,7 @@ class RefreshSiteMap implements ShouldQueue
* Process route with binderParam
*
* @param RoutingRoute $route
* @param string $pName
* @param string $pName
* @return void
*/
private function processWithRouteBinderParam(array &$rParams, RoutingRoute $route, string $pName)
@ -175,7 +180,7 @@ class RefreshSiteMap implements ShouldQueue
$modelClassName = $o[0];
/** @var \string */
$routeParamName = $o[1];
$rfLCls = (new ReflectionClass($modelClassName));
$rfLCls = (new ReflectionClass($modelClassName));
switch (true) {
case $rfLCls->isSubclassOf(Model::class):
@ -192,7 +197,7 @@ class RefreshSiteMap implements ShouldQueue
/**
* Set route param Array for Enums
*
* @param array $rParams
* @param array $rParams
* @param string $enumClassName
* @param string $pName
* @return void
@ -210,7 +215,7 @@ class RefreshSiteMap implements ShouldQueue
/**
* Set route param Array for Models
*
* @param array $rParams
* @param array $rParams
* @param string $modelClassName
* @param string $pName
* @param string $routeParamName
@ -222,16 +227,16 @@ class RefreshSiteMap implements ShouldQueue
string $pName,
string $routeParamName = null
) {
$i = 0;
$limit = 10;
$i = 0;
$limit = 10;
$modelTable = (new ReflectionClass($modelClassName))->newInstanceWithoutConstructor()->getTable();
$q = $modelClassName::query();
$q = Schema::hasColumn($modelTable, 'status') ? $q->where('status', true) : $q;
$q = Schema::hasColumn($modelTable, 'ocbStatus') ? $q->where('ocbStatus', EleveurOcbStatus::yes()->value) : $q;
$q = Schema::hasColumn($modelTable, 'star_moment') ? $q->where('star_moment', true) : $q;
$q = $modelClassName::query();
$q = Schema::hasColumn($modelTable, 'status') ? $q->where('status', true) : $q;
$q = Schema::hasColumn($modelTable, 'ocbStatus') ? $q->where('ocbStatus', EleveurOcbStatus::yes()->value) : $q;
$q = Schema::hasColumn($modelTable, 'star_moment') ? $q->where('star_moment', true) : $q;
do {
$results = $q->offset($i * $limit)->limit($limit)->get();
$length = count($results);
$length = count($results);
$results->map(function (Model $model) use (&$rParams, $pName, $routeParamName) {
if (!array_key_exists($pName, $rParams)) {
$rParams[$pName] = [];
@ -250,8 +255,8 @@ class RefreshSiteMap implements ShouldQueue
* Recursively generate routes for all params
*
* @param RoutingRoute $route
* @param array $siteMap
* @param array $params
* @param array $siteMap
* @param array $params
* @return void
*/
private function genRoute(RoutingRoute $route, array &$siteMap, array $params)
@ -290,7 +295,7 @@ class RefreshSiteMap implements ShouldQueue
* Check if $route exists in routesBinder and has $param
*
* @param RoutingRoute $route
* @param string $param
* @param string $param
* @return boolean
*/
private function hasRouteBinderParam(RoutingRoute $route, string $param): bool
@ -316,7 +321,7 @@ class RefreshSiteMap implements ShouldQueue
* Get the routeBinder param
*
* @param RoutingRoute $route
* @param string $param
* @param string $param
* @return array
*/
private function getRouteBinderParam(RoutingRoute $route, string $param): array
@ -367,8 +372,8 @@ class RefreshSiteMap implements ShouldQueue
$p[0]
));
}
}
}
}//end foreach
}//end foreach
}
/**

View file

@ -110,7 +110,7 @@ abstract class XArcadiaFlux implements ShouldQueue
*/
protected function clearOldArchives(): void
{
$disk = $this->getDisk();
$disk = $this->getDisk();
$archives = $disk->files($this->archiveFolderName);
// /** @var File */
@ -141,7 +141,7 @@ abstract class XArcadiaFlux implements ShouldQueue
/**
* Logs data
*
* @param string $message
* @param string $message
* @param LogType $logtype
* @return void
*/
@ -172,14 +172,14 @@ abstract class XArcadiaFlux implements ShouldQueue
break;
default:
throw new Exception(sprintf('%s : unhandled log type %s', get_class($this), $logtype->label));
}
}//end switch
$this->consolePrint($message, $logtype);
}
/**
* Prints to the console
*
* @param string $message
* @param string $message
* @param LogType $logtype
* @return void
*/

View file

@ -8,7 +8,6 @@ use SimpleXMLElement;
class XmlIncoReader extends XmlJobs
{
protected $disk = 'inco';
protected $imagesPath = 'images';
@ -29,29 +28,32 @@ class XmlIncoReader extends XmlJobs
* 'EXPLOITANT.NOM_SOCIETE' => 'nom_societe',
*/
protected $takeColumns = [
'NO_ART' => 'id', // primary key on model
//this wil not return anything cf doc above
'NO_ART' => 'id',
// primary key on model
// this wil not return anything cf doc above
'ID_SOCIETE' => 'id_societe',
'NOM_SOCIETE' => 'nom_societe',
'PROD_SAISON' => 'prod_saison',
'NOM' => 'nom',
'NUMERO' => 'numero',
'TAILLE_REF' => 'taille_ref', //$poidsRef censé être dans INCO_COMPO (et généralement 100g)
'TAILLE_REF' => 'taille_ref',
// $poidsRef censé être dans INCO_COMPO (et généralement 100g)
'ALLEGATIONS' => 'allegations',
'CONSEIL_PREPA' => 'conseil_prepa',
'ASTUCES' => 'astuces',
'DESCRIPTIF' => 'descriptif', //$descriptif
'DESCRIPTIF' => 'descriptif',
// $descriptif
'ARG_VENTE' => 'arg_vente',
'NB_PORTION' => 'nb_portion',
'TYP_PORTION' => 'typ_portion',
'PDS_MOY_THEO' => 'pds_moy_theo',
'LIB_CONSO' => 'lib_conso',
'LST_ING' => 'lst_ing', //$ingredients
'LST_ING' => 'lst_ing',
// $ingredients
// list alergene
'LST_ALLERGENE' => 'lst_allergene', // Consider this sub array
'LST_ALLERGENE' => 'lst_allergene',
// Consider this sub array
'LST_ALLERGENE.LIB_ALLERGENE' => 'lib_allergene',
// Allegations
@ -60,11 +62,13 @@ class XmlIncoReader extends XmlJobs
'ALLEGAT_AUTRE' => 'allegat_autre',
'INCO_COMPO' => 'inco_compo', // Consider this sub array
'INCO_COMPO' => 'inco_compo',
// Consider this sub array
'INCO_COMPO.NOM' => 'nom',
'INCO_COMPO.TAILLE_REF' => 'taille_ref',
'INCO_COMPO.VAL_ENERG_KJ_NUT' => 'val_energ_kj_nut',
'INCO_COMPO.VAL_ENERG_KJ_R' => 'val_energ_kj_r', //_R apports de la taille_ref
'INCO_COMPO.VAL_ENERG_KJ_R' => 'val_energ_kj_r',
// _R apports de la taille_ref
'INCO_COMPO.VAL_ENERG_KCAL_R' => 'val_energ_kcal_r',
'INCO_COMPO.VAL_ENERG_KCAL_NUT' => 'val_energ_kcal_nut',
'INCO_COMPO.MAT_GRASS_R' => 'mat_grass_r',
@ -85,7 +89,8 @@ class XmlIncoReader extends XmlJobs
'INCO_COMPO.ENER_E14_R' => 'ener_e14_r',
'INCO_COMPO.FRUITS_R' => 'fruits_r',
'INCO_COMPO.FRUITS_COQUE_SECH_R' => 'fruits_coque_sech_r',
'INCO_COMPO.POURCENT_APPORT_REF_E14_R' => 'pourcent_apport_ref_e14_r', //POURCENT_*_P apports journaliers par portion
'INCO_COMPO.POURCENT_APPORT_REF_E14_R' => 'pourcent_apport_ref_e14_r',
// POURCENT_*_P apports journaliers par portion
'INCO_COMPO.ENER_KJO_R' => 'ener_kjo_r',
'INCO_COMPO.POURCENT_APPORT_REF_KJO_R' => 'pourcent_apport_ref_kjo_r',
'INCO_COMPO.POURCENT_APPORT_REF_FAT_R' => 'pourcent_apport_ref_fat_r',
@ -102,8 +107,10 @@ class XmlIncoReader extends XmlJobs
'INCO_COMPO.SALTEQ_R' => 'salteq_r',
'INCO_COMPO.POURCENT_APPORT_REF_SALTEQ_R' => 'pourcent_apport_ref_salteq_r',
'INCO_COMPO.APPORT_REF' => 'apport_ref',
'INCO_COMPO.TAILLE_PORT' => 'taille_port', //$poidsPortion
'INCO_COMPO.VAL_ENERG_KJ_P' => 'val_energ_kj_p', //_P apports par portion
'INCO_COMPO.TAILLE_PORT' => 'taille_port',
// $poidsPortion
'INCO_COMPO.VAL_ENERG_KJ_P' => 'val_energ_kj_p',
// _P apports par portion
'INCO_COMPO.VAL_ENERG_KCAL_P' => 'val_energ_kcal_p',
'INCO_COMPO.MAT_GRASS_P' => 'mat_grass_p',
'INCO_COMPO.AGS_P' => 'ags_p',
@ -145,8 +152,10 @@ class XmlIncoReader extends XmlJobs
'INCO_COMPO.COMPOSANTE_N' => 'composante_n',
'INCO_COMPO.COMPOSANTE_P' => 'composante_p',
'INCO_COMPO.POURCENT_FRUITS' => 'pourcent_fruits',
'INCO_COMPO.SCORE_NUTRI' => 'score_nutri', //du coup nutriscore ?
'INCO_COMPO.CLASSEMENT' => 'classement', //$nutriscore mais pas censé être dans INCO_COMPO
'INCO_COMPO.SCORE_NUTRI' => 'score_nutri',
// du coup nutriscore ?
'INCO_COMPO.CLASSEMENT' => 'classement',
// $nutriscore mais pas censé être dans INCO_COMPO
'INCO_COMPO.MAT_GRASS_R_PREC' => 'mat_grass_r_prec',
'INCO_COMPO.AGS_R_PREC' => 'ags_r_prec',
'INCO_COMPO.GLUCIDES_R_PREC' => 'glucides_r_prec',
@ -398,9 +407,9 @@ class XmlIncoReader extends XmlJobs
$line[$key] = implode(',', array_filter($line[$key]));
$line[$key] = strlen($line[$key]) ? $line[$key] : null;
}
//json column cast into array in model => no need for encode
// json column cast into array in model => no need for encode
// if ($key == 'nutritional_values') {
// $line[$key] = json_encode($line[$key], \JSON_FORCE_OBJECT);
// $line[$key] = json_encode($line[$key], \JSON_FORCE_OBJECT);
// }
}
@ -415,26 +424,26 @@ class XmlIncoReader extends XmlJobs
private function parseImage(SimpleXMLElement $xmlData)
{
$list_media = $xmlData->INCO->MEDIA_VISUEL_EAI->MEDIA_VISUEL_EAI;
$list_media = $xmlData->INCO->MEDIA_VISUEL_EAI->MEDIA_VISUEL_EAI;
$arImgPaths = array();
$index = 1;
foreach ($list_media as $media) {
$image = $media->img;
$image = $media->img;
$imageData = trim((string)$image);
if (strlen($imageData)) {
$imageData = base64_decode($imageData);
$imgName = strval($xmlData->INCO->INCO_COMPO->TBL_INCO_COMPO->ID_INCO);
if(empty($imgName)) {
$imgName = strval($xmlData->INCO->INCO_COMPO->TBL_INCO_COMPO->ID_INCO);
if (empty($imgName)) {
$imgName = strval($xmlData->INCO->NO_ART);
}
$imgName = $imgName."_".$index;
$imgName = $imgName . "_" . $index;
$imgNamePath = sprintf('%s/%s', rtrim($this->imagesPath, '/'), $imgName);
$disk = $this->getDisk();
$info = getimagesizefromstring($imageData);
if($info !== false) {
if ($info !== false) {
$mime = $info['mime'];
switch ($mime) {
case 'image/jpeg':
@ -459,10 +468,10 @@ class XmlIncoReader extends XmlJobs
$arImgPaths[$index] = sprintf('%s/%s', $this->disk, $imgNamePath);
$index++;
} else {
//probably not an image could be a PDF, PPT, AI anything is possible
}
}
}
// probably not an image could be a PDF, PPT, AI anything is possible
}//end if
}//end if
}//end foreach
return $arImgPaths;
}
@ -500,15 +509,18 @@ class XmlIncoReader extends XmlJobs
if ($value->count()) {
$extraction = $this->extract($value);
if(count($extraction)
&& array_key_exists("code",$extraction)
&& array_key_exists("libelle",$extraction)) {
$val = strval($extraction['libelle']);
if (
count($extraction)
&& array_key_exists("code", $extraction)
&& array_key_exists("libelle", $extraction)
) {
$val = strval($extraction['libelle']);
$extract[$key] = strlen($val) ? $val : null;
continue;
}
$extract[$key][] = $extraction; //$this->extract($value);
$extract[$key][] = $extraction;
// $this->extract($value);
continue;
}
$value = strval($value);
@ -517,7 +529,7 @@ class XmlIncoReader extends XmlJobs
} else {
$extract[$key] = strlen($value) ? $value : null;
}
}
}//end foreach
return $extract;
}
}

View file

@ -7,7 +7,6 @@ use App\Exceptions\AbortXmlImportException;
use App\Exceptions\InvalidXmlException;
use ErrorException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
@ -20,7 +19,6 @@ use TypeError;
abstract class XmlJobs extends XArcadiaFlux
{
/**
* invalid xml folder
*
@ -67,7 +65,7 @@ abstract class XmlJobs extends XArcadiaFlux
$files = $disk->files();
$progress = 1;
$total = count(array_filter($files, function ($filename) {
$total = count(array_filter($files, function ($filename) {
if ($this->fileHasToBeIgnored($filename)) {
return false;
}
@ -97,14 +95,14 @@ abstract class XmlJobs extends XArcadiaFlux
if ($xmlContent === false) {
throw new InvalidXmlException('XML is Invalid (simplexml_load_string returned false)');
// $this->log(
// sprintf('File %s could not be parsed (simplexml_load_string)', $filename),
// LogType::critical()
// sprintf('File %s could not be parsed (simplexml_load_string)', $filename),
// LogType::critical()
// );
// continue; // ignore the file
}
} catch (ErrorException $e) {
throw new InvalidXmlException('XML is Invalid', 0, $e);
}
}//end try
$data = $this->extract($xmlContent);
@ -159,7 +157,8 @@ abstract class XmlJobs extends XArcadiaFlux
LogType::critical()
);
$this->sendErrorParseEmailToServiceWeb($e);
continue; // ignore the file
continue;
// ignore the file
} catch (AbortXmlImportException $e) {
$this->log(
sprintf(
@ -172,7 +171,8 @@ abstract class XmlJobs extends XArcadiaFlux
);
$this->sendErrorParseEmailToServiceWeb($e);
$this->moveToInvalid($filename);
continue; // ignore the file
continue;
// ignore the file
} catch (FileNotFoundException | QueryException $e) {
// This happens because of concurent xml jobs read
$message = $e->getMessage();
@ -188,10 +188,11 @@ abstract class XmlJobs extends XArcadiaFlux
),
LogType::debug()
);
continue; // ignore the file
}
continue;
// ignore the file
}//end try
$this->moveToArchives($filename);
}
}//end foreach
// Clear old archives
$this->clearOldArchives();
@ -261,7 +262,7 @@ abstract class XmlJobs extends XArcadiaFlux
} else {
$result[$key] = $field;
}
}
}//end foreach
return $result;
}

View file

@ -13,7 +13,7 @@ class CartCalculator implements Calculator
switch ($attribute) {
case 'discount':
return round($cartItem->price * ($cartItem->getDiscountRate() / 100)*100)/100;
return round($cartItem->price * ($cartItem->getDiscountRate() / 100) * 100) / 100;
case 'tax':
return round($cartItem->priceTarget * ($cartItem->taxRate / 100), $decimals);
case 'priceTax':
@ -27,16 +27,16 @@ class CartCalculator implements Calculator
case 'priceTarget':
return round(($cartItem->priceTotal - $cartItem->discountTotal) / $cartItem->qty, $decimals);
case 'taxTotal':
//taxe pour un item multiplié par la quantité
$unit_price = max($cartItem->price - $cartItem->discount,0);
$unit_tax = round($unit_price * ($cartItem->taxRate / 100), $decimals);
$taxTotal = round($unit_tax * $cartItem->qty, $decimals);
//return round($cartItem->subtotal * ($cartItem->taxRate / 100), $decimals);
// taxe pour un item multiplié par la quantité
$unit_price = max($cartItem->price - $cartItem->discount, 0);
$unit_tax = round($unit_price * ($cartItem->taxRate / 100), $decimals);
$taxTotal = round($unit_tax * $cartItem->qty, $decimals);
// return round($cartItem->subtotal * ($cartItem->taxRate / 100), $decimals);
return $taxTotal;
case 'total':
return round($cartItem->subtotal + $cartItem->taxTotal, $decimals);
default:
return;
}
}//end switch
}
}

View file

@ -4,13 +4,13 @@ namespace App\Mail;
use App\Models\Magasin;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class OrderConfirmAdminMail extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
private $order;

View file

@ -4,13 +4,13 @@ namespace App\Mail;
use App\Models\Magasin;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class OrderConfirmMail extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
private $order;

View file

@ -4,13 +4,13 @@ namespace App\Mail;
use App\Models\Magasin;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class OrderStatusMail extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
private $order;
@ -31,7 +31,7 @@ class OrderStatusMail extends Mailable
*/
public function build()
{
$order = $this->order;
$order = $this->order;
$magasin = Magasin::find($order->timeslot->magasin->id);
return $this->subject("Votre commande - " . config('theme.site_name'))->view('mails.order-status', compact('order', 'magasin'));

View file

@ -2,7 +2,6 @@
namespace App\Mail;
use App\Models\Moments;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@ -10,7 +9,8 @@ use Illuminate\Queue\SerializesModels;
class PasswordResetMail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
private $token;

View file

@ -9,7 +9,8 @@ use Illuminate\Queue\SerializesModels;
class RegisterConfirmMail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
private $customer, $firstname;
@ -21,7 +22,7 @@ class RegisterConfirmMail extends Mailable implements ShouldQueue
public function __construct($customer, $firstname)
{
$this->firstname = $firstname;
$this->customer = $customer;
$this->customer = $customer;
}
/**
@ -31,7 +32,7 @@ class RegisterConfirmMail extends Mailable implements ShouldQueue
*/
public function build()
{
$customer = $this->customer;
$customer = $this->customer;
$firstname = $this->firstname;
return $this->subject("Confirmation d'inscription " . config('theme.site_name'))
->view('mails.register-ok', compact('customer', 'firstname'));

View file

@ -3,7 +3,6 @@
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

View file

@ -8,5 +8,4 @@ use Illuminate\Database\Eloquent\Model;
class Content extends Model
{
use HasFactory;
}

View file

@ -27,7 +27,7 @@ class Customers extends Authenticatable
protected $guard = 'customer';
//possible additionnals
// possible additionnals
public function salarie()
{
return $this->hasOne(Salarie::class, 'customer_id');

View file

@ -11,7 +11,8 @@ class DiscountType extends Model
public $timestamps = false;
public function promotions() {
public function promotions()
{
return $this->hasMany(Promotion::class, 'discount_type_id');
}
}

View file

@ -18,11 +18,13 @@ class FoodProduct extends Model
'product_id',
];
public function product() {
public function product()
{
return $this->belongsTo(Product::class);
}
public function xmlInco() {
public function xmlInco()
{
return $this->hasOne(XmlInco::class, 'id', 'no_art');
}
}

View file

@ -15,15 +15,18 @@ class Magasin extends Model
'gmaps_placeid', 'gmaps_embed_href', 'gmaps_link_href',
];
public function timeslotSettings() {
public function timeslotSettings()
{
return $this->hasMany(TimeslotSetting::class);
}
public function collecteExceptions() {
public function collecteExceptions()
{
return $this->hasMany(CollecteException::class);
}
public function timeslots() {
public function timeslots()
{
return $this->hasMany(Timeslot::class);
}
}

View file

@ -9,11 +9,13 @@ class OldSlug extends Model
{
use HasFactory;
public function product() {
public function product()
{
return $this->belongsTo('App\Model\Product', 'product_id');
}
public function range() {
public function range()
{
return $this->belongsTo('App\Model\Range', 'range_id');
}
}

View file

@ -12,21 +12,24 @@ class Order extends Model
/**
* use carefully
*/
public function products() {
public function products()
{
return $this->belongsToMany(Product::class, 'order_lines', 'order_id', 'product_id');
}
//Relations
// Relations
public function lines()
{
return $this->hasMany(OrderLine::class);
}
public function status() {
public function status()
{
return $this->belongsTo('App\Models\OrdersStatus', 'status_id');
}
public function customer() {
public function customer()
{
return $this->belongsTo(Customers::class);
}
@ -35,7 +38,7 @@ class Order extends Model
return $this->hasOne(Timeslot::class);
}
//Formattages
// Formattages
public function getFormattedTotalTtcAttribute()
{
return $this->attributes['formattedTotalTtc'] = sprintf('%s €', number_format($this->attributes['total'], 2, ',', ' '));

View file

@ -9,7 +9,7 @@ class OrderLine extends Model
{
use HasFactory;
//Relations
// Relations
public function order()
{
return $this->belongsTo(Order::class);
@ -20,7 +20,7 @@ class OrderLine extends Model
return $this->belongsTo(Product::class);
}
//Formattages
// Formattages
public function getFormattedTotalTtcAttribute()
{
return $this->attributes['formattedTotalTtc'] = sprintf('%s €', number_format($this->attributes['total_ttc'], 2, ',', ' '));

View file

@ -10,9 +10,11 @@ class OrdersStatus extends Model
use HasFactory;
protected $table = "orders_status";
public $timestamps = false;
public function orders() {
public function orders()
{
return $this->hasMany('App\Models\Order', 'status_id');
}
}

View file

@ -7,5 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class PasswordReset extends Model
{
protected $table = "password_resets";
public $timestamps = false;
}

View file

@ -55,16 +55,15 @@ class Product extends Model implements Buyable
{
parent::boot();
//on data retrived from DB
// on data retrived from DB
static::retrieved(function ($model) {
$model->priceHt = $model->getPriceHtAttribute();
$model->priceTtc = $model->getPriceTtcAttribute();
$model->discountAmount = $model->getDiscountAmountAttribute();
$model->discountRate = $model->getDiscountRateAttribute();
$model->discountedPriceHt = $model->getDiscountedPriceHtAttribute();
$model->priceHt = $model->getPriceHtAttribute();
$model->priceTtc = $model->getPriceTtcAttribute();
$model->discountAmount = $model->getDiscountAmountAttribute();
$model->discountRate = $model->getDiscountRateAttribute();
$model->discountedPriceHt = $model->getDiscountedPriceHtAttribute();
$model->discountedPriceTtc = $model->getDiscountedPriceTtcAttribute();
});
}
@ -76,10 +75,10 @@ class Product extends Model implements Buyable
* net discounted proice (prix avec taxe et remises)
*/
//Utility to bring prices as a pseudo relation
// Utility to bring prices as a pseudo relation
public function getCalcPrices()
{
//$prices = new Collection();
// $prices = new Collection();
$prices = array(
'priceHt' => $this->priceHt,
'discountAmount' => $this->discountAmount,
@ -88,11 +87,11 @@ class Product extends Model implements Buyable
'priceTtc' => $this->priceTtc,
'discountedPriceTtc' => $this->discountedPriceTtc,
);
//$prices->add($cartextendedItem);
// $prices->add($cartextendedItem);
return $prices;
}
//gross price
// gross price
/**
* Mutator method to set priceHt's value
*/
@ -109,15 +108,15 @@ class Product extends Model implements Buyable
*/
public function getPriceHtAttribute()
{
if(isset($this->priceHt)) {
if (isset($this->priceHt)) {
return $this->priceHt;
} else {
//tenir compte de l'unité de facturation et de l'unité de vente (qui doit être stricte)
//si facturation KG et vente piece
// prendre le poids, convertir en KG => pre-requis l'unité de poids doit être un enum
// multiplier le $this->attributes['price'] par les KG
//sinon
// value => value
// tenir compte de l'unité de facturation et de l'unité de vente (qui doit être stricte)
// si facturation KG et vente piece
// prendre le poids, convertir en KG => pre-requis l'unité de poids doit être un enum
// multiplier le $this->attributes['price'] par les KG
// sinon
// value => value
if (config('bosettings.sell_unit_management') == "strict") {
$calculate = ($this->invoicing_unit == InvoicingUnit::kgm()->value && $this->sell_unit == SellUnit::pce()->value);
} else {
@ -125,17 +124,17 @@ class Product extends Model implements Buyable
}
if ($calculate) {
//weight converter
$weighted_price = $this->attributes['price'] * ($this->weight * WeightUnit::convert()[$this->weight_unit]);
// weight converter
$weighted_price = $this->attributes['price'] * ($this->weight * WeightUnit::convert()[$this->weight_unit]);
return $this->priceHt = round($weighted_price * 1000) / 1000;
} else {
//no calculations, alias of db property
// no calculations, alias of db property
return $this->priceHt = $this->attributes['price'];
}
}
}//end if
}
//discounted price
// discounted price
public function setDiscountedPriceHtAttribute($value)
{
$this->discountedPriceHt = $value;
@ -146,13 +145,13 @@ class Product extends Model implements Buyable
if (isset($this->discountedPriceHt)) {
return $this->discountedPriceHt;
} else {
$discountedPriceHt = $this->priceHt - $this->discountAmount;
$roundingdiscountedPriceHt = round($discountedPriceHt * 1000) / 1000;
$discountedPriceHt = $this->priceHt - $this->discountAmount;
$roundingdiscountedPriceHt = round($discountedPriceHt * 1000) / 1000;
return $this->discountedPriceHt = $roundingdiscountedPriceHt;
}
}
//net price
// net price
public function setPriceTtcAttribute($value)
{
$this->priceTtc = $value;
@ -164,14 +163,14 @@ class Product extends Model implements Buyable
return $this->priceTtc;
} else {
$priceTtc = $this->priceHt * ( 1 + ( $this->tax->rate / 100));
//on travaille avec des centimes puis on redivise par 100 pour avoir des unités monetaires
//on augmente la précision à 3 digits, l'affichage formate les prix sur 2 décimales
$roundingPriceTtc = round($priceTtc * 1000) / 1000;
// on travaille avec des centimes puis on redivise par 100 pour avoir des unités monetaires
// on augmente la précision à 3 digits, l'affichage formate les prix sur 2 décimales
$roundingPriceTtc = round($priceTtc * 1000) / 1000;
return $this->priceTtc = $roundingPriceTtc;
}
}
//net discounted price
// net discounted price
public function setDiscountedPriceTtcAttribute($value)
{
$this->discountedPriceTtc = $value;
@ -183,16 +182,16 @@ class Product extends Model implements Buyable
$showPrice = $this->discountedPriceTtc;
} else {
$discountedPriceTtc = $this->discountedPriceHt * ( 1 + ( $this->tax->rate / 100));
//on travaille avec des centimes puis on redivise par 100 pour avoir des unités monetaires
// on travaille avec des centimes puis on redivise par 100 pour avoir des unités monetaires
$roundingDiscountedPriceTTC = round($discountedPriceTtc * 1000) / 1000;
$showPrice = $this->discountedPriceTtc = $roundingDiscountedPriceTTC;
$showPrice = $this->discountedPriceTtc = $roundingDiscountedPriceTTC;
}
//prix transmis en fonction du setting show_prices
// prix transmis en fonction du setting show_prices
if (config('bosettings.show_prices_authenticated') == "authenticated") {
{
if (Auth::guard('customer')->check()) {
return $showPrice;
}
if (Auth::guard('customer')->check()) {
return $showPrice;
}
}
}
if (config('bosettings.show_prices_guest') == "guest") {
@ -205,7 +204,7 @@ class Product extends Model implements Buyable
* Discount calc
*/
//montant de remise
// montant de remise
public function setDiscountAmountAttribute($value)
{
$this->discountAmount = $value;
@ -222,7 +221,7 @@ class Product extends Model implements Buyable
if ($promo_type == 1) {
$discountAmount = $applicablePromotion->discount_value;
} else {
//on augmente la précision à 3 digits, l'affichage formate les prix sur 2 décimales
// on augmente la précision à 3 digits, l'affichage formate les prix sur 2 décimales
$discountAmount = $this->priceHt * ($applicablePromotion->discount_value / 100);
$discountAmount = round($discountAmount * 1000) / 1000;
}
@ -233,7 +232,7 @@ class Product extends Model implements Buyable
}
}
//taux de remise
// taux de remise
public function setDiscountRateAttribute($value)
{
$this->discountRate = $value;
@ -248,7 +247,7 @@ class Product extends Model implements Buyable
if (null !== $applicablePromotion) {
$promo_type = $applicablePromotion->discount_type_id;
if ($promo_type == 1) {
//on veut un pourcentage
// on veut un pourcentage
$discountRate = ($applicablePromotion->discount_value / $this->priceHt) * 100;
} else {
$discountRate = $applicablePromotion->discount_value;
@ -267,7 +266,7 @@ class Product extends Model implements Buyable
return $this->priceHt;
}
//Relations
// Relations
public function range()
{
return $this->belongsTo('App\Models\Range', 'range_id');
@ -289,13 +288,13 @@ class Product extends Model implements Buyable
->withPivot('quantity');
}
//relationship to additionnal product info
// relationship to additionnal product info
public function additionnalProductInfo($productType)
{
return $this->$productType;
}
//possible additionnals
// possible additionnals
public function foodProduct()
{
return $this->hasOne(FoodProduct::class, 'product_id');
@ -318,13 +317,13 @@ class Product extends Model implements Buyable
//relationship to associated products
// relationship to associated products
public function products()
{
return $this->belongsToMany(Product::class, 'products_products', 'product_id', 'associated_id');
}
//offres speciales
// offres speciales
public function promotions()
{
$now = Carbon::now();
@ -333,13 +332,13 @@ class Product extends Model implements Buyable
->whereDate('date_end', '>=', $now);
}
//taxe
// taxe
public function tax()
{
return $this->belongsTo(TaxRate::class, 'tax_rate_id');
}
//tags
// tags
public function tags()
{
return $this->belongsToMany(Tag::class);

View file

@ -18,7 +18,8 @@ class ProductType extends Model
'product_id',
];
public function product() {
public function product()
{
return $this->belongsTo(Product::class);
}
}

View file

@ -8,5 +8,6 @@ use Illuminate\Database\Eloquent\Model;
class ProductsProducts extends Model
{
use HasFactory;
//useless model it seems
// useless model it seems
}

View file

@ -9,11 +9,13 @@ class Range extends Model
{
use HasFactory;
public function products() {
public function products()
{
return $this->hasMany('App\Models\Product', 'range_id');
}
public function old_slugs() {
public function old_slugs()
{
return $this->hasMany('App\Model\OldSlug', 'ranges');
}
}

View file

@ -23,7 +23,8 @@ class Salarie extends Model
];
public function customer() {
public function customer()
{
return $this->belongsTo(Customers::class);
}
}

View file

@ -19,7 +19,8 @@ class Slide extends Model
'date_end' => 'datetime',
];
public function slider() {
public function slider()
{
return $this->belongsTo(Slider::class);
}
}

View file

@ -26,6 +26,5 @@ class Slider extends Model
$q->whereDate('date_end', '>=', $now)
->orWhereNull('date_end');
});
}
}

View file

@ -9,7 +9,8 @@ class Stat extends Model
{
use HasFactory;
public function product() {
public function product()
{
return $this->belongsTo('App\Models\Product', 'product_id');
}
}

View file

@ -11,7 +11,8 @@ class TaxRate extends Model
public $timestamps = false;
public function products() {
public function products()
{
return $this->hasMany(Product::class, 'tax_rate_id');
}
}

View file

@ -2,14 +2,14 @@
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
use HasFactory;
use Notifiable;
/**
* The attributes that are mass assignable.
@ -44,7 +44,8 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
];
public function orders() {
public function orders()
{
return $this->hasMany('App\Models\Order', 'user_id');
}
}

View file

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Storage;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Collection;
class XmlInco extends Model
@ -59,9 +58,10 @@ class XmlInco extends Model
/**
* retrieve a collection of medias
*/
public function getMediasAttribute() {
public function getMediasAttribute()
{
/** @var Filesystem */
$disk = $this->getDisk();
$disk = $this->getDisk();
$files = $disk->files($this->imagesPath);
$collFiles = new Collection();
@ -74,7 +74,7 @@ class XmlInco extends Model
if (!in_array($pi, array($this->id))) {
continue;
}
$image = base64_encode($disk->get($file));
$image = base64_encode($disk->get($file));
$element = array(
"filename" => $pi,
"imgdata" => $image
@ -104,31 +104,37 @@ class XmlInco extends Model
$foodProduct = FoodProduct::where('no_art', $this->id)->first();
if (!empty($foodProduct)) {
//info produits à suggerer lors de l'édition
// info produits à suggerer lors de l'édition
// this->descriptif (doit aller dans la table products)
// $table->text('preparation')->nullable(); => $this->conseil_prepa
// $table->text('selling_argument')->nullable(); => $this->arg_vente
//infos produit maj automatique
// infos produit maj automatique
$foodProduct->ingredients = $this->lst_ing;
$foodProduct->allergens = $this->lib_allergene;
//$foodProduct->servings = $this->nb_portion; // problem les types de correspondent pas numeric = string (exemple this->nb_portion = '1/2')
// $foodProduct->servings = $this->nb_portion; // problem les types de correspondent pas numeric = string (exemple this->nb_portion = '1/2')
$nutri_values = $this->nutritional_values;
if (!empty($nutri_values)) {
//maj des info nutri locales
//pour la ref
// maj des info nutri locales
// pour la ref
$foodProduct->nv_ref_weight_g = $nutri_values["taille_ref"];
$foodProduct->nv_kj = $nutri_values["val_energ_kj_r"]; //Energie Kj
$foodProduct->nv_kcal = $nutri_values["val_energ_kcal_r"]; //Energie Kcal
$foodProduct->nv_fat_g = $nutri_values["mat_grass_r"]; //graisses
$foodProduct->nv_sat_fat_g = $nutri_values["ags_r"]; //dont acides gras saturés
$foodProduct->nv_carb_g = $nutri_values["glucides_r"]; //Glucides
$foodProduct->nv_sugar_g = $nutri_values["sucre_r"]; //dont sucres
$foodProduct->nv_fiber_g = $nutri_values["fib_alim_r"]; //fibres alimentaires
$foodProduct->nv_protein_g = $nutri_values["proteine_r"]; //protéines
$foodProduct->nv_salt_g = $nutri_values["sel_r"]; //sel
$foodProduct->nv_kj = $nutri_values["val_energ_kj_r"];
// Energie Kj
$foodProduct->nv_kcal = $nutri_values["val_energ_kcal_r"];
// Energie Kcal
$foodProduct->nv_fat_g = $nutri_values["mat_grass_r"];
// graisses
$foodProduct->nv_sat_fat_g = $nutri_values["ags_r"];
// dont acides gras saturés
$foodProduct->nv_carb_g = $nutri_values["glucides_r"];
// Glucides
$foodProduct->nv_sugar_g = $nutri_values["sucre_r"];
// dont sucres
$foodProduct->nv_fiber_g = $nutri_values["fib_alim_r"];
// fibres alimentaires
$foodProduct->nv_protein_g = $nutri_values["proteine_r"];
// protéines
$foodProduct->nv_salt_g = $nutri_values["sel_r"];
// sel
// $foodProduct-> = $nutri_values["sodium_r"];
// $foodProduct-> = $nutri_values["ener_e14_r"];
// $foodProduct-> = $nutri_values["fruits_r"];
@ -140,41 +146,52 @@ class XmlInco extends Model
// $foodProduct-> = $nutri_values["fibtg_r"];
// $foodProduct-> = $nutri_values["pro_r"];
// $foodProduct-> = $nutri_values["salteq_r"];
//valeurs nutritionnelles par portion
$foodProduct->nv_serving_size_g = $nutri_values["taille_port"]; //taille portion en grammes
$foodProduct->nv_serving_kj = $nutri_values["val_energ_kj_p"]; //Energie Kj
$foodProduct->nv_serving_kcal = $nutri_values["val_energ_kcal_p"]; //Energie Kcal
$foodProduct->nv_serving_fat_g = $nutri_values["mat_grass_p"]; //graisses
$foodProduct->nv_serving_sat_fat_g = $nutri_values["ags_p"]; //dont acides gras saturés
$foodProduct->nv_serving_carb_g = $nutri_values["glucides_p"]; //Glucides
$foodProduct->nv_serving_sugar_g = $nutri_values["sucre_p"]; //dont sucres
$foodProduct->nv_serving_fiber_g = $nutri_values["fib_alim_p"]; //fibres alimentaires
$foodProduct->nv_serving_protein_g = $nutri_values["proteine_p"]; //protéines
$foodProduct->nv_serving_salt_g = $nutri_values["sel_p"]; //sel
// valeurs nutritionnelles par portion
$foodProduct->nv_serving_size_g = $nutri_values["taille_port"];
// taille portion en grammes
$foodProduct->nv_serving_kj = $nutri_values["val_energ_kj_p"];
// Energie Kj
$foodProduct->nv_serving_kcal = $nutri_values["val_energ_kcal_p"];
// Energie Kcal
$foodProduct->nv_serving_fat_g = $nutri_values["mat_grass_p"];
// graisses
$foodProduct->nv_serving_sat_fat_g = $nutri_values["ags_p"];
// dont acides gras saturés
$foodProduct->nv_serving_carb_g = $nutri_values["glucides_p"];
// Glucides
$foodProduct->nv_serving_sugar_g = $nutri_values["sucre_p"];
// dont sucres
$foodProduct->nv_serving_fiber_g = $nutri_values["fib_alim_p"];
// fibres alimentaires
$foodProduct->nv_serving_protein_g = $nutri_values["proteine_p"];
// protéines
$foodProduct->nv_serving_salt_g = $nutri_values["sel_p"];
// sel
// $foodProduct-> = $nutri_values["sodium_p"];
// $foodProduct-> = $nutri_values["fruits_p"];
//apports journaliers
$foodProduct->nv_daily_energy = $nutri_values["pourcent_apport_ref_kjo_r"]; //Energie % recommandé
$foodProduct->nv_daily_fat = $nutri_values["pourcent_apport_ref_fat_r"]; //graisses
$foodProduct->nv_daily_sat_fat = $nutri_values["pourcent_apport_ref_fatsat_r"]; //dont acides gras saturés
$foodProduct->nv_daily_carb = $nutri_values["pourcent_apport_ref_choval_r"]; //Glucides
$foodProduct->nv_daily_sugar = $nutri_values["pourcent_apport_ref_sugar_r"]; //dont sucres
$foodProduct->nv_daily_fiber = $nutri_values["pourcent_apport_ref_fibtg_r"]; //fibres alimentaires
$foodProduct->nv_daily_protein = $nutri_values["pourcent_apport_ref_pro_r"]; //protéines
$foodProduct->nv_daily_salt = $nutri_values["pourcent_apport_ref_salteq_r"]; //sel
//$foodProduct-> = $nutri_values["pourcent_apport_ref_e14_r"];
//nutriscore
// apports journaliers
$foodProduct->nv_daily_energy = $nutri_values["pourcent_apport_ref_kjo_r"];
// Energie % recommandé
$foodProduct->nv_daily_fat = $nutri_values["pourcent_apport_ref_fat_r"];
// graisses
$foodProduct->nv_daily_sat_fat = $nutri_values["pourcent_apport_ref_fatsat_r"];
// dont acides gras saturés
$foodProduct->nv_daily_carb = $nutri_values["pourcent_apport_ref_choval_r"];
// Glucides
$foodProduct->nv_daily_sugar = $nutri_values["pourcent_apport_ref_sugar_r"];
// dont sucres
$foodProduct->nv_daily_fiber = $nutri_values["pourcent_apport_ref_fibtg_r"];
// fibres alimentaires
$foodProduct->nv_daily_protein = $nutri_values["pourcent_apport_ref_pro_r"];
// protéines
$foodProduct->nv_daily_salt = $nutri_values["pourcent_apport_ref_salteq_r"];
// sel
// $foodProduct-> = $nutri_values["pourcent_apport_ref_e14_r"];
// nutriscore
$foodProduct->nutriscore = $nutri_values["classement"];
//Infos n'ayant pas de mapping
// Infos n'ayant pas de mapping
// $foodProduct-> = $nutri_values["val_energ_kj_nut"];
// $foodProduct-> = $nutri_values["val_energ_kcal_nut"];
// $foodProduct-> = $nutri_values["mat_grass_nut"];
@ -228,9 +245,9 @@ class XmlInco extends Model
// $foodProduct-> = $nutri_values["fruits_r_prec"];
// $foodProduct-> = $nutri_values["fruits_coque_sech_r_prec"];
// $foodProduct-> = $nutri_values["score_nutri"];
}
}//end if
$foodProduct->save();
}
}//end if
}
}

View file

@ -2,8 +2,6 @@
namespace App\Policies;
use App\Models\Customers;
use App\Models\User;
use App\Models\Product;
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Auth\Access\Response;
@ -20,18 +18,18 @@ class ProductPolicy
*/
public function __construct()
{
//
}
/**
* $user is a App\Models\User or a App\Models\Customers
*/
public function addToCart($user = null, Product $product) {
public function addToCart($user = null, Product $product)
{
$now = Carbon::now();
if($product->orderable_start === null or $product->orderable_start <= $now) {
//on est entré dans la période commandable ou c'est commandable depuis toujours
if($product->orderable_end === null or $product->orderable_end >= $now) {
//il n'y a pas de limite dans le temps ou elle n'est pas encore passée
if ($product->orderable_start === null or $product->orderable_start <= $now) {
// on est entré dans la période commandable ou c'est commandable depuis toujours
if ($product->orderable_end === null or $product->orderable_end >= $now) {
// il n'y a pas de limite dans le temps ou elle n'est pas encore passée
return Response::allow();
}
return Response::deny('Ce produit n\'est pas disponible pour le moment');

View file

@ -2,7 +2,6 @@
namespace App\Providers;
use App\Enums\SellUnit;
use App\Models\Range;
use App\Models\Tag;
use App\Models\Setting;
@ -21,7 +20,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
}
/**
@ -40,21 +38,24 @@ class AppServiceProvider extends ServiceProvider
setlocale(LC_TIME, strtoupper(config('app.locale')) . "_" . config('app.locale') . '.utf8');
}
//bo settings as config
//this is useful when setting up the app whene settings table doesn't exist yet
// bo settings as config
// this is useful when setting up the app whene settings table doesn't exist yet
try {
config([
'bosettings' => Setting::all()
->keyBy('key') // key every setting by its name
->keyBy('key')
// key every setting by its name
->transform(function ($setting) {
return $setting->value; // return only the value
return $setting->value;
// return only the value
})
->toArray() // make it an array
->toArray()
// make it an array
]);
} catch (QueryException $e) {
//nevermind, you should run php artisan migrate before going any further.
// nevermind, you should run php artisan migrate before going any further.
}
//this is useful when setting up the app whene ranges table doesn't exist yet
// this is useful when setting up the app whene ranges table doesn't exist yet
try {
// on partage les ranges (gammes produit)
$ranges = Range::where('status', '1')->get();
@ -63,7 +64,7 @@ class AppServiceProvider extends ServiceProvider
}
View::share('published_ranges', $ranges);
//this is useful when setting up the app when tags table doesn't exist yet
// this is useful when setting up the app when tags table doesn't exist yet
try {
// on partage les tags
$tags = Tag::where('status', '1')->orderBy('order', 'ASC')->get();
@ -72,14 +73,14 @@ class AppServiceProvider extends ServiceProvider
}
View::share('published_tags', $tags);
//@TODO : Supprimer cet element front_settings
//this is useful when setting up the app whene settings table doesn't exist yet
// @TODO : Supprimer cet element front_settings
// this is useful when setting up the app whene settings table doesn't exist yet
try {
$front_settings = Setting::where('key', 'LIKE', 'theme_%')->get();
} catch (QueryException $e) {
$front_settings = null;
}
//front theme settings
// front theme settings
View::share('front_settings', $front_settings);
Blade::directive('fmt_currency', function ($expression) {
@ -92,19 +93,19 @@ class AppServiceProvider extends ServiceProvider
});
Blade::directive('fmt_sellunit', function ($expression) {
if(config('bosettings.sell_unit_management') == "strict") {
if (config('bosettings.sell_unit_management') == "strict") {
return "<?php if(!empty($expression)) { echo sprintf('/ %s', SellUnit::make($expression)->label); } ?>";
} else {
return "<?php if(!empty($expression)) { echo sprintf('/ %s', $expression); } ?>";
}
});
Blade::directive('excerpt_product_title', function($expression) {
Blade::directive('excerpt_product_title', function ($expression) {
$limit = config('theme.max_product_title_length');
return "<?php echo Illuminate\Support\Str::limit($expression,$limit) ?>";
});
//default paginator template for back Office
// default paginator template for back Office
Paginator::useBootstrap();
}
}

View file

@ -3,7 +3,6 @@
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
@ -24,7 +23,5 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -5,7 +5,6 @@ namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
@ -27,6 +26,5 @@ class EventServiceProvider extends ServiceProvider
*/
public function boot()
{
//
}
}

View file

@ -7,7 +7,6 @@ use Carbon\Carbon;
class Adult implements Rule
{
private $error_messages = "la date de naissance est incorrecte";
/**
@ -17,15 +16,14 @@ class Adult implements Rule
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param string $attribute
* @param mixed $value
* @return bool
* @return boolean
*/
public function passes($attribute, $value)
{
@ -48,7 +46,7 @@ class Adult implements Rule
return false;
}
//pass
// pass
return true;
}

View file

@ -29,13 +29,12 @@
"phpunit/phpunit": "^9.3.3",
"slevomat/coding-standard": "^7.1"
},
"repositories": [
{
"name": "ldc/ldccrmv2client",
"type": "vcs",
"url": "https://voight001.lesidc.com/crm-client"
"repositories": {
"gitlab.com/16669037": {
"type": "composer",
"url": "https://gitlab.com/api/v4/group/16669037/-/packages/composer/packages.json"
}
],
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",

2130
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,64 +3,64 @@
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Front Views Folder
|--------------------------------------------------------------------------
|
| This value is the folder where blades will be found
|
|--------------------------------------------------------------------------
| Application Front Views Folder
|--------------------------------------------------------------------------
|
| This value is the folder where blades will be found
|
*/
'theme' => env('APP_THEME','basic'),
'theme' => env('APP_THEME', 'basic'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
'debug' => (bool)env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
@ -68,66 +68,66 @@ return [
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Paris',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
@ -135,14 +135,14 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
@ -191,14 +191,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
@ -239,7 +239,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
//Enums
// Enums
'LogType' => \App\Enums\LogType::class,
'SettingRegisterMode' => \App\Enums\SettingRegisterMode::class,
'SellUnit' => \App\Enums\SellUnit::class,

View file

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

View file

@ -3,51 +3,51 @@
return [
/*
|--------------------------------------------------------------------------
| View Name
|--------------------------------------------------------------------------
|
| Choose a view to display when Breadcrumbs::render() is called.
| Built in templates are:
|
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
| - 'breadcrumbs::bootstrap3' - Bootstrap 3
| - 'breadcrumbs::bootstrap2' - Bootstrap 2
| - 'breadcrumbs::bulma' - Bulma
| - 'breadcrumbs::foundation6' - Foundation 6
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
| - 'breadcrumbs::materialize' - Materialize
| - 'breadcrumbs::tailwind' - Tailwind CSS
| - 'breadcrumbs::uikit' - UIkit
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
|--------------------------------------------------------------------------
| View Name
|--------------------------------------------------------------------------
|
| Choose a view to display when Breadcrumbs::render() is called.
| Built in templates are:
|
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
| - 'breadcrumbs::bootstrap3' - Bootstrap 3
| - 'breadcrumbs::bootstrap2' - Bootstrap 2
| - 'breadcrumbs::bulma' - Bulma
| - 'breadcrumbs::foundation6' - Foundation 6
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
| - 'breadcrumbs::materialize' - Materialize
| - 'breadcrumbs::tailwind' - Tailwind CSS
| - 'breadcrumbs::uikit' - UIkit
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
*/
'view' => 'breadcrumb.layout',
/*
|--------------------------------------------------------------------------
| Breadcrumbs File(s)
|--------------------------------------------------------------------------
|
| The file(s) where breadcrumbs are defined. e.g.
|
| - base_path('routes/breadcrumbs.php')
| - glob(base_path('breadcrumbs/*.php'))
|
|--------------------------------------------------------------------------
| Breadcrumbs File(s)
|--------------------------------------------------------------------------
|
| The file(s) where breadcrumbs are defined. e.g.
|
| - base_path('routes/breadcrumbs.php')
| - glob(base_path('breadcrumbs/*.php'))
|
*/
'files' => base_path('routes/breadcrumbs.php'),
/*
|--------------------------------------------------------------------------
| Exceptions
|--------------------------------------------------------------------------
|
| Determine when to throw an exception.
|
|--------------------------------------------------------------------------
| Exceptions
|--------------------------------------------------------------------------
|
| Determine when to throw an exception.
|
*/
// When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
@ -60,12 +60,12 @@ return [
'invalid-named-breadcrumb-exception' => true,
/*
|--------------------------------------------------------------------------
| Classes
|--------------------------------------------------------------------------
|
| Subclass the default classes for more advanced customisations.
|
|--------------------------------------------------------------------------
| Classes
|--------------------------------------------------------------------------
|
| Subclass the default classes for more advanced customisations.
|
*/
// Manager

View file

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

View file

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

View file

@ -3,38 +3,38 @@
return [
/*
|--------------------------------------------------------------------------
| Gross price as base price
|--------------------------------------------------------------------------
|
| This default value is used to select the method to calculate prices and taxes
| If true the item price is managed as a gross price, so taxes will be calculated by separation/exclusion
|
|--------------------------------------------------------------------------
| Gross price as base price
|--------------------------------------------------------------------------
|
| This default value is used to select the method to calculate prices and taxes
| If true the item price is managed as a gross price, so taxes will be calculated by separation/exclusion
|
*/
//'calculator' => \Gloudemans\Shoppingcart\Calculation\DefaultCalculator::class,
// 'calculator' => \Gloudemans\Shoppingcart\Calculation\DefaultCalculator::class,
'calculator' => \App\Lib\LDC\CartCalculator::class,
/*
|--------------------------------------------------------------------------
| Default tax rate
|--------------------------------------------------------------------------
|
| This default tax rate will be used when you make a class implement the
| Taxable interface and use the HasTax trait.
|
|--------------------------------------------------------------------------
| Default tax rate
|--------------------------------------------------------------------------
|
| This default tax rate will be used when you make a class implement the
| Taxable interface and use the HasTax trait.
|
*/
'tax' => 20,
/*
|--------------------------------------------------------------------------
| Shoppingcart database settings
|--------------------------------------------------------------------------
|
| Here you can set the connection that the shoppingcart should use when
| storing and restoring a cart.
|
|--------------------------------------------------------------------------
| Shoppingcart database settings
|--------------------------------------------------------------------------
|
| Here you can set the connection that the shoppingcart should use when
| storing and restoring a cart.
|
*/
'database' => [
@ -46,25 +46,25 @@ return [
],
/*
|--------------------------------------------------------------------------
| Destroy the cart on user logout
|--------------------------------------------------------------------------
|
| When this option is set to 'true' the cart will automatically
| destroy all cart instances when the user logs out.
|
|--------------------------------------------------------------------------
| Destroy the cart on user logout
|--------------------------------------------------------------------------
|
| When this option is set to 'true' the cart will automatically
| destroy all cart instances when the user logs out.
|
*/
'destroy_on_logout' => false,
/*
|--------------------------------------------------------------------------
| Default number format
|--------------------------------------------------------------------------
|
| This defaults will be used for the formatted numbers if you don't
| set them in the method call.
|
|--------------------------------------------------------------------------
| Default number format
|--------------------------------------------------------------------------
|
| This defaults will be used for the formatted numbers if you don't
| set them in the method call.
|
*/
'format' => [

View file

@ -3,16 +3,16 @@
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*'],

View file

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

View file

@ -3,42 +3,42 @@
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
@ -51,7 +51,7 @@ return [
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
@ -87,14 +87,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [

View file

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

View file

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

View file

@ -3,34 +3,34 @@
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/
'mailers' => [
@ -73,14 +73,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
@ -89,19 +89,19 @@ return [
],
'contactsList' => [
'serviceweb' => explode(",", env('MAIL_LIST_SERVICEWEB', 'informatique.internet@ldc.fr')),
'invalidInco' => explode(",", env('MAIL_LIST_INVALIDINCO', 'informatique.internet@ldc.fr,vincent.pierre@ldc.fr,christelle.manceau@ldc.fr')),
'serviceweb' => explode(",", env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr')),
'invalidInco' => explode(",", env('MAIL_LIST_INVALIDINCO', 'equipe.web@ldc.fr,vincent.pierre@ldc.fr,christelle.manceau@ldc.fr')),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [

View file

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

View file

@ -3,15 +3,15 @@
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [

View file

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

Some files were not shown because too many files have changed in this diff Show more