Compare commits
123 commits
remove-han
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73eeec3e75 | ||
|
|
4890e1d55f | ||
|
|
7115c777ca | ||
|
|
cfff5d676d | ||
|
|
6b86c4f4bc | ||
|
|
bae249c704 | ||
|
|
ae78359251 | ||
|
|
1f34c77256 | ||
|
|
49a02d3e2d | ||
|
|
78e388c9df | ||
|
|
62cd74f250 | ||
|
|
fccb7cd3f6 | ||
|
|
c4f3ae1929 | ||
|
|
b106e9ac67 | ||
|
|
43837f3937 | ||
|
|
aca7083436 | ||
|
|
2689ec1bfc | ||
|
|
6b234cd0cc | ||
|
|
e24bfaf301 | ||
|
|
a5bd28fb69 | ||
|
|
7ca36a0913 | ||
|
|
bca4fa327a | ||
|
|
43b63c8da1 | ||
|
|
a9af7cfe7a | ||
|
|
73e4dc877e | ||
|
|
370019285d | ||
|
|
512009cbe9 | ||
|
|
a0f663bdd9 | ||
|
|
fdde79d369 | ||
|
|
a0b9d408d2 | ||
|
|
1b177d78f6 | ||
|
|
7d89800ca8 | ||
|
|
e2189efbbf | ||
|
|
7ac5a22c9b | ||
|
|
d2ce6edec5 | ||
|
|
00b4e85525 | ||
|
|
7072c92832 | ||
|
|
88af03ceb0 | ||
|
|
9074b02916 | ||
|
|
ecbf1a8837 | ||
|
|
1c0d7bae5e | ||
|
|
c9ba12c99d | ||
|
|
0d61ee8295 | ||
|
|
cb0fa25557 | ||
|
|
0d8b4543e5 | ||
|
|
859b1f3625 | ||
|
|
00865f4eff | ||
|
|
8ab156452f | ||
|
|
e8eefa158a | ||
|
|
0dc4021a18 | ||
|
|
f01db43447 | ||
|
|
37c3e78dc8 | ||
|
|
25c4905d99 | ||
|
|
05de5830f8 | ||
|
|
7d55cf7a39 | ||
|
|
f9e68f6ad6 | ||
|
|
d5f12af30d | ||
|
|
88db8dd345 | ||
|
|
6144d02a76 | ||
|
|
ca36cf55ac | ||
|
|
abb52d7d82 | ||
|
|
862fe3725c | ||
|
|
109199f0a4 | ||
|
|
1856c267c1 | ||
|
|
a3e4c1d08a | ||
|
|
3dbfbe940f | ||
|
|
979a1cf613 | ||
|
|
c0d8fdb73f | ||
|
|
8fd8ccd17d | ||
|
|
901b3c263d | ||
|
|
33cf96b21f | ||
|
|
58bbdafe43 | ||
|
|
94f9e1fd32 | ||
|
|
e0d33a9c2b | ||
|
|
765f9a06df | ||
|
|
1dc9c3e4d1 | ||
|
|
47672f1745 | ||
|
|
74aa0de294 | ||
|
|
a57525226f | ||
|
|
e4656628f7 | ||
|
|
fd8680c327 | ||
|
|
550c035248 | ||
|
|
3f24dc5b06 | ||
|
|
00c8d872c2 | ||
|
|
552cd2616a | ||
|
|
82cefd1c4c | ||
|
|
718bfc11eb | ||
|
|
b6d081ec26 | ||
|
|
81b2bed386 | ||
|
|
451a69151f | ||
|
|
88520498fb | ||
|
|
d4db7c57e6 | ||
|
|
dd13b99968 | ||
|
|
1704708902 | ||
|
|
fe928b1d80 | ||
|
|
61783b8e28 | ||
|
|
993d1358a6 | ||
|
|
7d956a54df | ||
|
|
0eb3b011a3 | ||
|
|
a3ecba6625 | ||
|
|
56fba36df2 | ||
|
|
5014f9196f | ||
|
|
52dbb15a3f | ||
|
|
b796e93d91 | ||
|
|
e793ce664e | ||
|
|
bdb44ab3a7 | ||
|
|
f37200aedf | ||
|
|
cb77f9bb14 | ||
|
|
29d818b5f0 | ||
|
|
d352ae64f1 | ||
|
|
785a6db60f | ||
|
|
2c26ecb874 | ||
|
|
48e2383b5f | ||
|
|
7e99d60b71 | ||
|
|
1bbb8c0f57 | ||
|
|
819d964c15 | ||
|
|
d6b3cb767e | ||
|
|
fcc2e101d9 | ||
|
|
7d768bda93 | ||
|
|
c346fb350b | ||
|
|
9e460153d6 | ||
|
|
aa4de0d001 | ||
|
|
642316cb5b |
231 changed files with 11492 additions and 3026 deletions
21
.env.example
21
.env.example
|
|
@ -21,6 +21,13 @@ DB_DATABASE_2016=legaulois2016
|
|||
DB_USERNAME_2016=
|
||||
DB_PASSWORD_2016=
|
||||
|
||||
## DATABASE OPINSTA
|
||||
DB_DATABASE_OPINSTA=
|
||||
DB_USERNAME_OPINSTA=
|
||||
DB_PASSWORD_OPINSTA=
|
||||
DB_HOST_OPINSTA=
|
||||
DB_PORT_OPINSTA=
|
||||
|
||||
## MIGRATION
|
||||
MIGRATIONPAGINATION=20000
|
||||
|
||||
|
|
@ -70,6 +77,14 @@ MESBR_COUPON_3_CHARCUT=""
|
|||
ANALYTICS_GOOGLE_ID=
|
||||
GOOGLE_MAP_API_KEY=
|
||||
|
||||
# Google Recaptcha
|
||||
GOOGLE_RECAPTCHA_PUBLIC=
|
||||
GOOGLE_RECAPTCHA_PRIVATE=
|
||||
GOOGLE_RECAPTCHA_VERSION=
|
||||
|
||||
# Matomo
|
||||
MATOMO_SITE_ID=
|
||||
|
||||
## MERCANET
|
||||
MERCANET_SECRET=
|
||||
MERCANET_MERCHAND_ID=
|
||||
|
|
@ -77,3 +92,9 @@ MERCANET_ENV=
|
|||
|
||||
# BYPASS THE CRM JUST LOGIN (needs debug mode)
|
||||
NOCRM=false
|
||||
|
||||
#OP INSTA
|
||||
## Démarre le à d-m-YYYY
|
||||
OPINSTA_START=
|
||||
## Fin le à d-m-YYYY
|
||||
OPINSTA_END=
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -29,3 +29,4 @@ mix-manifest.json
|
|||
workspace.code-workspace
|
||||
storage/crm_migration.csv
|
||||
auth.json
|
||||
.npmrc
|
||||
|
|
@ -1,74 +1,11 @@
|
|||
include:
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'lint/lint7.3.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'security/security7.3.yml'
|
||||
|
||||
stages:
|
||||
- Security
|
||||
- CodingStandards
|
||||
- Builds
|
||||
|
||||
composer-security:
|
||||
stage: Security
|
||||
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
|
||||
script:
|
||||
- local-php-security-checker --format=json --path=./composer.lock > composer-security-checker-report.json
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'composer-security-checker'
|
||||
paths:
|
||||
- composer-security-checker-report.json
|
||||
allow_failure: true
|
||||
needs: []
|
||||
|
||||
npm-security:
|
||||
stage: Security
|
||||
image: node:17.9.1
|
||||
before_script:
|
||||
- npm install --location=global audit-ci@^6
|
||||
script:
|
||||
- audit-ci -p npm -o json > npm-security-checker-report.json
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'npm-security-checker'
|
||||
paths:
|
||||
- npm-security-checker-report.json
|
||||
allow_failure: true
|
||||
needs: []
|
||||
|
||||
phpcs:
|
||||
stage: CodingStandards
|
||||
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
|
||||
before_script:
|
||||
- composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
|
||||
- composer install
|
||||
cache:
|
||||
paths:
|
||||
- vendor/
|
||||
script:
|
||||
- vendor/bin/phpcs --report=junit --report-file=phpcs-report.xml
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'phpcs'
|
||||
paths:
|
||||
- phpcs-report.xml
|
||||
reports:
|
||||
junit: phpcs-report.xml
|
||||
allow_failure: false
|
||||
needs:
|
||||
- composer-security
|
||||
- npm-security
|
||||
|
||||
front-build:
|
||||
stage: Builds
|
||||
image: node:17.9.1
|
||||
before_script:
|
||||
- npm install
|
||||
cache:
|
||||
paths:
|
||||
- node_modules/
|
||||
script:
|
||||
- npm run prod > front-build-report.json
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'front-build-report'
|
||||
paths:
|
||||
- front-build-report.json
|
||||
allow_failure: false
|
||||
needs:
|
||||
- phpcs
|
||||
- lint
|
||||
- security
|
||||
|
|
|
|||
11
.gitlab/issue_templates/bug.md
Normal file
11
.gitlab/issue_templates/bug.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
## Comportement constaté
|
||||
|
||||
|
||||
## Comportement attendu
|
||||
|
||||
|
||||
## Solution envisagée
|
||||
|
||||
|
||||
## Étapes pour la reproduction du bug
|
||||
*
|
||||
7
.gitlab/issue_templates/feature.md
Normal file
7
.gitlab/issue_templates/feature.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## Présentation du besoin
|
||||
|
||||
|
||||
## Implémentation
|
||||
|
||||
|
||||
## Maquettes, documentations...
|
||||
|
|
@ -16,7 +16,6 @@ use App\Jobs\DeleteOldNotifications;
|
|||
use App\Jobs\DeleteOrders;
|
||||
use App\Jobs\PurgeNotifications as JobsPurgeNotifications;
|
||||
use App\Jobs\PurgeOldResetPasswords;
|
||||
use App\Jobs\SendOcbMissingBreederReminder;
|
||||
use App\Jobs\UpdateReductions as JobsUpdateReductions;
|
||||
use App\Jobs\XmlEleveursReader as JobsXmlEleveursReader;
|
||||
use App\Jobs\XmlIncoReader as JobsXmlIncoReader;
|
||||
|
|
@ -52,19 +51,19 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
//$schedule->job(SendOcbMissingBreederReminder::class)->onOneServer()->dailyAt('07:30');
|
||||
// $schedule->job(SendOcbMissingBreederReminder::class)->dailyAt('07:30');
|
||||
$schedule->job(DeleteOrders::class)->dailyAt('14:00');
|
||||
$schedule->job(DeleteOldMessages::class)->dailyAt('14:15');
|
||||
$schedule->job(DeleteOldNotifications::class)->dailyAt('14:30');
|
||||
$schedule->job(JobsUpdateReductions::class)->dailyAt('14:45');
|
||||
$schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->onOneServer()->dailyAt('15:00');
|
||||
$schedule->job(JobsXmlTracaReader::class)->name('xml-traca-reader')->onOneServer()->dailyAt('15:15');
|
||||
$schedule->job(JobsXmlEleveursReader::class)->name('xml-eleveurs-reader')->onOneServer()->dailyAt('15:30');
|
||||
$schedule->job(JobsXSCVMepReader::class)->name('csv-mep-reader')->onOneServer()->dailyAt('16:00');
|
||||
$schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->dailyAt('15:00');
|
||||
$schedule->job(JobsXmlTracaReader::class)->name('xml-traca-reader')->dailyAt('15:15');
|
||||
$schedule->job(JobsXmlEleveursReader::class)->name('xml-eleveurs-reader')->dailyAt('15:30');
|
||||
$schedule->job(JobsXSCVMepReader::class)->name('csv-mep-reader')->dailyAt('16:00');
|
||||
$schedule->job(JobsPurgeNotifications::class)->dailyAt('00:15');
|
||||
$schedule->job(PurgeOldResetPasswords::class)->dailyAt('00:25');
|
||||
|
||||
// * Remove Old traca
|
||||
$schedule->command('xml:clean_olds')->onOneServer()->dailyAt('06:00');
|
||||
$schedule->command('xml:clean_olds')->dailyAt('06:00');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class ArticleCategory extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class BreedingBlocType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -17,6 +22,11 @@ final class BreedingBlocType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class ContactFormCivility extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class ContactFormCivility extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -26,6 +36,11 @@ final class ContactFormCivility extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ final class ContactFormType extends BaseEnumRoutable
|
|||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class Days extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -30,6 +35,11 @@ final class Days extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -44,6 +54,11 @@ final class Days extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
|
||||
abstract class Departaimant extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class DepartaimantCollectionType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class DepartaimantCollectionType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum label
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -26,6 +36,11 @@ final class DepartaimantCollectionType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Json serialize implementation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@ namespace App\Enums;
|
|||
*/
|
||||
final class DepartaimantCurrent extends Departaimant
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -214,6 +219,11 @@ final class DepartaimantCurrent extends Departaimant
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum label
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class DepartaimantStatus extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -22,6 +27,11 @@ final class DepartaimantStatus extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -32,11 +42,21 @@ final class DepartaimantStatus extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* To Array
|
||||
*
|
||||
* @return \Kwaadpepper\Enum\BaseEnum[]
|
||||
*/
|
||||
public static function toArray(): array
|
||||
{
|
||||
$array = [];
|
||||
|
|
@ -49,6 +69,11 @@ final class DepartaimantStatus extends BaseEnumRoutable
|
|||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Json serialize implementation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -105,6 +105,11 @@ namespace App\Enums;
|
|||
*/
|
||||
final class DepartaimantVintage extends Departaimant
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -210,6 +215,11 @@ final class DepartaimantVintage extends Departaimant
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class EleveurOcbStatus extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -21,6 +26,12 @@ final class EleveurOcbStatus extends BaseEnumRoutable
|
|||
'yes' => 3
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -31,6 +42,11 @@ final class EleveurOcbStatus extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class EngagementBlocType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -24,6 +29,11 @@ final class EngagementBlocType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class EngagementType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class EngagementType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class GMapDataType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class GeneralConfigType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -22,6 +27,11 @@ final class GeneralConfigType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class GeoType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class GeoType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class InputType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class NotificationType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -24,6 +29,11 @@ final class NotificationType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class NutritionBlocType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -29,6 +34,11 @@ final class NutritionBlocType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class NutritionPageType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class NutritionPageType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -5,25 +5,32 @@ namespace App\Enums;
|
|||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* @method static self egg()
|
||||
* @method static self rabbit()
|
||||
* @method static self poultry()
|
||||
*/
|
||||
final class OCBType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'egg' => 0,
|
||||
'rabbit' => 1,
|
||||
'poultry' => 2
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
'egg' => __('Oeuf'),
|
||||
'rabbit' => __('Lapin'),
|
||||
'poultry' => __('Volaille')
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class OrderStatus extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -24,6 +29,11 @@ final class OrderStatus extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class OrderType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class OrderType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class PoultryBlocType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -20,6 +25,11 @@ final class PoultryBlocType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class PoultryPageType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class PoultryPageType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class PresentationType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class PresentationType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class RangeColor extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -35,6 +40,12 @@ final class RangeColor extends BaseEnumRoutable
|
|||
'color11' => 'color-11'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class RecipeDifficulty extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -22,6 +27,11 @@ final class RecipeDifficulty extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -32,6 +42,11 @@ final class RecipeDifficulty extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the value as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->label;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class RecipeFilter extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
$labels = self::labels();
|
||||
|
|
@ -24,6 +29,11 @@ final class RecipeFilter extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class RecipeFilterTimes extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
$labels = self::labels();
|
||||
|
|
@ -22,6 +27,11 @@ final class RecipeFilterTimes extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
final class RecipeType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -18,6 +23,11 @@ final class RecipeType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Exception;
|
|||
/**
|
||||
* This class Exception is used to skip a row import from
|
||||
* database migration (2016 -> 2020)
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
class AbortContactMailer extends Exception
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Exception;
|
|||
/**
|
||||
* This class Exception is used to skip a row import from
|
||||
* database migration (2016 -> 2020)
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
class AbortRowImportException extends Exception
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Exception;
|
|||
/**
|
||||
* This class Exception is used in CB payement process
|
||||
* database migration (2016 -> 2020)
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
class CBPayementError extends Exception
|
||||
|
|
|
|||
9
app/Exceptions/InstaApiLimitReachedException.php
Normal file
9
app/Exceptions/InstaApiLimitReachedException.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class InstaApiLimitReachedException extends Exception
|
||||
{
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ use Exception;
|
|||
/**
|
||||
* This class Exception is used to skip a row import from
|
||||
* database migration (2016 -> 2020)
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
class RedirectTo extends Exception
|
||||
|
|
|
|||
|
|
@ -5,26 +5,36 @@ namespace App\Http\Controllers;
|
|||
use App\Enums\GeneralConfigType;
|
||||
use App\Models\Actu;
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class ActuController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$tags = Tag::has('actus')->get();
|
||||
$actus = Actu::where('status', true)
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Tag> */
|
||||
$tags = Tag::query()->whereHas('actus', function (Builder $q) {
|
||||
$q->where('status', true);
|
||||
})->get();
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Actu> */
|
||||
$actus = Actu::query()->where('status', true)
|
||||
->with('tags:id')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get(['id'])
|
||||
->mapWithKeys(function ($actu) {
|
||||
->map(function ($actu) {
|
||||
return [
|
||||
$actu->id => [
|
||||
'id' => $actu->id,
|
||||
'tags' => $actu->tags->mapWithKeys(function ($tag) {
|
||||
return [$tag->id => $tag->id];
|
||||
})->all()
|
||||
]
|
||||
'id' => $actu->id,
|
||||
'tags' => $actu->tags->map(function ($tag) {
|
||||
return $tag->id;
|
||||
})->all()
|
||||
];
|
||||
})->all();
|
||||
|
||||
$generalConfig = app()->view->getShared()['GeneralConfigGlobal'] ?? null;
|
||||
$generalConfig = $generalConfig ? $generalConfig->where('type', GeneralConfigType::actu())->first() : null;
|
||||
return view('front.actu.index', [
|
||||
|
|
@ -35,6 +45,12 @@ class ActuController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a news
|
||||
*
|
||||
* @param \App\Models\Actu $actu
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function view(Actu $actu)
|
||||
{
|
||||
$relatedActus = Actu::whereHas('tags', function ($q) use ($actu) {
|
||||
|
|
@ -50,6 +66,12 @@ class ActuController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a news for JS usage (ajax)
|
||||
*
|
||||
* @param \App\Models\Actu $actu
|
||||
* @return string Base64 rendered view.
|
||||
*/
|
||||
public function renderActu(Actu $actu)
|
||||
{
|
||||
if (!request()->wantsJson()) {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ class AuthController extends Controller
|
|||
/**
|
||||
* Enregistre le customer dans la base de données
|
||||
*
|
||||
* @param CustomerRegisterRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @param \App\Http\Requests\CustomerRegisterRequest $request
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function registerSubmit(CustomerRegisterRequest $request)
|
||||
{
|
||||
|
|
@ -143,6 +143,7 @@ class AuthController extends Controller
|
|||
|
||||
/**
|
||||
* Retourne la page de connexion
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
|
|
@ -253,9 +254,11 @@ class AuthController extends Controller
|
|||
/**
|
||||
* Handle Api error exception
|
||||
*
|
||||
* @param ApiErrorException $e
|
||||
* @param LoginRequest $request
|
||||
* @param \LDC\LDCCRM\Exceptions\ApiErrorException $e
|
||||
* @param \App\Http\Requests\LoginRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Exception Exception.
|
||||
*/
|
||||
private function handleLoginApiErrorException(ApiErrorException $e, LoginRequest $request)
|
||||
{
|
||||
|
|
@ -327,9 +330,12 @@ class AuthController extends Controller
|
|||
/**
|
||||
* Login a customer
|
||||
*
|
||||
* @param Customers $customer
|
||||
* @param boolean $remember
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
* @param \App\Models\Customers $customer
|
||||
* @param boolean $remember
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Exception Exception.
|
||||
* @throws \RuntimeException RuntimeException.
|
||||
*/
|
||||
private function processLogin(Customers $customer, bool $remember)
|
||||
{
|
||||
|
|
@ -358,11 +364,12 @@ class AuthController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Fomulaire reset mot de passe
|
||||
* sur la page login
|
||||
* Fomulaire reset mot de passe sur la page login
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|void
|
||||
* @throws \Exception Exception.
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function passwordReset(Request $request)
|
||||
{
|
||||
|
|
@ -452,12 +459,13 @@ class AuthController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Modification du mot de passe par lien via le formulaire
|
||||
* reset mot de passe
|
||||
* Modification du mot de passe par lien via le formulaire reset mot de passe
|
||||
*
|
||||
* @param ResetCustomerPassword $request
|
||||
* @param string $token
|
||||
* @param \App\Http\Requests\ResetCustomerPassword $request
|
||||
* @param string $token
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \LDC\LDCCRM\Exceptions\CrmException CrmException.
|
||||
*/
|
||||
public function changePassword(ResetCustomerPassword $request, string $token)
|
||||
{
|
||||
|
|
@ -503,8 +511,9 @@ class AuthController extends Controller
|
|||
/**
|
||||
* Mettre à jour le mot de passe lorsque l'on est connecté
|
||||
*
|
||||
* @param CustomerUpdatePassword $request
|
||||
* @param \App\Http\Requests\CustomerUpdatePassword $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function changePasswordWhenAuthenticated(CustomerUpdatePassword $request)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -444,6 +444,7 @@ class MomentsController extends Controller
|
|||
|
||||
/**
|
||||
* Passe un moment en moment star. Si il y avait déjà un moment star, il ne l'est plus et le nouveau le remplace
|
||||
*
|
||||
* @param id L'id du moment qui doit devenir moment star
|
||||
*/
|
||||
public function setStar($id)
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ class BoutiqueController extends Controller
|
|||
|
||||
/**
|
||||
* Get Mercanet ref and responseCode for request
|
||||
*
|
||||
* @return array['ref' => 'value', 'responseCode' => 'value']
|
||||
*/
|
||||
private function getMercanetData(Request $request): array
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ class BreedingPageController extends Controller
|
|||
*/
|
||||
public function list(BreedingPageType $pageType)
|
||||
{
|
||||
$pages = BreedingPage::where('type', $pageType)->whereStatus(true)->get();
|
||||
$bannerUrl = $this->getBannerUrlFromGeneralConfig($pageType);
|
||||
$pages = BreedingPage::where('type', $pageType)->whereStatus(true)->get();
|
||||
$bannerUrl = $this->getBannerUrlFromGeneralConfig($pageType);
|
||||
$headerText = $this->getTextHeaderFromGeneralConfig($pageType);
|
||||
|
||||
return view('front.breeding-page.list', compact('pages', 'pageType', 'bannerUrl', 'headerText'));
|
||||
|
|
|
|||
|
|
@ -51,10 +51,11 @@ class ClubController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* index
|
||||
* Index
|
||||
*
|
||||
* @param ArticleCategory|null $tag
|
||||
* @param \App\Enums\ArticleCategory|null $tag
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function index(ArticleCategory $tag = null)
|
||||
{
|
||||
|
|
@ -110,8 +111,10 @@ class ClubController extends Controller
|
|||
*
|
||||
* nom, prénom, adresse, code postal, ville
|
||||
*
|
||||
* @param UpdateInfosRequest $request
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
* @param \App\Http\Requests\UpdateInfosRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Illuminate\Validation\ValidationException ValidationException.
|
||||
*/
|
||||
public function updateInfos(UpdateInfosRequest $request)
|
||||
{
|
||||
|
|
@ -151,8 +154,11 @@ class ClubController extends Controller
|
|||
/**
|
||||
* missingCrmInfosSubmit
|
||||
*
|
||||
* @param UpdateInfosRequest $request
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
* @param \App\Http\Requests\UpdateInfosRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Illuminate\Validation\ValidationException ValidationException.
|
||||
* @throws \Symfony\Component\Routing\Exception\RouteNotFoundException RouteNotFoundException.
|
||||
*/
|
||||
public function missingCrmInfosSubmit(UpdateInfosRequest $request)
|
||||
{
|
||||
|
|
@ -171,9 +177,11 @@ class ClubController extends Controller
|
|||
/**
|
||||
* Updates user info
|
||||
*
|
||||
* @param UpdateInfosRequest $request
|
||||
* @return boolean|string return strictly true if success,
|
||||
* false il failed, could be a string with message error if failed
|
||||
* @param \App\Http\Requests\UpdateInfosRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse|string|boolean return strictly true if success,
|
||||
* false il failed, could be a string with message error if failed
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Illuminate\Validation\ValidationException ValidationException.
|
||||
*/
|
||||
private function updateUserInfo(UpdateInfosRequest $request)
|
||||
{
|
||||
|
|
@ -307,9 +315,9 @@ class ClubController extends Controller
|
|||
/**
|
||||
* reductionsGet
|
||||
*
|
||||
* @param DownloadBRFileRequest $request
|
||||
* @return Response
|
||||
* @throws Exception Exception.
|
||||
* @param \App\Http\Requests\DownloadBRFileRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
* @throws \Exception Exception.
|
||||
*/
|
||||
public function reductionsGet(DownloadBRFileRequest $request)
|
||||
{
|
||||
|
|
@ -347,9 +355,11 @@ class ClubController extends Controller
|
|||
|
||||
/**
|
||||
* Call the article page with a slug for the article to print
|
||||
* @param ArticleCategory $tag
|
||||
* @param Articles $publishedArticle
|
||||
* @return View The view that the article have to print
|
||||
*
|
||||
* @param \App\Enums\ArticleCategory $tag
|
||||
* @param \App\Models\Articles $publishedArticle
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function article(ArticleCategory $tag, Articles $publishedArticle)
|
||||
|
|
@ -382,8 +392,11 @@ class ClubController extends Controller
|
|||
|
||||
/**
|
||||
* Handle the request of a customer that answered a survey
|
||||
* @param SurveyAnswersRequest $request
|
||||
* @return View View to go to
|
||||
*
|
||||
* @param \App\Http\Requests\SurveyAnswersRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \InvalidArgumentException InvalidArgumentException.
|
||||
*/
|
||||
public function answerSurvey(SurveyAnswersRequest $request)
|
||||
{
|
||||
|
|
@ -436,8 +449,10 @@ class ClubController extends Controller
|
|||
/**
|
||||
* Send a message to a user
|
||||
*
|
||||
* @param SendMessageRequest $request
|
||||
* @param \App\Http\Requests\SendMessageRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
* @throws \Throwable Throwable.
|
||||
*/
|
||||
public function sendMessage(SendMessageRequest $request)
|
||||
{
|
||||
|
|
@ -485,8 +500,11 @@ class ClubController extends Controller
|
|||
/**
|
||||
* Destroy a message
|
||||
*
|
||||
* @param DeleteMessagesRequest $request
|
||||
* @param \App\Http\Requests\DeleteMessagesRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \LogicException LogicException.
|
||||
* @throws \Throwable Throwable.
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function deleteMessage(DeleteMessagesRequest $request)
|
||||
{
|
||||
|
|
@ -520,9 +538,10 @@ class ClubController extends Controller
|
|||
/**
|
||||
* Block a customer to prevent him sending messages
|
||||
*
|
||||
* @param BlockCustomerRequest $request
|
||||
* @param boolean $status
|
||||
* @param \App\Http\Requests\BlockCustomerRequest $request
|
||||
* @param boolean $status
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function blockCustomer(BlockCustomerRequest $request, bool $status)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class ContactController extends Controller
|
|||
|
||||
/**
|
||||
* Propose meal recipe
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -94,9 +94,10 @@ class CustomerController extends Controller
|
|||
/**
|
||||
* setFavoriteRecipe
|
||||
*
|
||||
* @param Recipes $recipe
|
||||
* @param boolean $status
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory
|
||||
* @param \App\Models\Recipes $recipe
|
||||
* @param boolean $status
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function setFavoriteRecipe(Recipes $recipe, bool $status)
|
||||
{
|
||||
|
|
|
|||
99
app/Http/Controllers/Fo/OpInstaController.php
Normal file
99
app/Http/Controllers/Fo/OpInstaController.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Fo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\OpInsta\InstaMedia;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class OpInstaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show OpInsta page
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$this->assertConfigIsValid();
|
||||
$has_started = $this->hasStarted();
|
||||
|
||||
$instaMediaList = InstaMedia::query()->orderBy('id')->get()
|
||||
->map(function (InstaMedia $media) {
|
||||
$path = \explode('/', \rtrim(\parse_url(
|
||||
$media->permalink,
|
||||
\PHP_URL_PATH
|
||||
), '/'));
|
||||
|
||||
$media->pictures = $this->fetchPicture(\collect($path)->last());
|
||||
return $media;
|
||||
});
|
||||
|
||||
return \view('front.opinsta.index', \compact('instaMediaList', 'has_started'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assert config is valid
|
||||
*
|
||||
* @return void
|
||||
* @throws \ErrorException If config is invalid.
|
||||
*/
|
||||
private function assertConfigIsValid(): void
|
||||
{
|
||||
try {
|
||||
$start = config('opinsta.start');
|
||||
$end = config('opinsta.end');
|
||||
|
||||
Validator::validate([
|
||||
'start' => $start,
|
||||
'end' => $end,
|
||||
], [
|
||||
'start' => 'date_format:d-m-Y|before:end',
|
||||
'end' => 'date_format:d-m-Y|after:start',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
$message = \collect($e->errors())->map(function ($el) {
|
||||
return \collect($el)->implode(', ');
|
||||
})->implode(', ');
|
||||
throw new \ErrorException("Op install config is invalid, {$message}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Le jeu a démaré ?
|
||||
*
|
||||
* Démarre à la date de départ (0h00) et s'arrête à la date de fin (23h59)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function hasStarted(): bool
|
||||
{
|
||||
$start = Carbon::createFromFormat('d-m-Y', config('opinsta.start'), 'Europe/Paris')->setTime(0, 0);
|
||||
$end = Carbon::createFromFormat('d-m-Y', config('opinsta.end'), 'Europe/Paris')->setTime(0, 0);
|
||||
$now = Carbon::now('Europe/Paris')->setTime(0, 0);
|
||||
return $now->isBetween($start, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Media Picture Object
|
||||
*
|
||||
* @param string $ig_media_hash
|
||||
* @return array<integer,string[]>
|
||||
*/
|
||||
private function fetchPicture(string $ig_media_hash): array
|
||||
{
|
||||
return Cache::remember(
|
||||
"media_picture_ajax_fetch{$ig_media_hash}",
|
||||
// * 3H cache
|
||||
3 * 60 * 60,
|
||||
function () use ($ig_media_hash) {
|
||||
return InstaMedia::fetchInstagramMediaPictures($ig_media_hash);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,8 +52,11 @@ class HomeController extends Controller
|
|||
|
||||
/**
|
||||
* Call the CRM to add a single optin
|
||||
* @param SingleOptinRequest $request
|
||||
* @return string Message to print to the customer
|
||||
*
|
||||
* @param \App\Http\Requests\SingleOptinRequest $request
|
||||
* @return string|array|null|\Illuminate\Contracts\Translation\Translator
|
||||
* @throws \LDC\LDCCRM\Exceptions\ValidationException ValidationException.
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function addOptIn(SingleOptinRequest $request)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,17 +77,4 @@ class OCBController extends Controller
|
|||
->inRandomOrder()->first();
|
||||
return view('front.ocb.poultry', compact('breeder', 'ocbContents'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show ocb egg content
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function egg()
|
||||
{
|
||||
$ocbContents = OCBContent::where('type', OCBType::egg())
|
||||
->orderBy('order')
|
||||
->where('status', true)->get();
|
||||
return view('front.ocb.egg', compact('ocbContents'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ class EnterCodeController extends Controller
|
|||
/**
|
||||
* Participate Method
|
||||
*
|
||||
* @param ParticipateRequest $request
|
||||
* @param \App\Http\Requests\OpBrCharcut\ParticipateRequest $request
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
public function participate(ParticipateRequest $request)
|
||||
{
|
||||
|
|
@ -32,12 +33,11 @@ class EnterCodeController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Détermine si un BR doit être servi
|
||||
* renvoi la vue de gain BR
|
||||
* Détermine si un BR doit être servi, renvoi la vue de gain BR
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @param mixed $code
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
private function serveCouponWin($code)
|
||||
{
|
||||
|
|
@ -68,7 +68,9 @@ class EnterCodeController extends Controller
|
|||
* Update a coupon
|
||||
*
|
||||
* @param mixed $id_coupon
|
||||
* @return \App\Models\Reduction|null
|
||||
* @param mixed $qtty
|
||||
* @return mixed
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
private function updateCoupon($id_coupon, $qtty)
|
||||
{
|
||||
|
|
@ -107,6 +109,15 @@ class EnterCodeController extends Controller
|
|||
return $reduction;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateCustomer
|
||||
*
|
||||
* @param mixed $hascode
|
||||
* @param mixed $email
|
||||
* @param mixed $country
|
||||
* @return mixed
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException.
|
||||
*/
|
||||
private function updateCustomer($hascode, $email, $country)
|
||||
{
|
||||
/** @var \App\Lib\MesBR */
|
||||
|
|
|
|||
|
|
@ -3,19 +3,38 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class SecureHeaders
|
||||
{
|
||||
// Enumerate headers which you do not want in your application's responses.
|
||||
// Great starting point would be to go check out @Scott_Helme's:
|
||||
// https://securityheaders.com/
|
||||
/**
|
||||
* Enumerate headers which you do not want in your application's responses.
|
||||
* Great starting point would be to go check out @Scott_Helme's:
|
||||
* https://securityheaders.com/
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $unwantedHeaderList = [
|
||||
'X-Powered-By',
|
||||
'Server',
|
||||
];
|
||||
|
||||
public function handle($request, Closure $next)
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
View::share('nonce', $nonce = \uniqid());
|
||||
// * For VueJS dev tool to execute
|
||||
$jsDev = config('app.debug') ? "'unsafe-eval' 'unsafe-inline'" : "'nonce-{$nonce}' 'strict-dynamic'";
|
||||
$reportUri = Route::has('cspReportUri') ?
|
||||
\sprintf('report-uri %s', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
|
||||
$this->removeUnwantedHeaders($this->unwantedHeaderList);
|
||||
$response = $next($request);
|
||||
$response->headers->set('Referrer-Policy', 'no-referrer-when-downgrade');
|
||||
|
|
@ -24,19 +43,48 @@ class SecureHeaders
|
|||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
|
||||
$response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains;');
|
||||
$cspPolicies = [
|
||||
'frame-src ' . implode(" ", [
|
||||
'\'self\'',
|
||||
'https://www.youtube.com',
|
||||
'https://vimeo.com/',
|
||||
'https://player.vimeo.com/',
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://recaptcha.google.com/recaptcha/'
|
||||
]) . ';',
|
||||
"style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://fonts.googleapis.com;",
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com https://www.googletagmanager.com https://www.google-analytics.com https://maps.googleapis.com https://fonts.googleapis.com;"
|
||||
'script-src ' . implode(" ", [
|
||||
'\'self\'',
|
||||
'\'unsafe-inline\'',
|
||||
'\'unsafe-eval\'',
|
||||
'https://cdnjs.cloudflare.com',
|
||||
'https://*.googletagmanager.com',
|
||||
'https://www.google-analytics.com',
|
||||
'https://maps.googleapis.com',
|
||||
'https://fonts.googleapis.com',
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://www.gstatic.com/recaptcha/',
|
||||
'https://yl.s-web.fr',
|
||||
]) . ' ' . $jsDev . ';'
|
||||
];
|
||||
$response->headers->set(
|
||||
'Content-Security-Policy',
|
||||
implode(' ', $cspPolicies)
|
||||
implode(' ', $cspPolicies) . $reportUri
|
||||
);
|
||||
$response->headers->set('Feature-Policy', 'fullscreen \'self\';');
|
||||
$response->headers->set('Feature-Policy', \implode(',', [
|
||||
'fullscreen', 'accelerometer', 'encrypted-media',
|
||||
'gyroscope', 'picture-in-picture'
|
||||
]) . ';');
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function removeUnwantedHeaders($headerList)
|
||||
/**
|
||||
* Remove unwanted headers
|
||||
*
|
||||
* @param array $headerList
|
||||
* @return void
|
||||
*/
|
||||
private function removeUnwantedHeaders(array $headerList)
|
||||
{
|
||||
foreach ($headerList as $header) {
|
||||
header_remove($header);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class BoutiqueBuyRequest extends FormRequest
|
|||
{
|
||||
return [
|
||||
'coords' => trans('vos coordonnées'),
|
||||
'coords.civility' => trans('civilitée dans vos coordonnées'),
|
||||
'coords.civility' => trans('civilité dans vos coordonnées'),
|
||||
'coords.firstname' => trans('prénom dans vos coordonnées'),
|
||||
'coords.lastname' => trans('nom dans vos coordonnées'),
|
||||
'coords.address' => trans('adresse dans vos coordonnées'),
|
||||
|
|
@ -76,7 +76,7 @@ class BoutiqueBuyRequest extends FormRequest
|
|||
'coords.city' => trans('ville dans vos coordonnées'),
|
||||
'coords.email' => trans('e-mail dans vos coordonnées'),
|
||||
'shipping' => trans('votre adresse de livraison'),
|
||||
'shipping.civility' => trans('civilitée dans votre adresse de livraison'),
|
||||
'shipping.civility' => trans('civilité dans votre adresse de livraison'),
|
||||
'shipping.firstname' => trans('prénom dans votre adresse de livraison'),
|
||||
'shipping.lastname' => trans('nom dans votre adresse de livraison'),
|
||||
'shipping.address' => trans('adresse dans votre adresse de livraison'),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Http\Requests;
|
|||
|
||||
use App\Enums\ContactFormCivility;
|
||||
use App\Enums\ContactFormType;
|
||||
use App\Lib\Helpers\ToolboxHelper;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
|
||||
|
||||
|
|
@ -26,6 +27,8 @@ class ContactFormRequest extends FormRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
|
||||
|
||||
if ($this->type == ContactFormType::onepage()->value) {
|
||||
app()->setLocale('nl');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Lib\Helpers\ToolboxHelper;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
|
@ -36,6 +37,8 @@ class CustomerRegisterRequest extends FormRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
|
||||
|
||||
return [
|
||||
'email' => 'required|email:rfc,dns,spoof,filter|max:255|unique:customers,email',
|
||||
'username' => 'required|string|min:1|max:255|unique:customers,username',
|
||||
|
|
@ -78,13 +81,22 @@ class CustomerRegisterRequest extends FormRequest
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'postcode' => 'Code postal'
|
||||
'postcode' => 'Code postal',
|
||||
'username' => 'pseudo'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -17,13 +17,19 @@ class UpdateEngagement extends FormRequest
|
|||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$this->merge([
|
||||
'status' => $this->status === null ? 0 : 1
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'status' => $this->status ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +40,8 @@ class UpdateEngagement extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
$rules = [
|
||||
'title' => 'required|string|min:7'
|
||||
'title' => 'required|string|min:7',
|
||||
'status' => 'required|boolean'
|
||||
];
|
||||
if ($this->engagement->type == EngagementType::header()) {
|
||||
$rules = array_merge($rules, [
|
||||
|
|
@ -129,9 +136,14 @@ class UpdateEngagement extends FormRequest
|
|||
}//end if
|
||||
break;
|
||||
case InputType::url()->value:
|
||||
if ($iptName === "link") {
|
||||
$ruleAtt = "sometimes";
|
||||
} else {
|
||||
$ruleAtt = "required";
|
||||
}
|
||||
$rules = array_merge($rules, [
|
||||
"content.$i.content.$iptName.value" => [
|
||||
'required', 'url',
|
||||
$ruleAtt, 'url',
|
||||
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
function ($attribute, $value, $fail) {
|
||||
try {
|
||||
|
|
@ -172,10 +184,10 @@ class UpdateEngagement extends FormRequest
|
|||
"content.$i.content.$iptName.value" => 'boolean'
|
||||
]);
|
||||
break;
|
||||
}//end switch
|
||||
}//end foreach
|
||||
}//end foreach
|
||||
}//end if
|
||||
} //end switch
|
||||
} //end foreach
|
||||
} //end foreach
|
||||
} //end if
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class SendArchadiaMail implements ShouldQueue
|
|||
|
||||
/**
|
||||
* To be serialized by jobs system
|
||||
*
|
||||
* @var MailContactData
|
||||
* */
|
||||
private $data;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class SendNLMail implements ShouldQueue
|
|||
|
||||
/**
|
||||
* To be serialized by jobs system
|
||||
*
|
||||
* @var MailContactData
|
||||
* */
|
||||
private $data;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class SendOrderToArchadia implements ShouldQueue
|
|||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\Order $order
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class SendPasserelleMail implements ShouldQueue
|
|||
|
||||
/**
|
||||
* To be serialized by jobs system
|
||||
*
|
||||
* @var MailContactData
|
||||
* */
|
||||
private $data;
|
||||
|
|
|
|||
|
|
@ -469,7 +469,6 @@ class XmlIncoReader extends XmlJobs
|
|||
* <TYP_PORTION><![CDATA[Approximatif]]></TYP_PORTION>
|
||||
* extracted as "TYP_PORTION" => "Approximatif"
|
||||
*
|
||||
*
|
||||
* @param \SimpleXMLElement|false $sxe
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -484,15 +483,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);
|
||||
|
|
@ -501,7 +503,7 @@ class XmlIncoReader extends XmlJobs
|
|||
} else {
|
||||
$extract[$key] = strlen($value) ? $value : null;
|
||||
}
|
||||
}
|
||||
}//end foreach
|
||||
return $extract;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ abstract class XmlJobs extends XArcadiaFlux
|
|||
} catch (InvalidXmlException $e) {
|
||||
$message = $e->getMessage();
|
||||
if (get_class($e) === QueryException::class) {
|
||||
/** @var \Illuminate\Database\QueryException $e */
|
||||
$message = implode(' ', $e->errorInfo);
|
||||
}
|
||||
$this->log(
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ class XmlTracaReader extends XmlJobs
|
|||
XmlTraceability::class,
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
function (\SimpleXMLElement $xmlContent, array &$line) {
|
||||
$abatage_date = \explode('-', $line['abatage_date']);
|
||||
// * Inverser année et jours a cause du flux de merde
|
||||
$abatage_date = \explode('.', $line['abatage_date']);
|
||||
// * Inverser année et jours a cause du flux
|
||||
$line['abatage_date'] = \sprintf(
|
||||
'20%s-%s-%s',
|
||||
'20%s/%s/%s',
|
||||
$abatage_date[2],
|
||||
$abatage_date[1],
|
||||
substr($abatage_date[0], 2)
|
||||
$abatage_date[0]
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
65
app/Lib/Helpers/ToolboxHelper.php
Normal file
65
app/Lib/Helpers/ToolboxHelper.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ToolboxHelper
|
||||
{
|
||||
/**
|
||||
* Validate recaptcha
|
||||
*
|
||||
* @param Request $request
|
||||
* @param boolean $isV3
|
||||
* @return void
|
||||
*/
|
||||
public static function validateRecaptcha(Request $request, bool $isV3 = true)
|
||||
{
|
||||
Validator::validate($request->all(), [
|
||||
'g-recaptcha-response' => [
|
||||
'required', 'string',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
function ($attribute, $value, $fail) use ($isV3) {
|
||||
try {
|
||||
$response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [
|
||||
'secret' => config('services.google.recaptcha.private'),
|
||||
'response' => \strval($value),
|
||||
'remoteip' => app('clientIp')
|
||||
]);
|
||||
if ($e = $response->toException()) {
|
||||
throw $e;
|
||||
}
|
||||
if ($isV3) {
|
||||
if (
|
||||
!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
|
||||
!$response->json('score')
|
||||
) {
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
if (\floatval($response->json('score')) < 0.8) {
|
||||
$fail("Vous n'avez pas obtenu un score assez élevé lors de la validation du recaptcha");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST)
|
||||
) {
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$fail('Erreur lors de la validation du formulaire veuillez réssayer');
|
||||
} //end try
|
||||
}
|
||||
]
|
||||
], [], ['g-recaptcha-response' => 'reCaptcha']);
|
||||
}
|
||||
}
|
||||
91
app/Lib/Instagram/ApiFetcher.php
Normal file
91
app/Lib/Instagram/ApiFetcher.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Instagram;
|
||||
|
||||
use App\Exceptions\InstaApiLimitReachedException as InstaApiException;
|
||||
use Illuminate\Http\Client\HttpClientException;
|
||||
use Illuminate\Http\Client\Response;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Fetch Instagram Top Media List
|
||||
*
|
||||
* @package App\Lib
|
||||
*/
|
||||
class ApiFetcher
|
||||
{
|
||||
/**
|
||||
* Try to fetch media pictures from a permalink using og data.
|
||||
*
|
||||
* @param string $url
|
||||
* @return array
|
||||
* @throws \RuntimeException If a call error or a response parsing error occurs.
|
||||
*/
|
||||
public function fetchMediaPicturesFromPostPermalink(string $url): array
|
||||
{
|
||||
try {
|
||||
$response = $this->httpCall('GET', $url);
|
||||
$html = $response->body();
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadHTML($html);
|
||||
|
||||
$scripts = $dom->getElementsByTagName('script');
|
||||
return collect($scripts)->filter()->map(function (\DOMElement $script) {
|
||||
if ($script->getAttribute('type') != 'application/ld+json') {
|
||||
return null;
|
||||
}
|
||||
$entity = json_decode($script->nodeValue, true);
|
||||
if ($entity['@type'] !== 'SocialMediaPosting') {
|
||||
return null;
|
||||
}
|
||||
return \collect($entity['image'])->map(function (array $picture) {
|
||||
return $picture['url'];
|
||||
})->all();
|
||||
})->filter(function ($el) {
|
||||
return !empty($el);
|
||||
})->first() ?? [];
|
||||
} catch (\Exception $e) {
|
||||
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
|
||||
} //end try
|
||||
}
|
||||
|
||||
/**
|
||||
* Call url and fetch result in array.
|
||||
*
|
||||
* @param string $method The HTTP VERB to use (GET, POST).
|
||||
* @param string|\Psr\Http\Message\UriInterface $uri The uri to call.
|
||||
* @param array $parameters The call parameters to pass on.
|
||||
* @return \Illuminate\Http\Client\Response
|
||||
* @throws \Error If the request method is not supported.
|
||||
* @throws \RuntimeException If something goes wrong.
|
||||
* @throws \App\Exceptions\InstaApiException If the api denies access for some reason.
|
||||
*/
|
||||
private function httpCall(
|
||||
string $method,
|
||||
$uri = '',
|
||||
array $parameters = []
|
||||
): Response {
|
||||
try {
|
||||
if (!\in_array(\strtoupper($method), ['GET', 'POST'])) {
|
||||
throw new \Error("Unsupported method {$method}");
|
||||
}
|
||||
/** @var \Illuminate\Http\Client\Response */
|
||||
$response = Http::timeout(\config('app.debug') ? 3 : 30)
|
||||
->retry(2, 100)
|
||||
->{strtolower($method)}($uri, $parameters);
|
||||
// * Throw an exception if an error occured.
|
||||
$response->throw();
|
||||
|
||||
return $response;
|
||||
} catch (HttpClientException $e) {
|
||||
/** @var \Illuminate\Http\Client\Response $response */
|
||||
if ($e instanceof \Illuminate\Http\Client\RequestException and $e->getCode() === 403) {
|
||||
$response = $e->response;
|
||||
$message = $response->json('error.message');
|
||||
$code = $response->json('error.code');
|
||||
throw new InstaApiException($message, $code, $e);
|
||||
}
|
||||
throw new \RuntimeException($e);
|
||||
} //end try
|
||||
}
|
||||
}
|
||||
50
app/Lib/Instagram/Objects/TopMedia.php
Normal file
50
app/Lib/Instagram/Objects/TopMedia.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\Instagram\Objects;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Top Media object
|
||||
*
|
||||
* @property integer $insta_id A unique instagram id that can be used for api calls.
|
||||
* @property string $type The instagram object type, commonly IMAGE or CAROUSEL_ALBUM.
|
||||
* @property string $username The instagram user name, scrapped using OG description.
|
||||
* @property string $caption The object text content.
|
||||
* @property string $permalink The uri where is stored the Instagram object.
|
||||
* @property \Carbon\Carbon $timestamp UTC timestamp from instagram api.
|
||||
* @property integer $comments_count The number of comments.
|
||||
* @property null|integer $like_count The number of likes.
|
||||
*
|
||||
* @package App\Lib\Instagram\Objects
|
||||
*/
|
||||
class TopMedia extends \stdClass
|
||||
{
|
||||
/**
|
||||
* Set this object data from Ig api data
|
||||
*
|
||||
* @param object $ig_media
|
||||
* @return void
|
||||
*/
|
||||
public function setData(object $ig_media): void
|
||||
{
|
||||
$this->insta_id = \intval($ig_media->id);
|
||||
$this->type = $ig_media->media_type;
|
||||
$this->permalink = $ig_media->permalink;
|
||||
$this->timestamp = Carbon::parse($ig_media->timestamp);
|
||||
$this->comments_count = \intval($ig_media->comments_count);
|
||||
$this->like_count = \optional($ig_media)->like_count ? \intval($ig_media->like_count) : null;
|
||||
$this->caption = $ig_media->caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this object username
|
||||
*
|
||||
* @param string $username
|
||||
* @return void
|
||||
*/
|
||||
public function setUserName(string $username): void
|
||||
{
|
||||
$this->username = $username;
|
||||
}
|
||||
}
|
||||
|
|
@ -558,6 +558,7 @@ class Mercanet
|
|||
|
||||
/**
|
||||
* Filter http request parameters
|
||||
*
|
||||
* @param array $requestParameters
|
||||
*/
|
||||
private function filterRequestParameters(array $httpRequest)
|
||||
|
|
@ -595,6 +596,7 @@ class Mercanet
|
|||
|
||||
/**
|
||||
* Checks if the response is valid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid()
|
||||
|
|
@ -658,6 +660,7 @@ class Mercanet
|
|||
|
||||
/**
|
||||
* Retrieves a response parameter
|
||||
*
|
||||
* @param string $param
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Lib;
|
|||
class MesBR
|
||||
{
|
||||
private $endpoint;
|
||||
|
||||
private $refCamp;
|
||||
|
||||
public function __construct($endpoint, $refCamp)
|
||||
|
|
|
|||
|
|
@ -9,20 +9,23 @@ namespace App\Lib;
|
|||
class MesBROld
|
||||
{
|
||||
private $endpoint;
|
||||
|
||||
private $refSite;
|
||||
|
||||
private $refCamp;
|
||||
|
||||
public function __construct($endpoint, $refSite, $refCamp)
|
||||
{
|
||||
$this->endpoint = $endpoint;
|
||||
$this->refSite = $refSite;
|
||||
$this->refCamp = $refCamp;
|
||||
$this->refSite = $refSite;
|
||||
$this->refCamp = $refCamp;
|
||||
}
|
||||
|
||||
/** Update contact *
|
||||
* NOT USED - SHOULD BE DELETED
|
||||
*
|
||||
* @param $oCrmUser
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateContact($oCrmUser)
|
||||
{
|
||||
|
|
@ -46,9 +49,10 @@ class MesBROld
|
|||
}
|
||||
|
||||
/** Update panier *
|
||||
*
|
||||
* @param $oCrmUser
|
||||
* @param $couponId
|
||||
* @param int $quantity
|
||||
* @param integer $quantity
|
||||
* @return array
|
||||
*/
|
||||
public function updatePanier($oCrmUser, $refid, $couponId, $quantity = 1)
|
||||
|
|
@ -56,7 +60,7 @@ class MesBROld
|
|||
$datas = [
|
||||
'refsite' => $this->refSite,
|
||||
'refcamp' => $this->refCamp,
|
||||
//TODO : ici il faut une id qui est ajoutée au code barre du coupon donc un hascode c'est trop long
|
||||
// TODO : ici il faut une id qui est ajoutée au code barre du coupon donc un hascode c'est trop long
|
||||
'refadherent' => $refid,
|
||||
'nom' => $oCrmUser->lastname,
|
||||
'prenom' => $oCrmUser->firstname,
|
||||
|
|
@ -66,7 +70,7 @@ class MesBROld
|
|||
'pays' => $this->getCountry($oCrmUser->country),
|
||||
'panier' => "($quantity)$couponId"
|
||||
];
|
||||
$res = $this->callAPI("GET", "/updatebasket", $datas);
|
||||
$res = $this->callAPI("GET", "/updatebasket", $datas);
|
||||
if (!$res) {
|
||||
error_log("MESBR - CODE : 999 - MESSAGE : Cannot read API Response (non json)");
|
||||
return ['status' => 'KO', 'code' => 999, 'message' => 'Cannot read API Response (non json)'];
|
||||
|
|
@ -76,7 +80,7 @@ class MesBROld
|
|||
return ['status' => 'KO', 'code' => $res->Code, 'message' => $res->Message];
|
||||
}
|
||||
$panierVerification = $this->endpoint . '/showbasket?basketid=' . $res->Panier->Panier;
|
||||
$panier_link = $this->endpoint . '/?basketid=' . $res->Panier->Panier;
|
||||
$panier_link = $this->endpoint . '/?basketid=' . $res->Panier->Panier;
|
||||
return ['status' => 'OK', 'link' => $panier_link, 'verif' => $panierVerification, 'basketId' => $res->Panier->Panier];
|
||||
}
|
||||
/** Génère le lien vers le mur (ou panier préprogrammé) **/
|
||||
|
|
@ -94,7 +98,8 @@ class MesBROld
|
|||
return 442;
|
||||
break;
|
||||
default:
|
||||
return 250; //France
|
||||
return 250;
|
||||
// France
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,20 +109,23 @@ class MesBROld
|
|||
switch ($method) {
|
||||
case "POST":
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
if ($data)
|
||||
if ($data) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
break;
|
||||
case "PUT":
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
if ($data)
|
||||
if ($data) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($data)
|
||||
if ($data) {
|
||||
$url = sprintf("%s?%s", $url, http_build_query($data));
|
||||
}
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_URL, $this->endpoint . $url);
|
||||
curl_setopt($curl, CURLOPT_COOKIESESSION, TRUE);
|
||||
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
$result = curl_exec($curl);
|
||||
if (!$result) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class Utils
|
|||
* Replace stange accents
|
||||
*
|
||||
* https://stackoverflow.com/questions/3371697/replacing-accented-characters-php
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@jeremydev.ovh>
|
||||
* @param string $subject
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class Order extends Mailable
|
|||
protected function makePdfFile(): string
|
||||
{
|
||||
/** @var \Meneses\LaravelMpdf\LaravelMpdfWrapper */
|
||||
$mpdf = app('mpdf.wrapper');
|
||||
$mpdf = app('laravel-mpdf');
|
||||
/** @var \Meneses\LaravelMpdf\LaravelMpdf */
|
||||
$pdf = $mpdf->loadView(
|
||||
'documents.order',
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ class ReductionWon extends Mailable implements ShouldQueue
|
|||
*/
|
||||
public function __construct($user, $linkpanier)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->linkpanier = $linkpanier;
|
||||
$this->user = $user;
|
||||
$this->linkpanier = $linkpanier;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ class Contact extends Model
|
|||
|
||||
/**
|
||||
* Get Counter skeleton
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function counterSkeleton(): array
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Models;
|
|||
|
||||
use App\Enums\DepartaimantCollectionType;
|
||||
use App\Http\Resources\CustomerCrmResource;
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
|
|
|||
|
|
@ -34,22 +34,52 @@ class DepartaimantsCollection extends Model
|
|||
protected $table = 'departaimants';
|
||||
|
||||
private static $columnTableNamePrefix = 'col';
|
||||
// Le prefix d'un table departaimant
|
||||
|
||||
/**
|
||||
* Le prefix d'un table departaimant
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private static $tableFields = 4;
|
||||
// Le nombre de colonnes des departaimants
|
||||
|
||||
/**
|
||||
* Le nombre de colonnes des departaimants
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private static $departementWidth = 2;
|
||||
// La largeur en bits d'un départaimant
|
||||
|
||||
/**
|
||||
* La largeur en bits d'un départaimant
|
||||
* * to be set in construct
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $attributes = [
|
||||
'type' => 'current'
|
||||
// to be set in construct
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $fillable = [
|
||||
'collection'
|
||||
];
|
||||
|
||||
/**
|
||||
* Handle dynamic static method calls into the model.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
|
||||
* @phpcs:disable Squiz.Commenting.FunctionComment.ScalarTypeHintMissing
|
||||
*/
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($name === 'defaultType') {
|
||||
return DepartaimantCollectionType::current();
|
||||
}
|
||||
|
|
@ -59,8 +89,8 @@ class DepartaimantsCollection extends Model
|
|||
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @throws TypeError
|
||||
* @throws BadMethodCallException
|
||||
* @throws \TypeError
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,16 +11,25 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Illuminate\Support\Str;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
|
||||
// old Breeders
|
||||
class OCBBreeder extends BreederForGmap
|
||||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'display' => 'boolean',
|
||||
'inuavs' => 'array'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to Enums.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'presentation_type' => PresentationType::class,
|
||||
'ocbStatus' => EleveurOcbStatus::class,
|
||||
|
|
@ -28,8 +37,18 @@ class OCBBreeder extends BreederForGmap
|
|||
'geo_type' => GeoType::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ocb_breeders';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'breeder_code',
|
||||
'first_name',
|
||||
|
|
@ -51,6 +70,11 @@ class OCBBreeder extends BreederForGmap
|
|||
'inuavs',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($breeder) {
|
||||
|
|
@ -96,11 +120,18 @@ class OCBBreeder extends BreederForGmap
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route key for the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return "slug";
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
* Get ocb validated breeders query
|
||||
*
|
||||
|
|
@ -111,28 +142,55 @@ class OCBBreeder extends BreederForGmap
|
|||
return static::where('ocbStatus', EleveurOcbStatus::yes());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter picture attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPictureAttribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture');
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter picture_1 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture1Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture1');
|
||||
}
|
||||
/**
|
||||
* Getter picture_2 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture2Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture2');
|
||||
}
|
||||
/**
|
||||
* Getter picture_3 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture3Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture3');
|
||||
}
|
||||
|
||||
/**
|
||||
* Refactored picture attribute
|
||||
*
|
||||
* @param string $prop
|
||||
* @return mixed
|
||||
*/
|
||||
private function pictureAttribute(string $prop)
|
||||
{
|
||||
$p = $this->attributes[$prop];
|
||||
// For migrated urls from 2016
|
||||
// For migrated urls from 2016.
|
||||
if (
|
||||
is_null($p) or
|
||||
!strlen($p) or
|
||||
|
|
|
|||
|
|
@ -10,12 +10,27 @@ class OCBContent extends Model
|
|||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to Enums.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'type' => OCBType::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ocb_content';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'picture',
|
||||
'content',
|
||||
|
|
@ -24,6 +39,11 @@ class OCBContent extends Model
|
|||
'status'
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($ocbContent) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Kwaadpepper\Serial\Exceptions\SerialCasterException;
|
|||
class Code extends Model
|
||||
{
|
||||
protected $table = 'opbrcharcut_codes';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
|
@ -29,7 +30,6 @@ class Code extends Model
|
|||
public $timestamps = false;
|
||||
|
||||
// * RELATIONS
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customers::class);
|
||||
|
|
@ -83,7 +83,7 @@ class Code extends Model
|
|||
);
|
||||
} catch (SerialCasterException $e) {
|
||||
Log::error($e->getMessage() . " code utilisé : " . $serial);
|
||||
//return 0 invalid value for code
|
||||
// return 0 invalid value for code
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
class CodeEan extends Model
|
||||
{
|
||||
protected $table = 'opbrcharcut_codes_eans';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
|
|
|||
91
app/Models/OpInsta/InstaMedia.php
Normal file
91
app/Models/OpInsta/InstaMedia.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\OpInsta;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\AsStringable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @mixin \App\Lib\Instagram\Objects\TopMedia
|
||||
*
|
||||
* @package App\Models\OpInsta
|
||||
*/
|
||||
class InstaMedia extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'opinsta';
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $casts = [
|
||||
'caption' => AsStringable::class,
|
||||
'permalink' => AsStringable::class,
|
||||
'timestamp' => 'immutable_datetime'
|
||||
];
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
* Fetch Media picture using ig media hash
|
||||
*
|
||||
* @param string $ig_media_hash
|
||||
* @return array
|
||||
* @throws \RuntimeException If a call error or a response parsing error occurs.
|
||||
*/
|
||||
public static function fetchInstagramMediaPictures(string $ig_media_hash): array
|
||||
{
|
||||
/** @var \App\Lib\Instagram\ApiFetcher */
|
||||
$igFetcherClient = \app('Instagram');
|
||||
return $igFetcherClient->fetchMediaPicturesFromPostPermalink("https://www.instagram.com/p/{$ig_media_hash}/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and check config elements
|
||||
*
|
||||
* @return array 'hashtag_id', 'user_id', 'media_count', 'fields'
|
||||
* @throws \RuntimeException If config is not valid.
|
||||
*/
|
||||
private static function fetchConfigParameters(): array
|
||||
{
|
||||
$hashtag_id = config('services.facebook.enpoints.ig_top_media.hashtag_id');
|
||||
$user_id = config('services.facebook.enpoints.ig_top_media.user_id');
|
||||
$media_count = config('services.facebook.enpoints.ig_top_media.media_count');
|
||||
|
||||
if (empty($hashtag_id)) {
|
||||
throw new \RuntimeException(
|
||||
'Missing services.facebook.enpoints.ig_top_media.hashtag_id,
|
||||
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_HASHTAGID'
|
||||
);
|
||||
}
|
||||
if (empty($user_id)) {
|
||||
throw new \RuntimeException(
|
||||
'Missing services.facebook.enpoints.ig_top_media.user_id,
|
||||
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_USERID'
|
||||
);
|
||||
}
|
||||
if (empty($media_count)) {
|
||||
throw new \RuntimeException(
|
||||
'Missing services.facebook.enpoints.ig_top_media.media_count,
|
||||
FACEBOOK_GRAPH_ENDPOINT_IG_TOPMEDIA_NBMEDIA'
|
||||
);
|
||||
}
|
||||
$hashtag_id = \intval($hashtag_id);
|
||||
$user_id = \intval($user_id);
|
||||
$media_count = \intval($media_count);
|
||||
return \compact(
|
||||
'hashtag_id',
|
||||
'user_id',
|
||||
'media_count'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ class Recipes extends Model
|
|||
|
||||
/**
|
||||
* Get Associated Recipes
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection<Recipes>
|
||||
*/
|
||||
public function associatedRecipes()
|
||||
|
|
@ -137,6 +138,7 @@ class Recipes extends Model
|
|||
|
||||
/**
|
||||
* Check if recipe has been rated by the user (in session also if not Auth)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasBeenRatedByUser()
|
||||
|
|
@ -152,6 +154,7 @@ class Recipes extends Model
|
|||
|
||||
/**
|
||||
* Check if recipe has been rated by the user (in session also if not Auth)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUserRating()
|
||||
|
|
@ -167,6 +170,7 @@ class Recipes extends Model
|
|||
|
||||
/**
|
||||
* Set the recipes rating and memorize in session, or user
|
||||
*
|
||||
* @param string $rating
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Lib\Instagram\ApiFetcher;
|
||||
use App\Models\Actu;
|
||||
use App\Models\Articles;
|
||||
use App\Models\GeneralConfig;
|
||||
|
|
@ -82,6 +83,11 @@ class AppServiceProvider extends ServiceProvider
|
|||
Log::critical($e->getMessage());
|
||||
View::share('GeneralConfigGlobal', []);
|
||||
}
|
||||
|
||||
// * Instagram Singleton
|
||||
App::singleton('Instagram', function () {
|
||||
return new ApiFetcher();
|
||||
});
|
||||
}//end if
|
||||
|
||||
Blade::directive('svg', function ($arguments) {
|
||||
|
|
|
|||
|
|
@ -207,7 +207,10 @@ class RouteServiceProvider extends ServiceProvider
|
|||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
->group(base_path('routes/web-bo.php'));
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web-fo.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ trait GoogleMapSerialize
|
|||
case OCBType::poultry()->value:
|
||||
$ocbType = trans('Éleveur de volaille');
|
||||
break;
|
||||
case OCBType::egg()->value:
|
||||
$ocbType = trans('Producteur d\'oeufs');
|
||||
break;
|
||||
case OCBType::rabbit()->value:
|
||||
$ocbType = trans('Éleveur de lapins');
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,10 @@
|
|||
"fideloper/proxy": "^4.2",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"htmlmin/htmlmin": "^8.0",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/image-resizer": "^0.1.0",
|
||||
"kwaadpepper/refresh-sitemap": "^1.0",
|
||||
"kwaadpepper/serial-int-caster": "^1.0",
|
||||
"kwaadpepper/refresh-sitemap": "1.0.0",
|
||||
"kwaadpepper/serial-int-caster": "1.0.1",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "^3.0",
|
||||
|
|
@ -47,9 +46,9 @@
|
|||
"slevomat/coding-standard": "^7.0"
|
||||
},
|
||||
"repositories": {
|
||||
"gitlab.com/16669037": {
|
||||
"lab.s-web.fr/23": {
|
||||
"type": "composer",
|
||||
"url": "https://gitlab.com/api/v4/group/16669037/-/packages/composer/packages.json"
|
||||
"url": "https://lab.s-web.fr/api/v4/group/23/-/packages/composer/packages.json"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
|
@ -57,8 +56,12 @@
|
|||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"php-http/discovery": true
|
||||
},
|
||||
"gitlab-domains": [
|
||||
"lab.s-web.fr"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
|
|
|
|||
990
composer.lock
generated
990
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -148,6 +148,7 @@ return [
|
|||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
|
|
@ -174,11 +175,11 @@ return [
|
|||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
HTMLMin\HTMLMin\HTMLMinServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,26 @@ return [
|
|||
]) : [],
|
||||
],
|
||||
|
||||
'opinsta' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL_OPINSTA'),
|
||||
'host' => env('DB_HOST_OPINSTA', '127.0.0.1'),
|
||||
'port' => env('DB_PORT_OPINSTA', '3306'),
|
||||
'database' => env('DB_DATABASE_OPINSTA', 'forge'),
|
||||
'username' => env('DB_USERNAME_OPINSTA', 'forge'),
|
||||
'password' => env('DB_PASSWORD_OPINSTA', ''),
|
||||
'unix_socket' => env('DB_SOCKET_OPINSTA', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA_2016'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Laravel HTMLMin.
|
||||
*
|
||||
* (c) Graham Campbell <graham@alt-three.com>
|
||||
* (c) Raza Mehdi <srmk@outlook.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Automatic Blade Optimizations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option enables minification of the blade views as they are
|
||||
| compiled. These optimizations have little impact on php processing time
|
||||
| as the optimizations are only applied once and are cached. This package
|
||||
| will do nothing by default to allow it to be used without minifying
|
||||
| pages automatically.
|
||||
|
|
||||
| Default: false
|
||||
|
|
||||
*/
|
||||
|
||||
'blade' => env('APP_DEBUG') ? false : 'html',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force Blade Optimizations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option forces blade minification on views where there such
|
||||
| minification may be dangerous. This should only be used if you are fully
|
||||
| aware of the potential issues this may cause. Obviously, this setting is
|
||||
| dependent on blade minification actually being enabled.
|
||||
|
|
||||
| PLEASE USE WITH CAUTION
|
||||
|
|
||||
| Default: false
|
||||
|
|
||||
*/
|
||||
|
||||
'force' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignore Blade Files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can specify paths, which you don't want to minify.
|
||||
|
|
||||
*/
|
||||
|
||||
'ignore' => [
|
||||
'resources/views/emails',
|
||||
'resources/views/html',
|
||||
'resources/views/notifications',
|
||||
'resources/views/markdown',
|
||||
'resources/views/vendor/emails',
|
||||
'resources/views/vendor/html',
|
||||
'resources/views/vendor/notifications',
|
||||
'resources/views/vendor/markdown',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -11,7 +11,7 @@ return [
|
|||
'paginate' => env('CODE_PAGINATE', 65530),
|
||||
|
||||
// Dictionnary of chars to use fo generating unique codes.
|
||||
'codeCharList' => 'ABCDEFGHJKMNPQRSTUWXYZ123456789',
|
||||
'codeCharList' => 'ABCDEFGHJKMNPRSTUWXYZ123456789',
|
||||
// Code length.
|
||||
'codeLength' => 9
|
||||
];
|
||||
|
|
|
|||
6
config/opinsta.php
Normal file
6
config/opinsta.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'start' => env('OPINSTA_START'),
|
||||
'end' => env('OPINSTA_END')
|
||||
];
|
||||
|
|
@ -38,7 +38,8 @@ return [
|
|||
'publishedProduct' => [Products::class, 'slug']
|
||||
],
|
||||
'products.range' => [
|
||||
'slugRange' => [Range::class, 'slug']
|
||||
'slugRange' => [Range::class, 'slug'],
|
||||
'slugSubRange' => [Range::class, 'slug'],
|
||||
],
|
||||
'products.consumption-times' => [
|
||||
'slugConsumptionTime' => [ConsumptionTimes::class, 'slug']
|
||||
|
|
@ -85,7 +86,7 @@ return [
|
|||
*/
|
||||
'queryConditions' => [
|
||||
'status' => true,
|
||||
'ocbStatus' => EleveurOcbStatus::yes()->value,
|
||||
'ocbStatus' => strval(EleveurOcbStatus::yes()->value),
|
||||
'star_moment' => true
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -30,4 +30,16 @@ return [
|
|||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'google' => [
|
||||
'recaptcha' => [
|
||||
'public' => env('GOOGLE_RECAPTCHA_PUBLIC'),
|
||||
'private' => env('GOOGLE_RECAPTCHA_PRIVATE'),
|
||||
'version' => env('GOOGLE_RECAPTCHA_VERSION', "3") === "3" ? true : false
|
||||
]
|
||||
],
|
||||
|
||||
'matomo' => [
|
||||
'site_id' => env('MATOMO_SITE_ID')
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -269,8 +269,6 @@ class MigrateOldDataBase extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
@ -408,8 +406,6 @@ class MigrateOldDataBase extends LeGaulois2016Migration
|
|||
return OCBType::poultry();
|
||||
case 'LAPIN':
|
||||
return OCBType::rabbit();
|
||||
case 'OEUF':
|
||||
return OCBType::egg();
|
||||
}
|
||||
},
|
||||
'name' => 'ocb_type',
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ class RemigrateOcbBreeders extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ class RemigrateOcbBreeders2 extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
|
|||
30
database/migrations/2023_06_26_152754_remove_ocb_egg.php
Normal file
30
database/migrations/2023_06_26_152754_remove_ocb_egg.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use App\Models\OCBBreeder;
|
||||
use App\Models\OCBContent;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveOcbEgg extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// * 0 OCB type EGG.
|
||||
OCBContent::query()->where('type', 0)->delete();
|
||||
OCBBreeder::query()->where('ocbType', 0)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
// * Wont undo this.
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue