Merge branch 'trunk'
This commit is contained in:
commit
9c52c0fc22
472 changed files with 19775 additions and 8721 deletions
21
.env.example
21
.env.example
|
|
@ -22,12 +22,6 @@ QUEUE_CONNECTION=sync
|
|||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
|
|
@ -37,16 +31,5 @@ MAIL_ENCRYPTION=null
|
|||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
MAIL_LIST_SERVICEWEB=
|
||||
MAIL_LIST_CONTACTFORM=
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
|||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
|
|
|
|||
83
README.md
83
README.md
|
|
@ -1,65 +1,20 @@
|
|||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
|
||||
# DOUX
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[CMS Max](https://www.cmsmax.com/)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
## Installation
|
||||
```
|
||||
php artisan storage:link
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
composer install
|
||||
php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"
|
||||
```
|
||||
- Créez la base de données
|
||||
- Éditez le .env
|
||||
```
|
||||
php artisan migrate --seed
|
||||
```
|
||||
Pour le front :
|
||||
```
|
||||
npm install
|
||||
npm run prod
|
||||
```
|
||||
58
app/Console/Commands/AdminCreate.php
Normal file
58
app/Console/Commands/AdminCreate.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\User;
|
||||
|
||||
class AdminCreate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'admin:create';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create Admin User';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$role = 0;
|
||||
$name = $this->ask('Name ?');
|
||||
$email = $this->ask('Email ?');
|
||||
$password = $this->secret('What is the password?');
|
||||
|
||||
$user = new User([
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'role' => $role,
|
||||
'password' => Hash::make($password)
|
||||
]);
|
||||
$user->saveOrFail();
|
||||
|
||||
$this->info('Admin created.');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
784
app/Enums/Country.php
Normal file
784
app/Enums/Country.php
Normal file
|
|
@ -0,0 +1,784 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnum;
|
||||
|
||||
/**
|
||||
* Liste de Pays
|
||||
* @source https://datahub.io/core/country-list Data Hub country list
|
||||
* @method static self afghanistan()
|
||||
* @method static self alandIslands()
|
||||
* @method static self albania()
|
||||
* @method static self algeria()
|
||||
* @method static self americanSamoa()
|
||||
* @method static self andorra()
|
||||
* @method static self angola()
|
||||
* @method static self anguilla()
|
||||
* @method static self antarctica()
|
||||
* @method static self antiguaAndBarbuda()
|
||||
* @method static self argentina()
|
||||
* @method static self armenia()
|
||||
* @method static self aruba()
|
||||
* @method static self australia()
|
||||
* @method static self austria()
|
||||
* @method static self azerbaijan()
|
||||
* @method static self bahrain()
|
||||
* @method static self bahamas()
|
||||
* @method static self bangladesh()
|
||||
* @method static self barbados()
|
||||
* @method static self belarus()
|
||||
* @method static self belgium()
|
||||
* @method static self belize()
|
||||
* @method static self benin()
|
||||
* @method static self bermuda()
|
||||
* @method static self bhutan()
|
||||
* @method static self boliviaPlurinationalStateOf()
|
||||
* @method static self bonaireSintEustatiusAndSaba()
|
||||
* @method static self bosniaAndHerzegovina()
|
||||
* @method static self botswana()
|
||||
* @method static self bouvetIsland()
|
||||
* @method static self brazil()
|
||||
* @method static self britishIndianOceanTerritory()
|
||||
* @method static self bruneiDarussalam()
|
||||
* @method static self bulgaria()
|
||||
* @method static self burkinaFaso()
|
||||
* @method static self burundi()
|
||||
* @method static self cambodia()
|
||||
* @method static self cameroon()
|
||||
* @method static self canada()
|
||||
* @method static self capeVerde()
|
||||
* @method static self caymanIslands()
|
||||
* @method static self centralAfricanRepublic()
|
||||
* @method static self chad()
|
||||
* @method static self chile()
|
||||
* @method static self china()
|
||||
* @method static self christmasIsland()
|
||||
* @method static self cocosKeelingIslands()
|
||||
* @method static self colombia()
|
||||
* @method static self comoros()
|
||||
* @method static self congo()
|
||||
* @method static self congoTheDemocraticRepublicOfThe()
|
||||
* @method static self cookIslands()
|
||||
* @method static self costaRica()
|
||||
* @method static self coteDivoire()
|
||||
* @method static self croatia()
|
||||
* @method static self cuba()
|
||||
* @method static self curacao()
|
||||
* @method static self cyprus()
|
||||
* @method static self czechRepublic()
|
||||
* @method static self denmark()
|
||||
* @method static self djibouti()
|
||||
* @method static self dominica()
|
||||
* @method static self dominicanRepublic()
|
||||
* @method static self ecuador()
|
||||
* @method static self egypt()
|
||||
* @method static self elSalvador()
|
||||
* @method static self equatorialGuinea()
|
||||
* @method static self eritrea()
|
||||
* @method static self estonia()
|
||||
* @method static self ethiopia()
|
||||
* @method static self falklandIslandsMalvinas()
|
||||
* @method static self faroeIslands()
|
||||
* @method static self fiji()
|
||||
* @method static self finland()
|
||||
* @method static self france()
|
||||
* @method static self frenchGuiana()
|
||||
* @method static self frenchPolynesia()
|
||||
* @method static self frenchSouthernTerritories()
|
||||
* @method static self gabon()
|
||||
* @method static self gambia()
|
||||
* @method static self georgia()
|
||||
* @method static self germany()
|
||||
* @method static self ghana()
|
||||
* @method static self gibraltar()
|
||||
* @method static self greece()
|
||||
* @method static self greenland()
|
||||
* @method static self grenada()
|
||||
* @method static self guadeloupe()
|
||||
* @method static self guam()
|
||||
* @method static self guatemala()
|
||||
* @method static self guernsey()
|
||||
* @method static self guinea()
|
||||
* @method static self guineaBissau()
|
||||
* @method static self guyana()
|
||||
* @method static self haiti()
|
||||
* @method static self heardIslandAndMcdonaldIslands()
|
||||
* @method static self holySeeVaticanCityState()
|
||||
* @method static self honduras()
|
||||
* @method static self hongKong()
|
||||
* @method static self hungary()
|
||||
* @method static self iceland()
|
||||
* @method static self india()
|
||||
* @method static self indonesia()
|
||||
* @method static self iranIslamicRepublicOf()
|
||||
* @method static self iraq()
|
||||
* @method static self ireland()
|
||||
* @method static self isleOfMan()
|
||||
* @method static self israel()
|
||||
* @method static self italy()
|
||||
* @method static self jamaica()
|
||||
* @method static self japan()
|
||||
* @method static self jersey()
|
||||
* @method static self jordan()
|
||||
* @method static self kazakhstan()
|
||||
* @method static self kenya()
|
||||
* @method static self kiribati()
|
||||
* @method static self koreaDemocraticPeoplesRepublicOf()
|
||||
* @method static self koreaRepublicOf()
|
||||
* @method static self kuwait()
|
||||
* @method static self kyrgyzstan()
|
||||
* @method static self laoPeoplesDemocraticRepublic()
|
||||
* @method static self latvia()
|
||||
* @method static self lebanon()
|
||||
* @method static self lesotho()
|
||||
* @method static self liberia()
|
||||
* @method static self libya()
|
||||
* @method static self liechtenstein()
|
||||
* @method static self lithuania()
|
||||
* @method static self luxembourg()
|
||||
* @method static self macao()
|
||||
* @method static self macedoniaTheFormerYugoslavRepublicOf()
|
||||
* @method static self madagascar()
|
||||
* @method static self malawi()
|
||||
* @method static self malaysia()
|
||||
* @method static self maldives()
|
||||
* @method static self mali()
|
||||
* @method static self malta()
|
||||
* @method static self marshallIslands()
|
||||
* @method static self martinique()
|
||||
* @method static self mauritania()
|
||||
* @method static self mauritius()
|
||||
* @method static self mayotte()
|
||||
* @method static self mexico()
|
||||
* @method static self micronesiaFederatedStatesOf()
|
||||
* @method static self moldovaRepublicOf()
|
||||
* @method static self monaco()
|
||||
* @method static self mongolia()
|
||||
* @method static self montenegro()
|
||||
* @method static self montserrat()
|
||||
* @method static self morocco()
|
||||
* @method static self mozambique()
|
||||
* @method static self myanmar()
|
||||
* @method static self namibia()
|
||||
* @method static self nauru()
|
||||
* @method static self nepal()
|
||||
* @method static self netherlands()
|
||||
* @method static self newCaledonia()
|
||||
* @method static self newZealand()
|
||||
* @method static self nicaragua()
|
||||
* @method static self niger()
|
||||
* @method static self nigeria()
|
||||
* @method static self niue()
|
||||
* @method static self norfolkIsland()
|
||||
* @method static self northernMarianaIslands()
|
||||
* @method static self norway()
|
||||
* @method static self oman()
|
||||
* @method static self pakistan()
|
||||
* @method static self palau()
|
||||
* @method static self palestineStateOf()
|
||||
* @method static self panama()
|
||||
* @method static self papuaNewGuinea()
|
||||
* @method static self paraguay()
|
||||
* @method static self peru()
|
||||
* @method static self philippines()
|
||||
* @method static self pitcairn()
|
||||
* @method static self poland()
|
||||
* @method static self portugal()
|
||||
* @method static self puertoRico()
|
||||
* @method static self qatar()
|
||||
* @method static self reunion()
|
||||
* @method static self romania()
|
||||
* @method static self russianFederation()
|
||||
* @method static self rwanda()
|
||||
* @method static self saintBarthelemy()
|
||||
* @method static self saintHelenaAscensionAndTristanDaCunha()
|
||||
* @method static self saintKittsAndNevis()
|
||||
* @method static self saintLucia()
|
||||
* @method static self saintMartinFrenchPart()
|
||||
* @method static self saintPierreAndMiquelon()
|
||||
* @method static self saintVincentAndTheGrenadines()
|
||||
* @method static self samoa()
|
||||
* @method static self sanMarino()
|
||||
* @method static self saoTomeAndPrincipe()
|
||||
* @method static self saudiArabia()
|
||||
* @method static self senegal()
|
||||
* @method static self serbia()
|
||||
* @method static self seychelles()
|
||||
* @method static self sierraLeone()
|
||||
* @method static self singapore()
|
||||
* @method static self sintMaartenDutchPart()
|
||||
* @method static self slovakia()
|
||||
* @method static self slovenia()
|
||||
* @method static self solomonIslands()
|
||||
* @method static self somalia()
|
||||
* @method static self southAfrica()
|
||||
* @method static self southGeorgiaAndTheSouthSandwichIslands()
|
||||
* @method static self southSudan()
|
||||
* @method static self spain()
|
||||
* @method static self sriLanka()
|
||||
* @method static self sudan()
|
||||
* @method static self suriname()
|
||||
* @method static self svalbardAndJanMayen()
|
||||
* @method static self swaziland()
|
||||
* @method static self sweden()
|
||||
* @method static self switzerland()
|
||||
* @method static self syrianArabRepublic()
|
||||
* @method static self taiwanProvinceOfChina()
|
||||
* @method static self tajikistan()
|
||||
* @method static self tanzaniaUnitedRepublicOf()
|
||||
* @method static self thailand()
|
||||
* @method static self timorLeste()
|
||||
* @method static self togo()
|
||||
* @method static self tokelau()
|
||||
* @method static self tonga()
|
||||
* @method static self trinidadAndTobago()
|
||||
* @method static self tunisia()
|
||||
* @method static self turkey()
|
||||
* @method static self turkmenistan()
|
||||
* @method static self turksAndCaicosIslands()
|
||||
* @method static self tuvalu()
|
||||
* @method static self uganda()
|
||||
* @method static self ukraine()
|
||||
* @method static self unitedArabEmirates()
|
||||
* @method static self unitedKingdom()
|
||||
* @method static self unitedStates()
|
||||
* @method static self unitedStatesMinorOutlyingIslands()
|
||||
* @method static self uruguay()
|
||||
* @method static self uzbekistan()
|
||||
* @method static self vanuatu()
|
||||
* @method static self venezuelaBolivarianRepublicOf()
|
||||
* @method static self vietNam()
|
||||
* @method static self virginIslandsBritish()
|
||||
* @method static self virginIslandsUs()
|
||||
* @method static self wallisAndFutuna()
|
||||
* @method static self westernSahara()
|
||||
* @method static self yemen()
|
||||
* @method static self zambia()
|
||||
* @method static self zimbabwe()
|
||||
*
|
||||
* @package LDCCrmClient
|
||||
* @subpackage enums
|
||||
*/
|
||||
class Country extends BaseEnum
|
||||
{
|
||||
/**
|
||||
* Valeurs des possibilités de cet énumération (value)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return [
|
||||
'afghanistan' => 1,
|
||||
'alandIslands' => 2,
|
||||
'albania' => 3,
|
||||
'algeria' => 4,
|
||||
'americanSamoa' => 5,
|
||||
'andorra' => 6,
|
||||
'angola' => 7,
|
||||
'anguilla' => 8,
|
||||
'antarctica' => 9,
|
||||
'antiguaAndBarbuda' => 10,
|
||||
'argentina' => 11,
|
||||
'armenia' => 12,
|
||||
'aruba' => 13,
|
||||
'australia' => 14,
|
||||
'austria' => 15,
|
||||
'azerbaijan' => 16,
|
||||
'bahrain' => 17,
|
||||
'bahamas' => 18,
|
||||
'bangladesh' => 19,
|
||||
'barbados' => 20,
|
||||
'belarus' => 21,
|
||||
'belgium' => 22,
|
||||
'belize' => 23,
|
||||
'benin' => 24,
|
||||
'bermuda' => 25,
|
||||
'bhutan' => 26,
|
||||
'boliviaPlurinationalStateOf' => 27,
|
||||
'bonaireSintEustatiusAndSaba' => 28,
|
||||
'bosniaAndHerzegovina' => 29,
|
||||
'botswana' => 30,
|
||||
'bouvetIsland' => 31,
|
||||
'brazil' => 32,
|
||||
'britishIndianOceanTerritory' => 33,
|
||||
'bruneiDarussalam' => 34,
|
||||
'bulgaria' => 35,
|
||||
'burkinaFaso' => 36,
|
||||
'burundi' => 37,
|
||||
'cambodia' => 38,
|
||||
'cameroon' => 39,
|
||||
'canada' => 40,
|
||||
'capeVerde' => 41,
|
||||
'caymanIslands' => 42,
|
||||
'centralAfricanRepublic' => 43,
|
||||
'chad' => 44,
|
||||
'chile' => 45,
|
||||
'china' => 46,
|
||||
'christmasIsland' => 47,
|
||||
'cocosKeelingIslands' => 48,
|
||||
'colombia' => 49,
|
||||
'comoros' => 50,
|
||||
'congo' => 51,
|
||||
'congoTheDemocraticRepublicOfThe' => 52,
|
||||
'cookIslands' => 53,
|
||||
'costaRica' => 54,
|
||||
'coteDivoire' => 55,
|
||||
'croatia' => 56,
|
||||
'cuba' => 57,
|
||||
'curacao' => 58,
|
||||
'cyprus' => 59,
|
||||
'czechRepublic' => 60,
|
||||
'denmark' => 61,
|
||||
'djibouti' => 62,
|
||||
'dominica' => 63,
|
||||
'dominicanRepublic' => 64,
|
||||
'ecuador' => 65,
|
||||
'egypt' => 66,
|
||||
'elSalvador' => 67,
|
||||
'equatorialGuinea' => 68,
|
||||
'eritrea' => 69,
|
||||
'estonia' => 70,
|
||||
'ethiopia' => 71,
|
||||
'falklandIslandsMalvinas' => 72,
|
||||
'faroeIslands' => 73,
|
||||
'fiji' => 74,
|
||||
'finland' => 75,
|
||||
'france' => 76,
|
||||
'frenchGuiana' => 77,
|
||||
'frenchPolynesia' => 78,
|
||||
'frenchSouthernTerritories' => 79,
|
||||
'gabon' => 80,
|
||||
'gambia' => 81,
|
||||
'georgia' => 82,
|
||||
'germany' => 83,
|
||||
'ghana' => 84,
|
||||
'gibraltar' => 85,
|
||||
'greece' => 86,
|
||||
'greenland' => 87,
|
||||
'grenada' => 88,
|
||||
'guadeloupe' => 89,
|
||||
'guam' => 90,
|
||||
'guatemala' => 91,
|
||||
'guernsey' => 92,
|
||||
'guinea' => 93,
|
||||
'guineaBissau' => 94,
|
||||
'guyana' => 95,
|
||||
'haiti' => 96,
|
||||
'heardIslandAndMcdonaldIslands' => 97,
|
||||
'holySeeVaticanCityState' => 98,
|
||||
'honduras' => 99,
|
||||
'hongKong' => 100,
|
||||
'hungary' => 101,
|
||||
'iceland' => 102,
|
||||
'india' => 103,
|
||||
'indonesia' => 104,
|
||||
'iranIslamicRepublicOf' => 105,
|
||||
'iraq' => 106,
|
||||
'ireland' => 107,
|
||||
'isleOfMan' => 108,
|
||||
'israel' => 109,
|
||||
'italy' => 110,
|
||||
'jamaica' => 111,
|
||||
'japan' => 112,
|
||||
'jersey' => 113,
|
||||
'jordan' => 114,
|
||||
'kazakhstan' => 115,
|
||||
'kenya' => 116,
|
||||
'kiribati' => 117,
|
||||
'koreaDemocraticPeoplesRepublicOf' => 118,
|
||||
'koreaRepublicOf' => 119,
|
||||
'kuwait' => 120,
|
||||
'kyrgyzstan' => 121,
|
||||
'laoPeoplesDemocraticRepublic' => 122,
|
||||
'latvia' => 123,
|
||||
'lebanon' => 124,
|
||||
'lesotho' => 125,
|
||||
'liberia' => 126,
|
||||
'libya' => 127,
|
||||
'liechtenstein' => 128,
|
||||
'lithuania' => 129,
|
||||
'luxembourg' => 130,
|
||||
'macao' => 131,
|
||||
'macedoniaTheFormerYugoslavRepublicOf' => 132,
|
||||
'madagascar' => 133,
|
||||
'malawi' => 134,
|
||||
'malaysia' => 135,
|
||||
'maldives' => 136,
|
||||
'mali' => 137,
|
||||
'malta' => 138,
|
||||
'marshallIslands' => 139,
|
||||
'martinique' => 140,
|
||||
'mauritania' => 141,
|
||||
'mauritius' => 142,
|
||||
'mayotte' => 143,
|
||||
'mexico' => 144,
|
||||
'micronesiaFederatedStatesOf' => 145,
|
||||
'moldovaRepublicOf' => 146,
|
||||
'monaco' => 147,
|
||||
'mongolia' => 148,
|
||||
'montenegro' => 149,
|
||||
'montserrat' => 150,
|
||||
'morocco' => 151,
|
||||
'mozambique' => 152,
|
||||
'myanmar' => 153,
|
||||
'namibia' => 154,
|
||||
'nauru' => 155,
|
||||
'nepal' => 156,
|
||||
'netherlands' => 157,
|
||||
'newCaledonia' => 158,
|
||||
'newZealand' => 159,
|
||||
'nicaragua' => 160,
|
||||
'niger' => 161,
|
||||
'nigeria' => 162,
|
||||
'niue' => 163,
|
||||
'norfolkIsland' => 164,
|
||||
'northernMarianaIslands' => 165,
|
||||
'norway' => 166,
|
||||
'oman' => 167,
|
||||
'pakistan' => 168,
|
||||
'palau' => 169,
|
||||
'palestineStateOf' => 170,
|
||||
'panama' => 171,
|
||||
'papuaNewGuinea' => 172,
|
||||
'paraguay' => 173,
|
||||
'peru' => 174,
|
||||
'philippines' => 175,
|
||||
'pitcairn' => 176,
|
||||
'poland' => 177,
|
||||
'portugal' => 178,
|
||||
'puertoRico' => 179,
|
||||
'qatar' => 180,
|
||||
'reunion' => 181,
|
||||
'romania' => 182,
|
||||
'russianFederation' => 183,
|
||||
'rwanda' => 184,
|
||||
'saintBarthelemy' => 185,
|
||||
'saintHelenaAscensionAndTristanDaCunha' => 186,
|
||||
'saintKittsAndNevis' => 187,
|
||||
'saintLucia' => 188,
|
||||
'saintMartinFrenchPart' => 189,
|
||||
'saintPierreAndMiquelon' => 190,
|
||||
'saintVincentAndTheGrenadines' => 191,
|
||||
'samoa' => 192,
|
||||
'sanMarino' => 193,
|
||||
'saoTomeAndPrincipe' => 194,
|
||||
'saudiArabia' => 195,
|
||||
'senegal' => 196,
|
||||
'serbia' => 197,
|
||||
'seychelles' => 198,
|
||||
'sierraLeone' => 199,
|
||||
'singapore' => 200,
|
||||
'sintMaartenDutchPart' => 201,
|
||||
'slovakia' => 202,
|
||||
'slovenia' => 203,
|
||||
'solomonIslands' => 204,
|
||||
'somalia' => 205,
|
||||
'southAfrica' => 206,
|
||||
'southGeorgiaAndTheSouthSandwichIslands' => 207,
|
||||
'southSudan' => 208,
|
||||
'spain' => 209,
|
||||
'sriLanka' => 210,
|
||||
'sudan' => 211,
|
||||
'suriname' => 212,
|
||||
'svalbardAndJanMayen' => 213,
|
||||
'swaziland' => 214,
|
||||
'sweden' => 215,
|
||||
'switzerland' => 216,
|
||||
'syrianArabRepublic' => 217,
|
||||
'taiwanProvinceOfChina' => 218,
|
||||
'tajikistan' => 219,
|
||||
'tanzaniaUnitedRepublicOf' => 220,
|
||||
'thailand' => 221,
|
||||
'timorLeste' => 222,
|
||||
'togo' => 223,
|
||||
'tokelau' => 224,
|
||||
'tonga' => 225,
|
||||
'trinidadAndTobago' => 226,
|
||||
'tunisia' => 227,
|
||||
'turkey' => 228,
|
||||
'turkmenistan' => 229,
|
||||
'turksAndCaicosIslands' => 230,
|
||||
'tuvalu' => 231,
|
||||
'uganda' => 232,
|
||||
'ukraine' => 233,
|
||||
'unitedArabEmirates' => 234,
|
||||
'unitedKingdom' => 235,
|
||||
'unitedStates' => 236,
|
||||
'unitedStatesMinorOutlyingIslands' => 237,
|
||||
'uruguay' => 238,
|
||||
'uzbekistan' => 239,
|
||||
'vanuatu' => 240,
|
||||
'venezuelaBolivarianRepublicOf' => 241,
|
||||
'vietNam' => 242,
|
||||
'virginIslandsBritish' => 243,
|
||||
'virginIslandsUs' => 244,
|
||||
'wallisAndFutuna' => 245,
|
||||
'westernSahara' => 246,
|
||||
'yemen' => 247,
|
||||
'zambia' => 248,
|
||||
'zimbabwe' => 249
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Libellés des possibilités de cet énumération (label)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function labels(): array
|
||||
{
|
||||
return [
|
||||
'afghanistan' => 'Afghanistan',
|
||||
'alandIslands' => 'Åland Islands',
|
||||
'albania' => 'Albania',
|
||||
'algeria' => 'Algeria',
|
||||
'americanSamoa' => 'American Samoa',
|
||||
'andorra' => 'Andorra',
|
||||
'angola' => 'Angola',
|
||||
'anguilla' => 'Anguilla',
|
||||
'antarctica' => 'Antarctica',
|
||||
'antiguaAndBarbuda' => 'Antigua and Barbuda',
|
||||
'argentina' => 'Argentina',
|
||||
'armenia' => 'Armenia',
|
||||
'aruba' => 'Aruba',
|
||||
'australia' => 'Australia',
|
||||
'austria' => 'Austria',
|
||||
'azerbaijan' => 'Azerbaijan',
|
||||
'bahrain' => 'Bahrain',
|
||||
'bahamas' => 'Bahamas',
|
||||
'bangladesh' => 'Bangladesh',
|
||||
'barbados' => 'Barbados',
|
||||
'belarus' => 'Belarus',
|
||||
'belgium' => 'Belgium',
|
||||
'belize' => 'Belize',
|
||||
'benin' => 'Benin',
|
||||
'bermuda' => 'Bermuda',
|
||||
'bhutan' => 'Bhutan',
|
||||
'boliviaPlurinationalStateOf' => 'Bolivia, Plurinational State of',
|
||||
'bonaireSintEustatiusAndSaba' => 'Bonaire, Sint Eustatius and Saba',
|
||||
'bosniaAndHerzegovina' => 'Bosnia and Herzegovina',
|
||||
'botswana' => 'Botswana',
|
||||
'bouvetIsland' => 'Bouvet Island',
|
||||
'brazil' => 'Brazil',
|
||||
'britishIndianOceanTerritory' => 'British Indian Ocean Territory',
|
||||
'bruneiDarussalam' => 'Brunei Darussalam',
|
||||
'bulgaria' => 'Bulgaria',
|
||||
'burkinaFaso' => 'Burkina Faso',
|
||||
'burundi' => 'Burundi',
|
||||
'cambodia' => 'Cambodia',
|
||||
'cameroon' => 'Cameroon',
|
||||
'canada' => 'Canada',
|
||||
'capeVerde' => 'Cape Verde',
|
||||
'caymanIslands' => 'Cayman Islands',
|
||||
'centralAfricanRepublic' => 'Central African Republic',
|
||||
'chad' => 'Chad',
|
||||
'chile' => 'Chile',
|
||||
'china' => 'China',
|
||||
'christmasIsland' => 'Christmas Island',
|
||||
'cocosKeelingIslands' => 'Cocos (Keeling) Islands',
|
||||
'colombia' => 'Colombia',
|
||||
'comoros' => 'Comoros',
|
||||
'congo' => 'Congo',
|
||||
'congoTheDemocraticRepublicOfThe' => 'Congo, the Democratic Republic of the',
|
||||
'cookIslands' => 'Cook Islands',
|
||||
'costaRica' => 'Costa Rica',
|
||||
'coteDivoire' => 'Côte d\'Ivoire',
|
||||
'croatia' => 'Croatia',
|
||||
'cuba' => 'Cuba',
|
||||
'curacao' => 'Curaçao',
|
||||
'cyprus' => 'Cyprus',
|
||||
'czechRepublic' => 'Czech Republic',
|
||||
'denmark' => 'Denmark',
|
||||
'djibouti' => 'Djibouti',
|
||||
'dominica' => 'Dominica',
|
||||
'dominicanRepublic' => 'Dominican Republic',
|
||||
'ecuador' => 'Ecuador',
|
||||
'egypt' => 'Egypt',
|
||||
'elSalvador' => 'El Salvador',
|
||||
'equatorialGuinea' => 'Equatorial Guinea',
|
||||
'eritrea' => 'Eritrea',
|
||||
'estonia' => 'Estonia',
|
||||
'ethiopia' => 'Ethiopia',
|
||||
'falklandIslandsMalvinas' => 'Falkland Islands (Malvinas)',
|
||||
'faroeIslands' => 'Faroe Islands',
|
||||
'fiji' => 'Fiji',
|
||||
'finland' => 'Finland',
|
||||
'france' => 'France',
|
||||
'frenchGuiana' => 'French Guiana',
|
||||
'frenchPolynesia' => 'French Polynesia',
|
||||
'frenchSouthernTerritories' => 'French Southern Territories',
|
||||
'gabon' => 'Gabon',
|
||||
'gambia' => 'Gambia',
|
||||
'georgia' => 'Georgia',
|
||||
'germany' => 'Germany',
|
||||
'ghana' => 'Ghana',
|
||||
'gibraltar' => 'Gibraltar',
|
||||
'greece' => 'Greece',
|
||||
'greenland' => 'Greenland',
|
||||
'grenada' => 'Grenada',
|
||||
'guadeloupe' => 'Guadeloupe',
|
||||
'guam' => 'Guam',
|
||||
'guatemala' => 'Guatemala',
|
||||
'guernsey' => 'Guernsey',
|
||||
'guinea' => 'Guinea',
|
||||
'guineaBissau' => 'GuineaBissau',
|
||||
'guyana' => 'Guyana',
|
||||
'haiti' => 'Haiti',
|
||||
'heardIslandAndMcdonaldIslands' => 'Heard Island and McDonald Islands',
|
||||
'holySeeVaticanCityState' => 'Holy See (Vatican City State)',
|
||||
'honduras' => 'Honduras',
|
||||
'hongKong' => 'Hong Kong',
|
||||
'hungary' => 'Hungary',
|
||||
'iceland' => 'Iceland',
|
||||
'india' => 'India',
|
||||
'indonesia' => 'Indonesia',
|
||||
'iranIslamicRepublicOf' => 'Iran, Islamic Republic of',
|
||||
'iraq' => 'Iraq',
|
||||
'ireland' => 'Ireland',
|
||||
'isleOfMan' => 'Isle of Man',
|
||||
'israel' => 'Israel',
|
||||
'italy' => 'Italy',
|
||||
'jamaica' => 'Jamaica',
|
||||
'japan' => 'Japan',
|
||||
'jersey' => 'Jersey',
|
||||
'jordan' => 'Jordan',
|
||||
'kazakhstan' => 'Kazakhstan',
|
||||
'kenya' => 'Kenya',
|
||||
'kiribati' => 'Kiribati',
|
||||
'koreaDemocraticPeoplesRepublicOf' => 'Korea, Democratic People\'s Republic of',
|
||||
'koreaRepublicOf' => 'Korea, Republic of',
|
||||
'kuwait' => 'Kuwait',
|
||||
'kyrgyzstan' => 'Kyrgyzstan',
|
||||
'laoPeoplesDemocraticRepublic' => 'Lao People\'s Democratic Republic',
|
||||
'latvia' => 'Latvia',
|
||||
'lebanon' => 'Lebanon',
|
||||
'lesotho' => 'Lesotho',
|
||||
'liberia' => 'Liberia',
|
||||
'libya' => 'Libya',
|
||||
'liechtenstein' => 'Liechtenstein',
|
||||
'lithuania' => 'Lithuania',
|
||||
'luxembourg' => 'Luxembourg',
|
||||
'macao' => 'Macao',
|
||||
'macedoniaTheFormerYugoslavRepublicOf' => 'Macedonia, the Former Yugoslav Republic of',
|
||||
'madagascar' => 'Madagascar',
|
||||
'malawi' => 'Malawi',
|
||||
'malaysia' => 'Malaysia',
|
||||
'maldives' => 'Maldives',
|
||||
'mali' => 'Mali',
|
||||
'malta' => 'Malta',
|
||||
'marshallIslands' => 'Marshall Islands',
|
||||
'martinique' => 'Martinique',
|
||||
'mauritania' => 'Mauritania',
|
||||
'mauritius' => 'Mauritius',
|
||||
'mayotte' => 'Mayotte',
|
||||
'mexico' => 'Mexico',
|
||||
'micronesiaFederatedStatesOf' => 'Micronesia, Federated States of',
|
||||
'moldovaRepublicOf' => 'Moldova, Republic of',
|
||||
'monaco' => 'Monaco',
|
||||
'mongolia' => 'Mongolia',
|
||||
'montenegro' => 'Montenegro',
|
||||
'montserrat' => 'Montserrat',
|
||||
'morocco' => 'Morocco',
|
||||
'mozambique' => 'Mozambique',
|
||||
'myanmar' => 'Myanmar',
|
||||
'namibia' => 'Namibia',
|
||||
'nauru' => 'Nauru',
|
||||
'nepal' => 'Nepal',
|
||||
'netherlands' => 'Netherlands',
|
||||
'newCaledonia' => 'New Caledonia',
|
||||
'newZealand' => 'New Zealand',
|
||||
'nicaragua' => 'Nicaragua',
|
||||
'niger' => 'Niger',
|
||||
'nigeria' => 'Nigeria',
|
||||
'niue' => 'Niue',
|
||||
'norfolkIsland' => 'Norfolk Island',
|
||||
'northernMarianaIslands' => 'Northern Mariana Islands',
|
||||
'norway' => 'Norway',
|
||||
'oman' => 'Oman',
|
||||
'pakistan' => 'Pakistan',
|
||||
'palau' => 'Palau',
|
||||
'palestineStateOf' => 'Palestine, State of',
|
||||
'panama' => 'Panama',
|
||||
'papuaNewGuinea' => 'Papua New Guinea',
|
||||
'paraguay' => 'Paraguay',
|
||||
'peru' => 'Peru',
|
||||
'philippines' => 'Philippines',
|
||||
'pitcairn' => 'Pitcairn',
|
||||
'poland' => 'Poland',
|
||||
'portugal' => 'Portugal',
|
||||
'puertoRico' => 'Puerto Rico',
|
||||
'qatar' => 'Qatar',
|
||||
'reunion' => 'Réunion',
|
||||
'romania' => 'Romania',
|
||||
'russianFederation' => 'Russian Federation',
|
||||
'rwanda' => 'Rwanda',
|
||||
'saintBarthelemy' => 'Saint Barthélemy',
|
||||
'saintHelenaAscensionAndTristanDaCunha' => 'Saint Helena, Ascension and Tristan da Cunha',
|
||||
'saintKittsAndNevis' => 'Saint Kitts and Nevis',
|
||||
'saintLucia' => 'Saint Lucia',
|
||||
'saintMartinFrenchPart' => 'Saint Martin (French part)',
|
||||
'saintPierreAndMiquelon' => 'Saint Pierre and Miquelon',
|
||||
'saintVincentAndTheGrenadines' => 'Saint Vincent and the Grenadines',
|
||||
'samoa' => 'Samoa',
|
||||
'sanMarino' => 'San Marino',
|
||||
'saoTomeAndPrincipe' => 'Sao Tome and Principe',
|
||||
'saudiArabia' => 'Saudi Arabia',
|
||||
'senegal' => 'Senegal',
|
||||
'serbia' => 'Serbia',
|
||||
'seychelles' => 'Seychelles',
|
||||
'sierraLeone' => 'Sierra Leone',
|
||||
'singapore' => 'Singapore',
|
||||
'sintMaartenDutchPart' => 'Sint Maarten (Dutch part)',
|
||||
'slovakia' => 'Slovakia',
|
||||
'slovenia' => 'Slovenia',
|
||||
'solomonIslands' => 'Solomon Islands',
|
||||
'somalia' => 'Somalia',
|
||||
'southAfrica' => 'South Africa',
|
||||
'southGeorgiaAndTheSouthSandwichIslands' => 'South Georgia and the South Sandwich Islands',
|
||||
'southSudan' => 'South Sudan',
|
||||
'spain' => 'Spain',
|
||||
'sriLanka' => 'Sri Lanka',
|
||||
'sudan' => 'Sudan',
|
||||
'suriname' => 'Suriname',
|
||||
'svalbardAndJanMayen' => 'Svalbard and Jan Mayen',
|
||||
'swaziland' => 'Swaziland',
|
||||
'sweden' => 'Sweden',
|
||||
'switzerland' => 'Switzerland',
|
||||
'syrianArabRepublic' => 'Syrian Arab Republic',
|
||||
'taiwanProvinceOfChina' => 'Taiwan, Province of China',
|
||||
'tajikistan' => 'Tajikistan',
|
||||
'tanzaniaUnitedRepublicOf' => 'Tanzania, United Republic of',
|
||||
'thailand' => 'Thailand',
|
||||
'timorLeste' => 'TimorLeste',
|
||||
'togo' => 'Togo',
|
||||
'tokelau' => 'Tokelau',
|
||||
'tonga' => 'Tonga',
|
||||
'trinidadAndTobago' => 'Trinidad and Tobago',
|
||||
'tunisia' => 'Tunisia',
|
||||
'turkey' => 'Turkey',
|
||||
'turkmenistan' => 'Turkmenistan',
|
||||
'turksAndCaicosIslands' => 'Turks and Caicos Islands',
|
||||
'tuvalu' => 'Tuvalu',
|
||||
'uganda' => 'Uganda',
|
||||
'ukraine' => 'Ukraine',
|
||||
'unitedArabEmirates' => 'United Arab Emirates',
|
||||
'unitedKingdom' => 'United Kingdom',
|
||||
'unitedStates' => 'United States',
|
||||
'unitedStatesMinorOutlyingIslands' => 'United States Minor Outlying Islands',
|
||||
'uruguay' => 'Uruguay',
|
||||
'uzbekistan' => 'Uzbekistan',
|
||||
'vanuatu' => 'Vanuatu',
|
||||
'venezuelaBolivarianRepublicOf' => 'Venezuela, Bolivarian Republic of',
|
||||
'vietNam' => 'Viet Nam',
|
||||
'virginIslandsBritish' => 'Virgin Islands, British',
|
||||
'virginIslandsUs' => 'Virgin Islands, U.S.',
|
||||
'wallisAndFutuna' => 'Wallis and Futuna',
|
||||
'westernSahara' => 'Western Sahara',
|
||||
'yemen' => 'Yemen',
|
||||
'zambia' => 'Zambia',
|
||||
'zimbabwe' => 'Zimbabwe'
|
||||
];
|
||||
}
|
||||
}
|
||||
64
app/Enums/Page.php
Normal file
64
app/Enums/Page.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* @method static self homeHeader()
|
||||
* @method static self marqueHeader()
|
||||
* @method static self marqueHistory()
|
||||
* @method static self marqueBloc2()
|
||||
* @method static self marqueBloc3()
|
||||
* @method static self marqueBloc4()
|
||||
* @method static self marqueBloc4l()
|
||||
* @method static self marqueBloc4r()
|
||||
* @method static self marqueFooter()
|
||||
* @method static self newsAdvice()
|
||||
* @method static self newsQuestions()
|
||||
* @method static self newsPosts()
|
||||
* @method static self newsProducts()
|
||||
* @method static self foodHeader()
|
||||
* @method static self foodBloc2()
|
||||
* @method static self foodProducts()
|
||||
* @method static self mentions()
|
||||
* @method static self charte()
|
||||
* @method static self home()
|
||||
* @method static self marque()
|
||||
* @method static self news()
|
||||
* @method static self foodservice()
|
||||
* @method static self gammes()
|
||||
*/
|
||||
class Page extends BaseEnumRoutable
|
||||
{
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'homeHeader' => 0,
|
||||
'homeProducts' => 1,
|
||||
'homeNews' => 2,
|
||||
'marqueHeader' => 3,
|
||||
'marqueHistory' => 4,
|
||||
'marqueBloc2' => 5,
|
||||
'marqueBloc3' => 6,
|
||||
'marqueBloc4' => 7,
|
||||
'marqueBloc4l' => 8,
|
||||
'marqueBloc4r' => 9,
|
||||
'marqueFooter' => 10,
|
||||
'newsAdvice' => 11,
|
||||
'newsQuestions' => 12,
|
||||
'newsPosts' => 13,
|
||||
'newsProducts' => 14,
|
||||
'foodHeader' => 15,
|
||||
'foodBloc2' => 16,
|
||||
'foodProducts' => 17,
|
||||
'mentions' => 18,
|
||||
'charte' => 19,
|
||||
'home' => 20,
|
||||
'marque' => 21,
|
||||
'news' => 22,
|
||||
'foodservice' => 23,
|
||||
'gammes' => 24
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Enums/Role.php
Normal file
20
app/Enums/Role.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* @method static self admin()
|
||||
* @method static self user()
|
||||
*/
|
||||
class Role extends BaseEnumRoutable
|
||||
{
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'admin' => 0,
|
||||
'user' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
* phpcs:ignore PEAR.Commenting.FileComment.MissingVersion
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
*/
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
|
|
@ -12,9 +31,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
protected $dontReport = [];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
|
|
@ -26,16 +43,4 @@ class Handler extends ExceptionHandler
|
|||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
39
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
39
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
||||
21
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
21
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
||||
59
app/Http/Controllers/Auth/LoginController.php
Normal file
59
app/Http/Controllers/Auth/LoginController.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Controller pour le login
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
* phpcs:ignore PEAR.Commenting.FileComment.MissingVersion
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
*/
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest:web')->except('logout');
|
||||
}
|
||||
}
|
||||
72
app/Http/Controllers/Auth/RegisterController.php
Normal file
72
app/Http/Controllers/Auth/RegisterController.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest:web');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
29
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
||||
41
app/Http/Controllers/Auth/VerificationController.php
Normal file
41
app/Http/Controllers/Auth/VerificationController.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
||||
52
app/Http/Controllers/Bo/AdviceController.php
Normal file
52
app/Http/Controllers/Bo/AdviceController.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UpdateAdviceRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Advice;
|
||||
|
||||
class AdviceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Advice $advice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Advice $advice)
|
||||
{
|
||||
return view('back.advice.edit', compact('advice'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Advice $advice
|
||||
* @param \Illuminate\Http\UpdateAdviceRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Advice $advice, UpdateAdviceRequest $request)
|
||||
{
|
||||
$advice->fill($request->validated());
|
||||
if (is_a($request->picture1,"SplFileInfo")) {
|
||||
$advice->picture1 = Utils::storeImage($request->picture1, $advice->getTable());
|
||||
}
|
||||
if (is_a($request->picture2,"SplFileInfo")) {
|
||||
$advice->picture2 = Utils::storeImage($request->picture2, $advice->getTable());
|
||||
}
|
||||
if (is_a($request->picture3,"SplFileInfo")) {
|
||||
$advice->picture3 = Utils::storeImage($request->picture3, $advice->getTable());
|
||||
}
|
||||
|
||||
if (!$advice->saveOrFail()) {
|
||||
return redirect()->route('bo.advice.edit', $advice->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.advice.edit', $advice->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
45
app/Http/Controllers/Bo/EncartsController.php
Normal file
45
app/Http/Controllers/Bo/EncartsController.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UpdateEncartRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Encart;
|
||||
|
||||
class EncartsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Encart $encart
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Encart $encart)
|
||||
{
|
||||
return view('back.encarts.edit', compact('encart'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Encart $encart
|
||||
* @param \Illuminate\Http\UpdateEncartRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Encart $encart, UpdateEncartRequest $request)
|
||||
{
|
||||
$encart->fill($request->validated());
|
||||
if (is_a($request->picture,"SplFileInfo")) {
|
||||
$encart->picture = Utils::storeImage($request->picture, $encart->getTable());
|
||||
}
|
||||
|
||||
if (!$encart->saveOrFail()) {
|
||||
return redirect()->route('bo.encarts.edit', $encart->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.encarts.edit', $encart->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
130
app/Http/Controllers/Bo/GammesController.php
Normal file
130
app/Http/Controllers/Bo/GammesController.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreGammeRequest;
|
||||
use App\Http\Requests\UpdateGammeRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Gamme;
|
||||
|
||||
class GammesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$gammes = collect([]);
|
||||
$dbGammes = Gamme::orderBy('title')->whereNull('parent_gamme_id')
|
||||
->with('childGammes')->get();
|
||||
|
||||
/** @var \App\Models\Gamme $gamme */
|
||||
foreach ($dbGammes as $gamme) {
|
||||
$gammes->push($gamme);
|
||||
$gamme->childGammes->sortBy('title')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
$gammes->push($childGamme);
|
||||
});
|
||||
}
|
||||
|
||||
return view('back.gammes.index', compact('gammes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Gamme $gamme)
|
||||
{
|
||||
$parentGammes = Gamme::whereNull('parent_gamme_id')
|
||||
->where('id', '!=', $gamme->id)
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return view('back.gammes.create', compact('gamme', 'parentGammes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreGammeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreGammeRequest $request)
|
||||
{
|
||||
$gamme = new Gamme($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($request->picture, $gamme->getTable());
|
||||
}
|
||||
if (is_a($request->banner, "SplFileInfo")) {
|
||||
$gamme->banner = Utils::storeImage($request->banner, $gamme->getTable());
|
||||
}
|
||||
|
||||
if (!$gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
}
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Gamme $gamme)
|
||||
{
|
||||
$parentGammes = Gamme::whereNull('parent_gamme_id')
|
||||
->where('id', '!=', $gamme->id)
|
||||
->orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return view('back.gammes.edit', compact('gamme', 'parentGammes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\UpdateGammeRequest $request
|
||||
* @param Gamme $gamme
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Gamme $gamme, UpdateGammeRequest $request)
|
||||
{
|
||||
$gamme->fill($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($request->picture, $gamme->getTable());
|
||||
}
|
||||
if (is_a($request->banner, "SplFileInfo")) {
|
||||
$gamme->banner = Utils::storeImage($request->banner, $gamme->getTable());
|
||||
}
|
||||
|
||||
if (!$gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Gamme $gamme)
|
||||
{
|
||||
if (!$gamme->delete()) {
|
||||
return redirect()->route('bo.gammes.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammes.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
15
app/Http/Controllers/Bo/HomeController.php
Normal file
15
app/Http/Controllers/Bo/HomeController.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
// BO
|
||||
|
||||
public function home()
|
||||
{
|
||||
return view('back.home');
|
||||
}
|
||||
}
|
||||
58
app/Http/Controllers/Bo/MomentsController.php
Normal file
58
app/Http/Controllers/Bo/MomentsController.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UpdateMomentRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Moment;
|
||||
|
||||
class MomentsController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$moments = Moment::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return view('back.moments.index', compact('moments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Moment $moment
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Moment $moment)
|
||||
{
|
||||
return view('back.moments.edit', compact('moment'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Moment $moment
|
||||
* @param \Illuminate\Http\UpdateMomentRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Moment $moment, UpdateMomentRequest $request)
|
||||
{
|
||||
$moment->fill($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$moment->picture = Utils::storeImage($request->picture, $moment->getTable());
|
||||
}
|
||||
|
||||
if (!$moment->saveOrFail()) {
|
||||
return redirect()->route('bo.moments.edit', $moment->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.moments.edit', $moment->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
105
app/Http/Controllers/Bo/PictoBrandsController.php
Normal file
105
app/Http/Controllers/Bo/PictoBrandsController.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StorePictoBrandRequest;
|
||||
use App\Http\Requests\UpdatePictoBrandRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\PictoBrand;
|
||||
|
||||
class PictoBrandsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$pictobrands = PictoBrand::all();
|
||||
|
||||
return view('back.pictobrands.index', compact('pictobrands'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(PictoBrand $pictobrand)
|
||||
{
|
||||
return view('back.pictobrands.create', compact('pictobrand'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StorePictoBrandRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StorePictoBrandRequest $request)
|
||||
{
|
||||
$pictobrand = new PictoBrand($request->validated());
|
||||
if (is_a($request->picture,"SplFileInfo")) {
|
||||
$pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable());
|
||||
}
|
||||
|
||||
if (!$pictobrand->saveOrFail()) {
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)->with('error', 'Le pictogramme n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)->with('success', 'Pictogramme créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(PictoBrand $pictobrand)
|
||||
{
|
||||
return view('back.pictobrands.edit', compact('pictobrand'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @param \Illuminate\Http\StorePictoBrandRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(PictoBrand $pictobrand, StorePictoBrandRequest $request)
|
||||
{
|
||||
$pictobrand->fill($request->validated());
|
||||
if (is_a($request->picture,"SplFileInfo")) {
|
||||
$pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable());
|
||||
}
|
||||
|
||||
if (!$pictobrand->saveOrFail()) {
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(PictoBrand $pictobrand)
|
||||
{
|
||||
if (!$pictobrand->delete()) {
|
||||
return redirect()->route('bo.pictobrands.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
108
app/Http/Controllers/Bo/PictosController.php
Normal file
108
app/Http/Controllers/Bo/PictosController.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StorePictoRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Picto;
|
||||
|
||||
class PictosController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Page $page)
|
||||
{
|
||||
$pictos = Picto::where('page', $page)->get();
|
||||
|
||||
return view('back.pictos.index', compact('pictos'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Picto $picto)
|
||||
{
|
||||
return view('back.pictos.create', compact('picto'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StorePictoRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StorePictoRequest $request)
|
||||
{
|
||||
$picto = new Picto($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($request->picture, $picto->getTable());
|
||||
}
|
||||
//on ne peut pas arbitrairement créer tous les pictos à cet endroit
|
||||
//j'ai du décommenter cette ligne pour la création picto fonctionne
|
||||
$picto->page = Page::marqueBloc2();
|
||||
|
||||
if (!$picto->saveOrFail()) {
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Picto $picto)
|
||||
{
|
||||
return view('back.pictos.edit', compact('picto'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @param \Illuminate\Http\StorePictoRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Picto $picto, StorePictoRequest $request)
|
||||
{
|
||||
$picto->fill($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($request->picture, $picto->getTable());
|
||||
}
|
||||
|
||||
if (!$picto->saveOrFail()) {
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Picto $picto)
|
||||
{
|
||||
if (!$picto->delete()) {
|
||||
return redirect()->route('bo.pictos.content', $picto->page)->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictos.content', $picto->page)->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
137
app/Http/Controllers/Bo/PostsController.php
Normal file
137
app/Http/Controllers/Bo/PostsController.php
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StorePostRequest;
|
||||
use App\Http\Requests\UpdatePostRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Post;
|
||||
|
||||
class PostsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$posts = Post::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
return view('back.posts.index', compact('posts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Post $post)
|
||||
{
|
||||
return view('back.posts.create', compact('post'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StorePostRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StorePostRequest $request)
|
||||
{
|
||||
$post = new Post($request->validated());
|
||||
if (is_a($request->picture_home,"SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($request->picture_home, $post->getTable());
|
||||
}
|
||||
if (is_a($request->picture_news,"SplFileInfo")) {
|
||||
$post->picture_news = Utils::storeImage($request->picture_news, $post->getTable());
|
||||
}
|
||||
$response = $this->changeUniquePostOnTop($post->on_top);
|
||||
|
||||
if ($response) {
|
||||
$response = $post->saveOrFail();
|
||||
}
|
||||
if (!$response) {
|
||||
return redirect()->route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
}
|
||||
return redirect()->route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Post $post)
|
||||
{
|
||||
return view('back.posts.edit', compact('post'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\UpdatePostRequest $request
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Post $post, UpdatePostRequest $request)
|
||||
{
|
||||
$post->fill($request->validated());
|
||||
if (is_a($request->picture_home,"SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($request->picture_home, $post->getTable());
|
||||
}
|
||||
if (is_a($request->picture_news,"SplFileInfo")) {
|
||||
$post->picture_news = Utils::storeImage($request->picture_news, $post->getTable());
|
||||
}
|
||||
$response = $this->changeUniquePostOnTop($post->on_top);
|
||||
|
||||
if ($response) {
|
||||
$response = $post->saveOrFail();
|
||||
}
|
||||
if (!$response) {
|
||||
return redirect()->route('bo.posts.edit', $post->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.posts.edit', $post->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Post $post)
|
||||
{
|
||||
if (!$post->delete()) {
|
||||
return redirect()->route('bo.posts.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.posts.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Change on_top column to a post if necessary
|
||||
*
|
||||
* @param Boolean $isCurrentPostOnTop
|
||||
* @return Boolean response
|
||||
*/
|
||||
private function changeUniquePostOnTop(bool $isCurrentPostOnTop): bool
|
||||
{
|
||||
if ($isCurrentPostOnTop) {
|
||||
$postOnTop = Post::where('on_top', true)->first();
|
||||
if ($postOnTop) {
|
||||
$postOnTop->on_top = false;
|
||||
return $postOnTop->saveOrFail();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
231
app/Http/Controllers/Bo/ProductsController.php
Normal file
231
app/Http/Controllers/Bo/ProductsController.php
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreProductRequest;
|
||||
use App\Http\Requests\UpdateProductRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
|
||||
class ProductsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$products = Product::all()->sortBy('name');
|
||||
|
||||
return view('back.products.index', compact('products'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Product $product)
|
||||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
//default structure + produits
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPoele = array(
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/microondes.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlusProduit1 = array(
|
||||
'id' => 0,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
'id' => 1,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
'id' => 2,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$product->pictos = json_encode([$tabFour, $tabFriteuse, $tabPoele, $tabCocotte, $tabPlancha, $tabBainMarie, $tabBarbecue, $tabMicroOndes, $tabCasserole]);
|
||||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
return view('back.products.create', compact('product', 'gammes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreProductRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreProductRequest $request)
|
||||
{
|
||||
$plusproduit = json_decode($request->plusproduit);
|
||||
$product = new Product($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($request->picture, $product->getTable());
|
||||
}
|
||||
|
||||
foreach ($plusproduit as $plus) {
|
||||
$picto = 'pictogramme' . $plus->id;
|
||||
$uploadfile = $request->$picto;
|
||||
if ($uploadfile) {
|
||||
$plus->url = Utils::storeImage($uploadfile, $product->getTable());
|
||||
}
|
||||
}
|
||||
$product->plusproduit = json_encode($plusproduit);
|
||||
|
||||
if (!$product->saveOrFail()) {
|
||||
return redirect()->route(
|
||||
'bo.products.edit',
|
||||
$product->id
|
||||
)->with('error', 'Le produit n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.products.edit', $product->id)->with('success', 'Produit créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Product $product)
|
||||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
return view('back.products.edit', compact('product', 'gammes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param \Illuminate\Http\UpdateProductRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Product $product, UpdateProductRequest $request)
|
||||
{
|
||||
//valeurs en base pour garder les anciennes images quand elles ne sont pas updatées
|
||||
$dbplusproduit = json_decode($product->plusproduit);
|
||||
//valeurs transmises dans le post
|
||||
$plusproduit = json_decode($request->plusproduit);
|
||||
$product->fill($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($request->picture, $product->getTable());
|
||||
}
|
||||
|
||||
foreach ($plusproduit as $plus) {
|
||||
//boucle pour stockage des images uploadées
|
||||
$picto = 'pictogramme' . $plus->id;
|
||||
$uploadfile = $request->$picto;
|
||||
//set de l'url
|
||||
if ($uploadfile) {
|
||||
$plus->url = Utils::storeImage($uploadfile, $product->getTable());
|
||||
} else {
|
||||
if (isset($dbplusproduit[$plus->id])) {
|
||||
//reprise de l'ancienne valeur
|
||||
$plus->url = $dbplusproduit[$plus->id]->url;
|
||||
}
|
||||
}
|
||||
}
|
||||
//encodage avant save
|
||||
$product->plusproduit = json_encode($plusproduit);
|
||||
if (!$product->saveOrFail()) {
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
{
|
||||
if (!$product->delete()) {
|
||||
return redirect()->route('bo.products.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.products.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
91
app/Http/Controllers/Bo/SeoDataController.php
Normal file
91
app/Http/Controllers/Bo/SeoDataController.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreSeoDataRequest;
|
||||
use App\Models\SeoDatum;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SeoDataController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(SeoDatum $SeoDatum)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(SeoDatum $SeoDatum)
|
||||
{
|
||||
return view('back.seo_data.edit', compact('SeoDatum'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(StoreSeoDataRequest $request, SeoDatum $SeoDatum)
|
||||
{
|
||||
$SeoDatum->fill($request->validated());
|
||||
$SeoDatum->save();
|
||||
|
||||
return redirect()->route('bo.seo_data.edit', $SeoDatum->page)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(SeoDatum $SeoDatum)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
111
app/Http/Controllers/Bo/SlidersController.php
Normal file
111
app/Http/Controllers/Bo/SlidersController.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreSliderRequest;
|
||||
use App\Http\Requests\UpdateSliderRequest;
|
||||
use App\Models\Slider;
|
||||
|
||||
class SlidersController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$sliders = Slider::all();
|
||||
|
||||
return view('back.sliders.index', compact('sliders'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(Slider $slider)
|
||||
{
|
||||
return view('back.sliders.create', compact('slider'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreSliderRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSliderRequest $request)
|
||||
{
|
||||
$slider = new Slider($request->validated());
|
||||
|
||||
if (!$slider->saveOrFail()) {
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Slider $slider)
|
||||
{
|
||||
return view('back.sliders.edit', compact('slider'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\UpdateSliderRequest $request
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateSliderRequest $request, Slider $slider)
|
||||
{
|
||||
$slider->fill($request->validated());
|
||||
|
||||
if (!$slider->saveOrFail()) {
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué');
|
||||
}
|
||||
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Slider $slider)
|
||||
{
|
||||
$count = Slider::count();
|
||||
|
||||
if ($count === 1) {
|
||||
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
|
||||
}
|
||||
// @todo : controller les slides liés
|
||||
|
||||
if (!$slider->delete()) {
|
||||
return redirect()->route('bo.sliders.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
return redirect()->route('bo.sliders.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
149
app/Http/Controllers/Bo/SlidesController.php
Normal file
149
app/Http/Controllers/Bo/SlidesController.php
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreSlideRequest;
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Slide;
|
||||
use App\Models\Slider;
|
||||
|
||||
class SlidesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$slides = Slide::orderBy('order', 'ASC')->get();
|
||||
|
||||
return view('back.slides.index', compact('slides'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Slide $slide)
|
||||
{
|
||||
$sliders = Slider::all();
|
||||
return view('back.slides.create', compact('sliders', 'slide'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreSlideRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSlideRequest $request)
|
||||
{
|
||||
|
||||
$slide = new Slide($request->validated());
|
||||
$slide->order = $this->getLastOrder();
|
||||
if (is_a($request->picture,"SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($request->picture, $slide->getTable());
|
||||
}
|
||||
|
||||
$slide->saveOrFail();
|
||||
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Slide $slide)
|
||||
{
|
||||
$sliders = Slider::all();
|
||||
|
||||
return view('back.slides.edit', compact('slide', 'sliders'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreSlideRequest $request
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(StoreSlideRequest $request, Slide $slide)
|
||||
{
|
||||
$slide->fill($request->validated());
|
||||
if (is_a($request->picture,"SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($request->picture, $slide->getTable());
|
||||
}
|
||||
|
||||
if (!$slide->saveOrFail()) {
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Slide $slide)
|
||||
{
|
||||
if (!$slide->delete()) {
|
||||
return redirect()->route('bo.slides.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
public function changeOrder(Slide $slide, $action)
|
||||
{
|
||||
if ($action === 'up') {
|
||||
$tmp = Slide::where('order', '<', $slide->order)->orderBy('order', 'DESC')->first();
|
||||
$newOrder = $tmp->order;
|
||||
$tmp->order = $slide->order;
|
||||
$slide->order = $newOrder;
|
||||
} else {
|
||||
$tmp = Slide::where('order', '>', $slide->order)->orderBy('order', 'ASC')->first();
|
||||
$newOrder = $tmp->order;
|
||||
$tmp->order = $slide->order;
|
||||
$slide->order = $newOrder;
|
||||
}
|
||||
$tmp->save();
|
||||
$slide->save();
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
/**
|
||||
* retreive order position to put a new slide to
|
||||
*/
|
||||
private function getLastOrder()
|
||||
{
|
||||
$order = Slide::select('order')->orderBy('order', 'DESC')->first();
|
||||
if ($order === null) {
|
||||
return 1;
|
||||
}
|
||||
return $order->order + 1;
|
||||
}
|
||||
}
|
||||
103
app/Http/Controllers/Bo/TextsController.php
Normal file
103
app/Http/Controllers/Bo/TextsController.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreTextRequest;
|
||||
use App\Models\Text;
|
||||
|
||||
class TextsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$texts = Text::where('page', Page::newsQuestions()->value)->get();
|
||||
|
||||
return view('back.texts.index', compact('texts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Text $text)
|
||||
{
|
||||
return view('back.texts.create', compact('text'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreTextRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreTextRequest $request)
|
||||
{
|
||||
$text = new Text($request->validated());
|
||||
$text->page = Page::newsQuestions();
|
||||
|
||||
if (!$text->saveOrFail()) {
|
||||
return redirect()
|
||||
->route('bo.texts.edit', $text->id)
|
||||
->with('error', 'La question/réponse n\'a pas été créée');
|
||||
}
|
||||
return redirect()
|
||||
->route('bo.texts.edit', $text->id)
|
||||
->with('success', 'Question/réponse créée !');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Text $text)
|
||||
{
|
||||
return view('back.texts.edit', compact('text'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreTextRequest $request
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Text $text, StoreTextRequest $request)
|
||||
{
|
||||
$text->fill($request->validated());
|
||||
|
||||
if (!$text->saveOrFail()) {
|
||||
return redirect()->route('bo.texts.edit', $text->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.texts.edit', $text->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Text $text)
|
||||
{
|
||||
if (!$text->delete()) {
|
||||
return redirect()->route('bo.texts.content', $text->page)->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.texts.content', $text->page)->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
42
app/Http/Controllers/Bo/TitlesController.php
Normal file
42
app/Http/Controllers/Bo/TitlesController.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UpdateTitleRequest;
|
||||
use App\Models\Title;
|
||||
|
||||
class TitlesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Title $title
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Title $title)
|
||||
{
|
||||
return view('back.titles.edit', compact('title'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Title $title
|
||||
* @param \Illuminate\Http\UpdateTitleRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Title $title, UpdateTitleRequest $request)
|
||||
{
|
||||
$title->fill($request->validated());
|
||||
|
||||
if (!$title->saveOrFail()) {
|
||||
return redirect()->route('bo.titles.edit', $title->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.titles.edit', $title->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
23
app/Http/Controllers/ContactController.php
Normal file
23
app/Http/Controllers/ContactController.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ContactFormRequest;
|
||||
use App\Mail\SendContactMail;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function contact()
|
||||
{
|
||||
return view('front.contact');
|
||||
}
|
||||
|
||||
public function contactSubmit(ContactFormRequest $request)
|
||||
{
|
||||
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($request->validated()));
|
||||
|
||||
$lang = session()->get('lang', config('app.locale'));
|
||||
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")->with('status', true);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,16 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use App\Enums\Country;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
view()->share('availableCountries', Country::toArray());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
app/Http/Controllers/FoodServiceController.php
Normal file
28
app/Http/Controllers/FoodServiceController.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\Encart;
|
||||
use App\Models\Picto;
|
||||
use App\Models\Product;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Title;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FoodServiceController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$page = Page::foodservice();
|
||||
$seoDatum = SeoDatum::where('page',$page)->first();
|
||||
|
||||
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
|
||||
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
|
||||
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
|
||||
$products_food = Product::where('is_food_service', true)->get();
|
||||
|
||||
return view('front.food-service', compact('seoDatum' , 'encart_food', 'title_foodBloc2',
|
||||
'pictos_food', 'products_food'));
|
||||
}
|
||||
}
|
||||
53
app/Http/Controllers/GammesController.php
Normal file
53
app/Http/Controllers/GammesController.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
use App\Models\SeoDatum;
|
||||
|
||||
class GammesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$gammes = Gamme::whereNull('parent_gamme_id')->orderBy('title')->get();
|
||||
//remove Food Service from count
|
||||
/** @var \Illuminate\Database\Eloquent\Collection $gammes */
|
||||
$gammes = $gammes->whereNotIn('slug','food-service');
|
||||
$nb_gammes = $gammes->count();
|
||||
|
||||
$page = Page::gammes();
|
||||
$seoDatum = SeoDatum::where('page',$page)->first();
|
||||
|
||||
return view('front.gammes.index', compact('gammes', 'nb_gammes', 'seoDatum'));
|
||||
}
|
||||
|
||||
public function show(Gamme $gamme)
|
||||
{
|
||||
$gammes = collect([]);
|
||||
$dbGammes = Gamme::where('id', $gamme->id)
|
||||
->with('childGammes')->get();
|
||||
|
||||
/** @var \App\Models\Gamme $dbGamme */
|
||||
foreach ($dbGammes as $dbGamme) {
|
||||
$gammes->push($dbGamme->id);
|
||||
$dbGamme->childGammes->sortBy('title')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
$gammes->push($childGamme->id);
|
||||
});
|
||||
}
|
||||
|
||||
$products = Product::whereIn('gamme_id', $gammes)
|
||||
->where('is_published', 1)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
//make ghost seoDatum from the gamme
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $gamme->title;
|
||||
$seoDatum->description = $gamme->text;
|
||||
|
||||
return view('front.gammes.show', compact('gamme', 'products', 'seoDatum'));
|
||||
}
|
||||
}
|
||||
|
|
@ -2,12 +2,54 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Enums\Page;
|
||||
use App\Models\Encart;
|
||||
use App\Models\Post;
|
||||
use App\Models\Product;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Slide;
|
||||
use App\Models\Slider;
|
||||
use Exception;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
|
||||
$page = Page::home();
|
||||
$seoDatum = SeoDatum::where('page',$page)->first();
|
||||
|
||||
$slider = Slider::where('published', 1)->first();
|
||||
if ($slider) {
|
||||
$slides = Slide::whereHas('slider', function ($q) use ($slider) {
|
||||
$q->whereId($slider->id);
|
||||
})->where(function ($q) {
|
||||
$q->where(
|
||||
function ($q) {
|
||||
$q->where('date_start', '<=', Carbon::now()->format('Y-m-d H:i:s'))
|
||||
->where('date_end', '>', Carbon::now()->format('Y-m-d H:i:s'));
|
||||
}
|
||||
)->orWhere(function ($q) {
|
||||
$q->whereNull('date_start')
|
||||
->whereNull('date_end');
|
||||
});
|
||||
})->orderBy('order', 'ASC')
|
||||
->get();
|
||||
} else {
|
||||
$slides = null;
|
||||
}
|
||||
|
||||
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
|
||||
|
||||
$post_home = Post::where([
|
||||
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['on_top', true]
|
||||
])->first();
|
||||
// Limitation à 3 produits affichés sur la homepage
|
||||
$products_home = Product::where('is_on_top', true)->take(3)->get();
|
||||
|
||||
return view('front.home', compact('slider', 'slides', 'seoDatum', 'encart_home', 'post_home', 'products_home'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
app/Http/Controllers/LegalsController.php
Normal file
22
app/Http/Controllers/LegalsController.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Text;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LegalsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$mentions_legales = Text::where('page', Page::mentions()->value)->first();
|
||||
|
||||
//make ghost seoDatum from the gamme
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $mentions_legales->title;
|
||||
|
||||
return view('front.legals', compact('seoDatum' ,'mentions_legales'));
|
||||
}
|
||||
}
|
||||
36
app/Http/Controllers/MarqueController.php
Normal file
36
app/Http/Controllers/MarqueController.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\Encart;
|
||||
use App\Models\Moment;
|
||||
use App\Models\Picto;
|
||||
use App\Models\PictoBrand;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Title;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MarqueController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$page = Page::marque();
|
||||
$seoDatum = SeoDatum::where('page',$page)->first();
|
||||
|
||||
$encart_marqueHeader = Encart::where('page', Page::marqueHeader()->value)->first();
|
||||
$encart_marqueBloc4l = Encart::where('page', Page::marqueBloc4l()->value)->first();
|
||||
$encart_marqueBloc4r = Encart::where('page', Page::marqueBloc4r()->value)->first();
|
||||
$encart_marqueFooter = Encart::where('page', Page::marqueFooter()->value)->first();
|
||||
|
||||
$pictobrands_marque = PictoBrand::all();
|
||||
$pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get();
|
||||
$title_marqueBloc2 = Title::where('page', Page::marqueBloc2()->value)->first();
|
||||
$title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first();
|
||||
$moments = Moment::where('page', Page::marqueHistory()->value)->get();
|
||||
|
||||
return view('front.a-propos', compact('seoDatum', 'encart_marqueHeader', 'encart_marqueBloc4l',
|
||||
'encart_marqueBloc4r', 'encart_marqueFooter', 'pictobrands_marque', 'title_marqueBloc2',
|
||||
'pictos_marqueBloc2', 'moments', 'title_marqueBloc4'));
|
||||
}
|
||||
}
|
||||
37
app/Http/Controllers/NewsController.php
Normal file
37
app/Http/Controllers/NewsController.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\Advice;
|
||||
use App\Models\Post;
|
||||
use App\Models\Product;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Text;
|
||||
use App\Models\Title;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$page = Page::news();
|
||||
$seoDatum = SeoDatum::where('page',$page)->first();
|
||||
|
||||
$advice_news = Advice::all()->first();
|
||||
$texts_news = Text::where('page', Page::newsQuestions()->value)->get();
|
||||
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
|
||||
|
||||
$posts = Post::where([
|
||||
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
])
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
$products_news = Product::where('is_news', true)->get();
|
||||
|
||||
return view('front.news', compact('seoDatum', 'advice_news' , 'texts_news', 'title_newsPosts', 'posts', 'products_news'));
|
||||
}
|
||||
}
|
||||
22
app/Http/Controllers/PolicyController.php
Normal file
22
app/Http/Controllers/PolicyController.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\SeoDatum;
|
||||
use App\Models\Text;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PolicyController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$privacy_policy = Text::where('page', Page::charte()->value)->first();
|
||||
|
||||
//make ghost seoDatum from the gamme
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $privacy_policy->title;
|
||||
|
||||
return view('front.policy', compact('seoDatum', 'privacy_policy'));
|
||||
}
|
||||
}
|
||||
44
app/Http/Controllers/ProductsController.php
Normal file
44
app/Http/Controllers/ProductsController.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
use App\Models\SeoDatum;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductsController extends Controller
|
||||
{
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
public function show(Gamme $gamme, Product $product)
|
||||
{
|
||||
//$product = Product::whereSlug($product->slug)->first();
|
||||
//dd($product);
|
||||
|
||||
//make ghost seoDatum from the gamme
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $product->name;
|
||||
$seoDatum->description = $product->description;
|
||||
|
||||
return view('front.product', compact('product', 'gamme', 'seoDatum'));
|
||||
}
|
||||
|
||||
public function search(Request $request) {
|
||||
$filter = $request->query('filter');
|
||||
|
||||
if (!empty($filter)) {
|
||||
$products = Product::where('is_published', 1)
|
||||
->where('name', 'like', '%' . $filter . '%')
|
||||
->get();
|
||||
//->paginate(12);
|
||||
} else {
|
||||
$products = Product::where('is_published', 1)
|
||||
->get();
|
||||
//->paginate(12);
|
||||
}
|
||||
|
||||
$search_title = 'Recherche : ' . $filter;
|
||||
|
||||
return view('front.search', compact('products', 'search_title', 'filter'));
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/TranslationController.php
Normal file
29
app/Http/Controllers/TranslationController.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Lang;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
|
||||
class TranslationController extends Controller
|
||||
{
|
||||
public function switch($locale)
|
||||
{
|
||||
if (! in_array($locale, Lang::toValues())) {
|
||||
abort(400);
|
||||
}
|
||||
|
||||
// Save in DB
|
||||
// $user = Auth::user();
|
||||
// $user->lang = $locale;
|
||||
// $user->save();
|
||||
|
||||
Cookie::queue(Cookie::forever('language', $locale));
|
||||
|
||||
if (url()->full() !== url()->previous()) {
|
||||
return redirect()->back();
|
||||
}
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Http\Middleware\BackEndGlobals;
|
||||
use App\Http\Middleware\FrontEndGlobals;
|
||||
use App\Http\Middleware\LangCheck;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
|
|
@ -14,7 +18,6 @@ class Kernel extends HttpKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
|
|
@ -33,14 +36,12 @@ class Kernel extends HttpKernel
|
|||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
|
@ -63,6 +64,8 @@ class Kernel extends HttpKernel
|
|||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
|
||||
'lang-check' => LangCheck::class,
|
||||
'front-end-globals' => FrontEndGlobals::class,
|
||||
'back-end-globals' => BackEndGlobals::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Middleware pour l'auth
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
* phpcs:ignore PEAR.Commenting.FileComment.MissingVersion
|
||||
*/
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
*/
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request La requête
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
if (!$request->expectsJson()) {
|
||||
return route('bo.login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
70
app/Http/Middleware/BackEndGlobals.php
Normal file
70
app/Http/Middleware/BackEndGlobals.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Models\Advice;
|
||||
use App\Models\Encart;
|
||||
use App\Models\Picto;
|
||||
use App\Models\Text;
|
||||
use App\Models\Title;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BackEndGlobals
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
|
||||
$encart_marqueHeader = Encart::where('page', Page::marqueHeader()->value)->first();
|
||||
$encart_marqueBloc4l = Encart::where('page', Page::marqueBloc4l()->value)->first();
|
||||
$encart_marqueBloc4r = Encart::where('page', Page::marqueBloc4r()->value)->first();
|
||||
$encart_marqueFooter = Encart::where('page', Page::marqueFooter()->value)->first();
|
||||
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
|
||||
$mentions_legales = Text::where('page', Page::mentions()->value)->first();
|
||||
$privacy_policy = Text::where('page', Page::charte()->value)->first();
|
||||
|
||||
$advice_news = Advice::all()->first();
|
||||
|
||||
$pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get();
|
||||
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
|
||||
|
||||
$texts_news = Text::where('page', Page::newsQuestions()->value)->get();
|
||||
|
||||
$title_marqueBloc2 = Title::where('page', Page::marqueBloc2()->value)->first();
|
||||
$title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first();
|
||||
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
|
||||
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
|
||||
|
||||
View::share('encart_home', $encart_home);
|
||||
View::share('encart_marqueHeader', $encart_marqueHeader);
|
||||
View::share('encart_marqueBloc4l', $encart_marqueBloc4l);
|
||||
View::share('encart_marqueBloc4r', $encart_marqueBloc4r);
|
||||
View::share('encart_marqueFooter', $encart_marqueFooter);
|
||||
View::share('encart_food', $encart_food);
|
||||
View::share('advice_news', $advice_news);
|
||||
|
||||
View::share('pictos_marqueBloc2', $pictos_marqueBloc2);
|
||||
View::share('pictos_food', $pictos_food);
|
||||
|
||||
View::share('texts_news', $texts_news);
|
||||
|
||||
View::share('title_marqueBloc2', $title_marqueBloc2);
|
||||
View::share('title_marqueBloc4', $title_marqueBloc4);
|
||||
View::share('title_foodBloc2', $title_foodBloc2);
|
||||
View::share('title_newsPosts', $title_newsPosts);
|
||||
|
||||
View::share('mentions_legales', $mentions_legales);
|
||||
View::share('privacy_policy', $privacy_policy);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
54
app/Http/Middleware/FrontEndGlobals.php
Normal file
54
app/Http/Middleware/FrontEndGlobals.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class FrontEndGlobals
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
//header menu
|
||||
$currentRoute = Route::current()->getName();
|
||||
$routeParamsFR = Route::current()->parameters();
|
||||
$routeParamsEN = $routeParamsFR;
|
||||
$routeParamsES = $routeParamsFR;
|
||||
array_walk($routeParamsFR, array($this, 'unbind'),'');
|
||||
array_walk($routeParamsEN, array($this, 'unbind'),'en');
|
||||
array_walk($routeParamsES, array($this, 'unbind'),'es');
|
||||
if (preg_match('/^(en|es)/', $currentRoute )) {
|
||||
$currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute,1);
|
||||
$currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute,1);
|
||||
$currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute,1);
|
||||
} else {
|
||||
$currentRouteFR = $currentRoute;
|
||||
$currentRouteEN = 'en.'.$currentRoute;
|
||||
$currentRouteES = 'es.'.$currentRoute;
|
||||
}
|
||||
|
||||
View::share('currentRouteFR', $currentRouteFR);
|
||||
View::share('currentRouteEN', $currentRouteEN);
|
||||
View::share('currentRouteES', $currentRouteES);
|
||||
View::share('routeParamsFR', $routeParamsFR);
|
||||
View::share('routeParamsEN', $routeParamsEN);
|
||||
View::share('routeParamsES', $routeParamsES);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
public function unbind(&$item,$k,$lang) {
|
||||
if($k=='gammeSlug' || $k=='productSlug') {
|
||||
$item = $item->getTranslation('slug', $lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
111
app/Http/Middleware/LangCheck.php
Normal file
111
app/Http/Middleware/LangCheck.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class LangCheck
|
||||
{
|
||||
|
||||
protected $langs = ['fr','en','es'];
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
|
||||
$routName = $request->route()->getName();
|
||||
if (preg_match('/^bo\./', $routName)) {
|
||||
//Back office
|
||||
if ($request->lang) {
|
||||
//within bo we set lang with querystring param
|
||||
$this->saveUserLocale($request->lang, $request);
|
||||
//bonus remove lang parameter from query
|
||||
return redirect()->to($request->fullUrlWithoutQuery('lang'));
|
||||
} else {
|
||||
$this->checkFirstAccess($request);
|
||||
}
|
||||
} else {
|
||||
//FRONT
|
||||
if (preg_match('/^(en|es)\./', $routName)) {
|
||||
//from front use named routes
|
||||
$langset = $request->segment(1);
|
||||
|
||||
$this->saveUserLocale($langset, $request);
|
||||
} else {
|
||||
//not specified in route
|
||||
if ($this->checkFirstAccess($request)) {
|
||||
$routNameEN = 'en.' . $routName;
|
||||
$routNameES = 'es.' . $routName;
|
||||
$sess_lang = $request->session()->get('lang', config('app.locale'));
|
||||
switch ($sess_lang) {
|
||||
case 'en':
|
||||
return redirect()->route($routNameEN);
|
||||
case 'es':
|
||||
return redirect()->route($routNameES);
|
||||
}
|
||||
}
|
||||
|
||||
$langset = 'fr';
|
||||
$this->saveUserLocale($langset, $request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$sess_lang = $request->session()->get('lang', config('app.locale'));
|
||||
app()->setLocale($sess_lang);
|
||||
$routePrefixer = "";
|
||||
if($sess_lang != 'fr') {
|
||||
$routePrefixer = $sess_lang . '.';
|
||||
}
|
||||
View::share('routeprefixer', $routePrefixer);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function saveUserLocale($lang, Request $request)
|
||||
{
|
||||
//Set cookie
|
||||
Cookie::queue(Cookie::forever('language', strtolower($lang)));
|
||||
//set session
|
||||
$request->session()->put('lang', strtolower($lang));
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if we have saved locale info for current user
|
||||
* if not find then save that locale
|
||||
* @return boolean
|
||||
*/
|
||||
private function checkFirstAccess(Request $request)
|
||||
{
|
||||
//do we have session ?
|
||||
if (!$request->session()->has('lang')) {
|
||||
$fromC = Cookie::get('language');
|
||||
if (is_null($fromC) || empty($fromC)) {
|
||||
//pas de cookie, recherche sur le navigateur
|
||||
$fromC = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2);
|
||||
if (!in_array($fromC, $this->langs)) {
|
||||
//default other languages to en
|
||||
$fromC = 'en';
|
||||
}
|
||||
}
|
||||
$this->saveUserLocale($fromC, $request);
|
||||
return true;
|
||||
}
|
||||
//we have lang session
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
62
app/Http/Requests/ContactFormRequest.php
Normal file
62
app/Http/Requests/ContactFormRequest.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ContactFormRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'civilite' => 'required|in:monsieur,madame',
|
||||
'name' => 'required|min:2',
|
||||
'lastname' => 'required|min:2',
|
||||
'address' => 'required|max:255',
|
||||
'postcode' => 'required',
|
||||
'city' => 'required|string|max:255',
|
||||
'phone' => 'required|max:255',
|
||||
'email' => 'required|email:rfc,dns,spoof|max:255',
|
||||
'country' => 'required|string|max:255',
|
||||
'departement' => 'required_if:country,France|max:255',
|
||||
'topic' => 'required',
|
||||
'product_name' => 'required_if:topic,Réclamation|max:255',
|
||||
'barcode' => 'required_if:topic,Réclamation|max:128',
|
||||
'shop' => 'required_if:topic,Réclamation|max:255',
|
||||
'lot' => 'required_if:topic,Réclamation|max:255',
|
||||
'limit_date' => 'required_if:topic,Réclamation|date|nullable',
|
||||
'consumption_date' => 'required_if:topic,Réclamation|date|nullable',
|
||||
'message' => 'required|min:25',
|
||||
'file' => 'nullable|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error messages for the defined validation rules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'topic.required' => __('Veuille préciser la nature de votre demande.'),
|
||||
'file.max' => __('La taille du fichier ne peut pas dépasser :max kilo-octets.'),
|
||||
'file.mimes' => __('Le fichier doit être de type : :values.'),
|
||||
];
|
||||
}
|
||||
}
|
||||
66
app/Http/Requests/StoreGammeRequest.php
Normal file
66
app/Http/Requests/StoreGammeRequest.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StoreGammeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->title),
|
||||
'parent_gamme_id' => $this->parent_gamme_id === '0' ? null : $this->parent_gamme_id,
|
||||
]);
|
||||
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'parent_gamme_id' => 'sometimes|nullable|exists:gammes,id',
|
||||
'title' => 'required|string|max:255',
|
||||
'slug' => 'required|unique:gammes',
|
||||
'text' => 'required|string|max:255',
|
||||
'color' => 'sometimes',
|
||||
'picture' => 'required|image|mimes:jpeg,png,jpg|max:1024|dimensions:width=575,height=375',
|
||||
'alt_text_picture' => 'required|string|max:255',
|
||||
'banner' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1920,height=568',
|
||||
'alt_text_banner' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'slug' => trans('Nom')
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Requests/StorePictoBrandRequest.php
Normal file
33
app/Http/Requests/StorePictoBrandRequest.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePictoBrandRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:50',
|
||||
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:512|dimensions:max_width=150,max_height=150',
|
||||
'alt_text_picture' => 'required|max:255',
|
||||
'text' => 'required|max:127',
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/StorePictoRequest.php
Normal file
32
app/Http/Requests/StorePictoRequest.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePictoRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'picture' => 'sometimes|image|mimes:png|max:512|dimensions:max_width=150,max_height=150',
|
||||
'alt_text_picture' => 'required|max:255',
|
||||
'text' => 'required|max:50',
|
||||
];
|
||||
}
|
||||
}
|
||||
60
app/Http/Requests/StorePostRequest.php
Normal file
60
app/Http/Requests/StorePostRequest.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class StorePostRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
try {
|
||||
$this->merge([
|
||||
'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
|
||||
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
'on_top' => $this->on_top ? true : false,
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
}
|
||||
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'picture_news' => 'required|image|mimes:jpeg,png,jpg|max:1024|dimensions:max_width=380,max_height=298',
|
||||
'alt_text_picture_news' => 'required|max:255',
|
||||
'title' => 'required|max:255',
|
||||
'text' => 'required|min:20',
|
||||
'date_start' => [
|
||||
'required',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
],
|
||||
'date_end' => [
|
||||
'required',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'after:date_start',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
],
|
||||
'picture_home' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=1030,max_height=239',
|
||||
'alt_text_picture_home' => 'required|max:255',
|
||||
'on_top' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
213
app/Http/Requests/StoreProductRequest.php
Normal file
213
app/Http/Requests/StoreProductRequest.php
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Gamme;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StoreProductRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
try {
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => $this->time_cook0,
|
||||
'temp' => $this->temp_cook0,
|
||||
'status' => $this->is_activated0 ? true : false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => $this->time_cook1,
|
||||
'temp' => $this->temp_cook1,
|
||||
'status' => $this->is_activated1 ? true : false
|
||||
);
|
||||
$tabPoele = array(
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => $this->time_cook2,
|
||||
'temp' => $this->temp_cook2,
|
||||
'status' => $this->is_activated2 ? true : false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => $this->time_cook3,
|
||||
'temp' => $this->temp_cook3,
|
||||
'status' => $this->is_activated3 ? true : false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => $this->time_cook4,
|
||||
'temp' => $this->temp_cook4,
|
||||
'status' => $this->is_activated4 ? true : false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => $this->time_cook5,
|
||||
'temp' => $this->temp_cook5,
|
||||
'status' => $this->is_activated5 ? true : false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => $this->time_cook6,
|
||||
'temp' => $this->temp_cook6,
|
||||
'status' => $this->is_activated6 ? true : false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/micro-onde.png',
|
||||
'time' => $this->time_cook7,
|
||||
'temp' => $this->temp_cook7,
|
||||
'status' => $this->is_activated7 ? true : false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => $this->time_cook8,
|
||||
'temp' => $this->temp_cook8,
|
||||
'status' => $this->is_activated8 ? true : false
|
||||
);
|
||||
$tabCuisson = json_encode([
|
||||
'four' => $tabFour,
|
||||
'friteuse' => $tabFriteuse,
|
||||
'poele' => $tabPoele,
|
||||
'cocotte' => $tabCocotte,
|
||||
'plancha' => $tabPlancha,
|
||||
'bainmarie' => $tabBainMarie,
|
||||
'barbecue' => $tabBarbecue,
|
||||
'microondes' => $tabMicroOndes,
|
||||
'casserole' => $tabCasserole
|
||||
]);
|
||||
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme0) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit1 = array(
|
||||
'id' => 0,
|
||||
'name' => $this->content0,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme1) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit2 = array(
|
||||
'id' => 1,
|
||||
'name' => $this->content1,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme2) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit3 = array(
|
||||
'id' => 2,
|
||||
'name' => $this->content2,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
'gamme_id' =>
|
||||
$this->is_food_service ?
|
||||
Gamme::where("slug->fr", "food-service")->firstOrFail()->id :
|
||||
$this->gamme_id,
|
||||
'pictos' => $tabCuisson,
|
||||
'plusproduit' => $tabPlusProduit,
|
||||
'is_published' => $this->is_published ? true : false,
|
||||
'is_on_top' => $this->is_on_top ? true : false,
|
||||
'is_news' => $this->is_news ? true : false,
|
||||
'is_food_service' => $this->is_food_service ? true : false,
|
||||
'is_halal' => $this->is_halal ? true : false,
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'gamme_id' => 'required|exists:gammes,id',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|unique:products',
|
||||
'description' => 'required|min:20',
|
||||
'picture' => 'required|image|mimes:png|max:1024|dimensions:width=509,height=509',
|
||||
'alt_text_picture' => 'required|max:255',
|
||||
'pictos' => 'sometimes|nullable',
|
||||
'plusproduit' => 'sometimes|nullable',
|
||||
'pictogramme0' => 'nullable|image|mimes:png|max:1024|dimensions:width=141,height=100',
|
||||
'pictogramme1' => 'nullable|image|mimes:png|max:1024|dimensions:width=141,height=100',
|
||||
'pictogramme2' => 'nullable|image|mimes:png|max:1024|dimensions:width=141,height=100',
|
||||
'is_published' => 'nullable|boolean',
|
||||
'is_on_top' => 'nullable|boolean',
|
||||
'is_news' => 'nullable|boolean',
|
||||
'is_food_service' => 'nullable|boolean',
|
||||
'is_halal' => 'nullable|boolean',
|
||||
// 'seo_title' => 'required|max:255',
|
||||
// 'seo_description' => 'required|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'slug' => trans('libellé')
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/StoreSeoDataRequest.php
Normal file
32
app/Http/Requests/StoreSeoDataRequest.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreSeoDataRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:255',
|
||||
'description' => 'sometimes|max:255',
|
||||
'keywords' => 'sometimes|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
73
app/Http/Requests/StoreSlideRequest.php
Normal file
73
app/Http/Requests/StoreSlideRequest.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class StoreSlideRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
try {
|
||||
$this->merge([
|
||||
'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
|
||||
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
}
|
||||
$this->merge([
|
||||
'title' => 'lorem title ' . rand(),
|
||||
'text' => 'lorem text ' . rand(),
|
||||
'link_new_tab' => $this->link_new_tab ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:255',
|
||||
'text' => 'sometimes|max:255',
|
||||
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1920,height=812',
|
||||
'alt_text_picture' => 'sometimes|max:255',
|
||||
'link_label' => 'sometimes|max:255',
|
||||
'link' => 'sometimes|max:255',
|
||||
'link_new_tab' => 'required|boolean',
|
||||
'slider_id' => 'required|exists:sliders,id',
|
||||
'date_start' => [
|
||||
'nullable',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
],
|
||||
'date_end' => [
|
||||
'nullable',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'after:date_start',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
61
app/Http/Requests/StoreSliderRequest.php
Normal file
61
app/Http/Requests/StoreSliderRequest.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StoreSliderRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->label),
|
||||
'published' => $this->published ? true : false
|
||||
]);
|
||||
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'label' => 'required|string|max:255',
|
||||
'slug' => 'required|unique:sliders',
|
||||
'commentaire' => 'sometimes|max:255',
|
||||
'published' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'slug' => trans('label')
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/StoreTextRequest.php
Normal file
31
app/Http/Requests/StoreTextRequest.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreTextRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:255',
|
||||
'text' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
39
app/Http/Requests/UpdateAdviceRequest.php
Normal file
39
app/Http/Requests/UpdateAdviceRequest.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateAdviceRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title1' => 'required|max:50',
|
||||
'title2' => 'required|max:50',
|
||||
'picture1' => 'sometimes|image|mimes:jpeg,png,jpg|max:1024|dimensions:width=284,height=284',
|
||||
'alt_text_picture1' => 'required|max:255',
|
||||
'picture2' => 'sometimes|image|mimes:jpeg,png,jpg|max:1024|dimensions:width=284,height=284',
|
||||
'alt_text_picture2' => 'required|max:255',
|
||||
'picture3' => 'sometimes|image|mimes:jpeg,png,jpg|max:1024|dimensions:width=284,height=284',
|
||||
'alt_text_picture3' => 'required|max:255',
|
||||
'text1' => 'required|max:2047',
|
||||
'text2' => 'required|max:2047',
|
||||
];
|
||||
}
|
||||
}
|
||||
38
app/Http/Requests/UpdateEncartRequest.php
Normal file
38
app/Http/Requests/UpdateEncartRequest.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateEncartRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:255',
|
||||
'subtitle' => 'sometimes|max:255',
|
||||
// TODO 'subtitle' => [
|
||||
// Rule::requiredIf(), 'max:255'
|
||||
// 'required|max:255'
|
||||
// ],
|
||||
'text' => 'required|max:2047',
|
||||
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048',
|
||||
'alt_text_picture' => 'sometimes|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
35
app/Http/Requests/UpdateGammeRequest.php
Normal file
35
app/Http/Requests/UpdateGammeRequest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateGammeRequest extends StoreGammeRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
'slug' => 'required|unique:gammes,slug,' . $this->gamme->id,
|
||||
'picture' => [
|
||||
'sometimes',
|
||||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:1024',
|
||||
'dimensions:width=575,height=375'
|
||||
],
|
||||
'banner' => [
|
||||
'sometimes',
|
||||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
'dimensions:width=1920,height=568'
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
34
app/Http/Requests/UpdateMomentRequest.php
Normal file
34
app/Http/Requests/UpdateMomentRequest.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateMomentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:255',
|
||||
'subtitle' => 'sometimes|max:255',
|
||||
'text' => 'required|max:2047',
|
||||
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048',
|
||||
'alt_text_picture' => 'sometimes|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
34
app/Http/Requests/UpdatePostRequest.php
Normal file
34
app/Http/Requests/UpdatePostRequest.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdatePostRequest extends StorePostRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
'picture_news' => [
|
||||
'sometimes',
|
||||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:1024',
|
||||
'dimensions:max_width=380,max_height=298'
|
||||
],
|
||||
'picture_home' => [
|
||||
'sometimes',
|
||||
'image',
|
||||
'mimes:jpeg,png,jpg',
|
||||
'max:2048',
|
||||
'dimensions:max_width=1030,max_height=239'
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
28
app/Http/Requests/UpdateProductRequest.php
Normal file
28
app/Http/Requests/UpdateProductRequest.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateProductRequest extends StoreProductRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
'slug' => 'required|unique:products,slug,' . $this->product->id,
|
||||
'picture' => [
|
||||
'sometimes',
|
||||
'image',
|
||||
'mimes:png',
|
||||
'max:1024',
|
||||
'dimensions:width=509,height=509'
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/UpdateSliderRequest.php
Normal file
21
app/Http/Requests/UpdateSliderRequest.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateSliderRequest extends StoreSliderRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
'slug' => 'required|unique:sliders,slug,' . $this->slider->id
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/UpdateTitleRequest.php
Normal file
31
app/Http/Requests/UpdateTitleRequest.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateTitleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required|max:50',
|
||||
'text' => 'sometimes:|max:2047',
|
||||
];
|
||||
}
|
||||
}
|
||||
67
app/Lib/Utils.php
Normal file
67
app/Lib/Utils.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use SplFileInfo;
|
||||
/**
|
||||
* Some utilities methods
|
||||
*
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* Store an image for a model
|
||||
* if a string is passed then the store action is ignored and the strieng is returned
|
||||
*
|
||||
* @param \Illuminate\Http\UploadedFile|\SplFileInfo|string $image
|
||||
* @param string $folderName
|
||||
* @return string The storage path
|
||||
*/
|
||||
public static function storeImage($image, string $folderName): string
|
||||
{
|
||||
if (\is_object($image) and get_class($image) === UploadedFile::class) {
|
||||
/** @var UploadedFile */
|
||||
$image = $image;
|
||||
$newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName);
|
||||
$newPath = str_replace(storage_path('app'), '', $newPath);
|
||||
$image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME));
|
||||
return '/storage' . str_replace('/public', '', $newPath);
|
||||
}
|
||||
if (\is_object($image) and get_class($image) === SplFileInfo::class) {
|
||||
/** @var SplFileInfo */
|
||||
$image = $image;
|
||||
$newPath = self::prepareMoveFile($image->getBaseName(), $folderName);
|
||||
if (!File::copy($image->getRealPath(), $newPath)) {
|
||||
throw new \Exception(sprintf(
|
||||
'Failed to copy file %s to %s',
|
||||
$image->getRealPath(),
|
||||
$newPath
|
||||
));
|
||||
}
|
||||
return str_replace(\storage_path('app/public'), '/storage', $newPath);
|
||||
}
|
||||
if (\is_string($image)) {
|
||||
return $image;
|
||||
}
|
||||
throw new Exception(sprintf('Cannot handle image %s', \gettype($image)));
|
||||
}
|
||||
private static function prepareMoveFile(string $filename, string $folderName): string
|
||||
{
|
||||
$pathFolder = \storage_path("app/public/images/$folderName");
|
||||
if (!File::exists($pathFolder)) {
|
||||
File::makeDirectory($pathFolder, 0755, true);
|
||||
}
|
||||
$filename = sprintf('%s-%s', Str::uuid(), $filename);
|
||||
$fullPath = sprintf('%s/%s', $pathFolder, $filename);
|
||||
if (File::exists($fullPath)) {
|
||||
File::delete($fullPath);
|
||||
}
|
||||
return $fullPath;
|
||||
}
|
||||
}
|
||||
101
app/Mail/SendContactMail.php
Normal file
101
app/Mail/SendContactMail.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sender pour le contact
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
* phpcs:ignore PEAR.Commenting.FileComment.MissingVersion
|
||||
*/
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
*
|
||||
* @category Description
|
||||
* @package Category
|
||||
* @author Name <email@email.com>
|
||||
* @license http://url.com MIT
|
||||
* @link http://url.com
|
||||
*/
|
||||
class SendContactMail extends Mailable
|
||||
{
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The form data.
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* The joined file name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $joinedFileName;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$data = $this->data;
|
||||
$this->joinFileIfProvided();
|
||||
|
||||
return $this->subject(
|
||||
"Contact - " .
|
||||
config('app.name', 'Doux') .
|
||||
" - " .
|
||||
$data['topic']
|
||||
)
|
||||
->from($data['email'])
|
||||
->view('emails.send-contact', compact('data'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attach a joined file if given in data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function joinFileIfProvided(): void
|
||||
{
|
||||
if (isset($this->data['file'])) {
|
||||
$this->joinedFileName = sprintf(
|
||||
'Doux_MESSAGE-PJ-%s.%s',
|
||||
date("YmdHis"),
|
||||
$this->data['file']->extension()
|
||||
);
|
||||
$this->attach(
|
||||
$this->data['file'],
|
||||
[
|
||||
'as' => $this->joinedFileName,
|
||||
'mime' => $this->data['file']->getMimeType()
|
||||
]
|
||||
);
|
||||
$this->data['file'] = $this->joinedFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
96
app/Models/Advice.php
Normal file
96
app/Models/Advice.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Advice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'title1',
|
||||
'title2',
|
||||
'picture1',
|
||||
'alt_text_picture1',
|
||||
'picture2',
|
||||
'alt_text_picture2',
|
||||
'picture3',
|
||||
'alt_text_picture3',
|
||||
'text1',
|
||||
'text2',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title1',
|
||||
'title2',
|
||||
'picture1',
|
||||
'alt_text_picture1',
|
||||
'picture2',
|
||||
'alt_text_picture2',
|
||||
'picture3',
|
||||
'alt_text_picture3',
|
||||
'text1',
|
||||
'text2',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Advice $advice) {
|
||||
if (is_a($advice->picture1,"SplFileInfo")) {
|
||||
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
|
||||
}
|
||||
if (is_a($advice->picture2,"SplFileInfo")) {
|
||||
$advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable());
|
||||
}
|
||||
if (is_a($advice->picture3,"SplFileInfo")) {
|
||||
$advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Advice $advice) {
|
||||
if (is_a($advice->picture1,"SplFileInfo")) {
|
||||
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
|
||||
}
|
||||
if (is_a($advice->picture2,"SplFileInfo")) {
|
||||
$advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable());
|
||||
}
|
||||
if (is_a($advice->picture3,"SplFileInfo")) {
|
||||
$advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Advice $advice) {
|
||||
if ($advice->picture1) {
|
||||
$urlPicture = public_path() . $advice->picture1;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($advice->picture2) {
|
||||
$urlPicture = public_path() . $advice->picture2;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($advice->picture3) {
|
||||
$urlPicture = public_path() . $advice->picture3;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
63
app/Models/Encart.php
Normal file
63
app/Models/Encart.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Lib\Utils;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Encart extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
'text',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
'text',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Encart $encart) {
|
||||
if (is_a($encart->picture,"SplFileInfo")) {
|
||||
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Encart $encart) {
|
||||
if (is_a($encart->picture,"SplFileInfo")) {
|
||||
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Encart $encart) {
|
||||
if ($encart->picture) {
|
||||
$urlPicture = public_path() . $encart->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
140
app/Models/Gamme.php
Normal file
140
app/Models/Gamme.php
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Gamme extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'parent_gamme_id',
|
||||
'title',
|
||||
'slug',
|
||||
'text',
|
||||
'color',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'banner',
|
||||
'alt_text_banner',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'slug',
|
||||
'text',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'banner',
|
||||
'alt_text_banner',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Gamme $gamme) {
|
||||
if (is_a($gamme->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
|
||||
}
|
||||
if (is_a($gamme->banner, "SplFileInfo")) {
|
||||
$gamme->banner = Utils::storeImage($gamme->banner, $gamme->getTable());
|
||||
}
|
||||
|
||||
if ($gamme->parent_gamme_id != null) {
|
||||
// Si Creation gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent
|
||||
$gamme->color = Gamme::whereId($gamme->parent_gamme_id)->select(['color'])->first()->color;
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Gamme $gamme) {
|
||||
if (is_a($gamme->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
|
||||
}
|
||||
if (is_a($gamme->banner, "SplFileInfo")) {
|
||||
$gamme->banner = Utils::storeImage($gamme->banner, $gamme->getTable());
|
||||
}
|
||||
if ($gamme->parent_gamme_id === null) {
|
||||
// Si Update gamme parente, alors il faut update la couleur des enfants
|
||||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['color' => $gamme->color]);
|
||||
} elseif ($gamme->childGammes()->exists()) {
|
||||
/**
|
||||
* Si Update gamme enfant qui a des enfants,
|
||||
* alors il faut update sa couleur selon celle du parent
|
||||
* et vider l'association parent/enfant des petits enfants
|
||||
*/
|
||||
$gamme->color = Gamme::whereId($gamme->parent_gamme_id)->select(['color'])->first()->color;
|
||||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['parent_gamme_id' => null]);
|
||||
} else {
|
||||
// Si Update gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent
|
||||
$gamme->color = Gamme::whereId($gamme->parent_gamme_id)->select(['color'])->first()->color;
|
||||
}
|
||||
});
|
||||
|
||||
static::deleting(function (Gamme $gamme) {
|
||||
if ($gamme->childGammes()->exists()) {
|
||||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['parent_gamme_id' => null]);
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Gamme $gamme) {
|
||||
if ($gamme->picture) {
|
||||
$urlPicture = public_path() . $gamme->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($gamme->banner) {
|
||||
$urlPicture = public_path() . $gamme->banner;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function getRgbaColorAttribute()
|
||||
{
|
||||
$color = $this->color;
|
||||
|
||||
if (!$color) {
|
||||
return '';
|
||||
}
|
||||
if ($color[0] == '#') {
|
||||
$color = substr($color, 1);
|
||||
}
|
||||
list($r, $g, $b) = array_map("hexdec", str_split($color, (strlen($color) / 3)));
|
||||
|
||||
return "rgba($r,$g,$b,1)";
|
||||
}
|
||||
|
||||
public function childGammes()
|
||||
{
|
||||
return $this->hasMany(Gamme::class, 'parent_gamme_id');
|
||||
}
|
||||
|
||||
public function parentGamme()
|
||||
{
|
||||
return $this->belongsTo(Gamme::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Products for the Range.
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
}
|
||||
63
app/Models/Moment.php
Normal file
63
app/Models/Moment.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Lib\Utils;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Moment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
'text',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
'text',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Moment $moment) {
|
||||
if (is_a($moment->picture, "SplFileInfo")) {
|
||||
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Moment $moment) {
|
||||
if (is_a($moment->picture, "SplFileInfo")) {
|
||||
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Moment $moment) {
|
||||
if ($moment->picture) {
|
||||
$urlPicture = public_path() . $moment->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
59
app/Models/Picto.php
Normal file
59
app/Models/Picto.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Lib\Utils;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Picto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Picto $picto) {
|
||||
if (is_a($picto->picture,"SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Picto $picto) {
|
||||
if (is_a($picto->picture,"SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Picto $picto) {
|
||||
if ($picto->picture) {
|
||||
$urlPicture = public_path() . $picto->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
56
app/Models/PictoBrand.php
Normal file
56
app/Models/PictoBrand.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class PictoBrand extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (PictoBrand $pictoBrand) {
|
||||
if (is_a($pictoBrand->picture,"SplFileInfo")) {
|
||||
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (PictoBrand $pictoBrand) {
|
||||
if (is_a($pictoBrand->picture,"SplFileInfo")) {
|
||||
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (PictoBrand $pictoBrand) {
|
||||
if ($pictoBrand->picture) {
|
||||
$urlPicture = public_path() . $pictoBrand->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
87
app/Models/Post.php
Normal file
87
app/Models/Post.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'date_start' => 'datetime',
|
||||
'date_end' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
'picture_home',
|
||||
'alt_text_picture_home',
|
||||
'picture_news',
|
||||
'alt_text_picture_news',
|
||||
'date_start',
|
||||
'date_end',
|
||||
'on_top'
|
||||
];
|
||||
|
||||
protected $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
'picture_home',
|
||||
'alt_text_picture_home',
|
||||
'picture_news',
|
||||
'alt_text_picture_news'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Post $post) {
|
||||
if (is_a($post->picture_home,"SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
|
||||
}
|
||||
if (is_a($post->picture_news,"SplFileInfo")) {
|
||||
$post->picture_news = Utils::storeImage($post->picture_news, $post->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Post $post) {
|
||||
if (is_a($post->picture_home,"SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
|
||||
}
|
||||
if (is_a($post->picture_news,"SplFileInfo")) {
|
||||
$post->picture_news = Utils::storeImage($post->picture_news, $post->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Post $post) {
|
||||
if ($post->picture_home) {
|
||||
$urlPicture = public_path() . $post->picture_home;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($post->picture_news) {
|
||||
$urlPicture = public_path() . $post->picture_news;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
90
app/Models/Product.php
Normal file
90
app/Models/Product.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'gamme_id',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'pictos',
|
||||
'plusproduit',
|
||||
'is_published',
|
||||
'is_on_top',
|
||||
'is_news',
|
||||
'is_halal',
|
||||
'is_food_service',
|
||||
'seo_title',
|
||||
'seo_description',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'pictos',
|
||||
'plusproduit',
|
||||
'seo_title',
|
||||
'seo_description',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Product $product) {
|
||||
if (is_a($product->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($product->picture, $product->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Product $product) {
|
||||
if (is_a($product->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($product->picture, $product->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Product $product) {
|
||||
if ($product->picture) {
|
||||
$urlPicture = public_path() . $product->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
//delete des images de plus produit
|
||||
$plusproduit = json_decode($product->plusproduit);
|
||||
foreach ($plusproduit as $plus) {
|
||||
$urlPicture = public_path() . $plus->url;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Range that owns the product.
|
||||
*/
|
||||
public function gamme()
|
||||
{
|
||||
return $this->belongsTo(Gamme::class);
|
||||
}
|
||||
}
|
||||
50
app/Models/SeoDatum.php
Normal file
50
app/Models/SeoDatum.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SeoDatum extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* Engagment fillable fields
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'keywords'
|
||||
];
|
||||
|
||||
/**
|
||||
* Engagment translatable fields array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'description',
|
||||
'keywords'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the route key for the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'page';
|
||||
}
|
||||
}
|
||||
79
app/Models/Slide.php
Normal file
79
app/Models/Slide.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Slide extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'date_start' => 'datetime',
|
||||
'date_end' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
'link_label',
|
||||
'link',
|
||||
'link_new_tab',
|
||||
'slider_id',
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'date_start',
|
||||
'date_end'
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
'picture',
|
||||
'link',
|
||||
'link_label',
|
||||
'alt_text_picture'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Slide $slide) {
|
||||
if (is_a($slide->picture,"SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Slide $slide) {
|
||||
if (is_a($slide->picture,"SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Slide $slide) {
|
||||
if ($slide->picture) {
|
||||
$urlPicture = public_path() . $slide->picture;
|
||||
if ($urlPicture) {
|
||||
if (File::exists($urlPicture)) {
|
||||
File::delete($urlPicture);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function slider()
|
||||
{
|
||||
return $this->belongsTo(Slider::class);
|
||||
}
|
||||
}
|
||||
45
app/Models/Slider.php
Normal file
45
app/Models/Slider.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Slider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
protected $fillable = [
|
||||
'label',
|
||||
'slug',
|
||||
'commentaire',
|
||||
'published'
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'label',
|
||||
'slug',
|
||||
'commentaire'
|
||||
];
|
||||
|
||||
public function slides()
|
||||
{
|
||||
return $this->hasMany(Slide::class, 'slider_id')->orderBy('order', 'ASC');
|
||||
}
|
||||
|
||||
public function showableSlides()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
return $this->hasMany(Slide::class, 'slider_id')
|
||||
->orderBy('order', 'ASC')->where(function ($q) use ($now) {
|
||||
$q->whereDate('date_start', '<=', $now)
|
||||
->orWhereNull('date_start');
|
||||
})->where(function ($q) use ($now) {
|
||||
$q->whereDate('date_end', '>=', $now)
|
||||
->orWhereNull('date_end');
|
||||
});
|
||||
}
|
||||
}
|
||||
28
app/Models/Text.php
Normal file
28
app/Models/Text.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Text extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
}
|
||||
28
app/Models/Title.php
Normal file
28
app/Models/Title.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Title extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
}
|
||||
|
|
@ -2,15 +2,22 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use App\Enums\Role;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasFactory;
|
||||
use Notifiable;
|
||||
use CastsEnums;
|
||||
|
||||
public $enumCasts = [
|
||||
'role' => Role::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
|
@ -41,4 +48,20 @@ class User extends Authenticatable
|
|||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (User $user) {
|
||||
if (Hash::needsRehash($user->password)) {
|
||||
$user->password = Hash::make($user->password);
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (User $user) {
|
||||
if (Hash::needsRehash($user->password)) {
|
||||
$user->password = Hash::make($user->password);
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
|
|
@ -23,6 +24,6 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -47,6 +49,18 @@ class RouteServiceProvider extends ServiceProvider
|
|||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
|
||||
Route::bind('gammeSlug', function($value, $route) {
|
||||
$gamme = Gamme::where('slug', 'LIKE', '%:"'.$value.'"%')->firstOrFail();
|
||||
return $gamme;
|
||||
});
|
||||
|
||||
Route::bind('productSlug', function($value, $route) {
|
||||
$gamme = $route->parameter('gammeSlug');
|
||||
$product = Product::where('slug', 'LIKE', '%:"'.$value.'"%')->where('gamme_id', $gamme->id)->firstOrFail();
|
||||
return $product;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
42
app/Traits/CastsEnumsHasTranslations.php
Normal file
42
app/Traits/CastsEnumsHasTranslations.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
trait CastsEnumsHasTranslations {
|
||||
|
||||
use CastsEnums, HasTranslations
|
||||
{
|
||||
CastsEnums::getAttributeValue as enumGetAttributeValue;
|
||||
CastsEnums::setAttribute as enumSetAttribute;
|
||||
HasTranslations::getAttributeValue as transGetAttributeValue;
|
||||
HasTranslations::setAttribute as transSetAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually mix getAttributeValue from CastsEnums and HasTranslations
|
||||
*/
|
||||
public function getAttributeValue($key)
|
||||
{
|
||||
if ($this->hasEnumCast($key)) {
|
||||
return $this->enumGetAttributeValue($key);
|
||||
}
|
||||
|
||||
return $this->transGetAttributeValue($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually mix setAttribute from CastsEnums and HasTranslations
|
||||
*/
|
||||
public function setAttribute($key, $value)
|
||||
{
|
||||
if ($this->hasEnumCast($key)) {
|
||||
return $this->enumSetAttribute($key, $value);
|
||||
|
||||
}
|
||||
|
||||
return $this->transSetAttribute($key,$value);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,24 @@
|
|||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"joedixon/laravel-translation": "^1.1",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.8",
|
||||
"laravel/framework": "^8.65",
|
||||
"laravel/sanctum": "^2.11",
|
||||
"laravel/tinker": "^2.5"
|
||||
"laravel/tinker": "^2.5",
|
||||
"laravel/ui": "^3.3",
|
||||
"mews/purifier": "^3.3",
|
||||
"spatie/laravel-translatable": "^4.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.5",
|
||||
|
|
@ -18,7 +27,8 @@
|
|||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"slevomat/coding-standard": "^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
@ -55,7 +65,10 @@
|
|||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
|
|
|
|||
2037
composer.lock
generated
2037
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -67,7 +67,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
'timezone' => 'Europe/Paris',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -80,7 +80,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'locale' => 'en',
|
||||
'locale' => 'fr',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -93,7 +93,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
'fallback_locale' => 'fr',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -106,7 +106,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
'faker_locale' => 'fr_FR',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -229,6 +229,9 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
// Enums
|
||||
'Page' => \App\Enums\Page::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
38
config/bo.php
Normal file
38
config/bo.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| App parameters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Several parameters
|
||||
|
|
||||
*/
|
||||
|
||||
'slide_image_maxwidth' => '1920',
|
||||
'slide_image_maxheight' => '812',
|
||||
|
||||
'encart_image_maxwidth' => '642',
|
||||
'encart_image_maxheight' => '556',
|
||||
|
||||
'picto_image_maxwidth' => '150',
|
||||
'picto_image_maxheight' => '150',
|
||||
|
||||
'advice_image_maxwidth' => '284',
|
||||
'advice_image_maxheight' => '284',
|
||||
|
||||
'post_home_image_maxwidth' => '1030',
|
||||
'post_home_image_maxheight' => '239',
|
||||
'post_news_image_maxwidth' => '380',
|
||||
'post_news_image_maxheight' => '298',
|
||||
|
||||
'gamme_image_maxwidth' => '575',
|
||||
'gamme_image_maxheight' => '375',
|
||||
'gamme_banner_maxwidth' => '1920',
|
||||
'gamme_banner_maxheight' => '568',
|
||||
|
||||
'product_image_maxwidth' => '509',
|
||||
'product_image_maxheight' => '509',
|
||||
|
||||
];
|
||||
15
config/exception-handler.php
Normal file
15
config/exception-handler.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
* Send mail when app debug is turn off
|
||||
* so you can be warned if an unhandled exception occurs
|
||||
*/
|
||||
'enableMaiLog' => !config('app.debug'),
|
||||
|
||||
/**
|
||||
* Put a developper secured mailbox in here
|
||||
* so you can receive email if things go mad
|
||||
*/
|
||||
'contactsList' => explode(",", env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr'))
|
||||
];
|
||||
|
|
@ -96,6 +96,11 @@ return [
|
|||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
// Contacts List
|
||||
'contactsList' => [
|
||||
'contactform' => explode(",", env('MAIL_LIST_CONTACTFORM', 'equipe.web@ldc.fr'))
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|
|
|
|||
114
config/purifier.php
Normal file
114
config/purifier.php
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Ok, glad you are here
|
||||
* first we get a config instance, and set the settings
|
||||
* $config = HTMLPurifier_Config::createDefault();
|
||||
* $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
|
||||
* $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
|
||||
* if ( ! $this->config->get('purifier.finalize')) {
|
||||
* $config->autoFinalize = false;
|
||||
* }
|
||||
* $config->loadArray($this->getConfig());
|
||||
*
|
||||
* You must NOT delete the default settings
|
||||
* anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
|
||||
*
|
||||
* @link http://htmlpurifier.org/live/configdoc/plain.html
|
||||
*/
|
||||
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
return [
|
||||
'encoding' => 'UTF-8',
|
||||
'finalize' => true,
|
||||
'cachePath' => storage_path('app/purifier'),
|
||||
'cacheFileMode' => 0755,
|
||||
'settings' => [
|
||||
'default' => [
|
||||
'HTML.SafeIframe' => true, // For iframes
|
||||
'URI.SafeIframeRegexp' => "%^(http://|https://|//)(vimeo.com)%",
|
||||
'HTML.Doctype' => 'HTML 4.01 Transitional',
|
||||
'HTML.Allowed' => 'h1[style],h2[style],h3[style],h4[style],h5[style],h6[style],figure[class],oembed[url],div,b,strong,i,em,u,a[href|title],ul[style],ol[style],dl[style],li,p[style],br,span[style|class],img[width|height|alt|src],iframe[src|width|height|class|frameborder],table,thead,tbody,th,tr,td,hr',
|
||||
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,list-style-type',
|
||||
'AutoFormat.AutoParagraph' => false,
|
||||
'AutoFormat.RemoveEmpty' => false,
|
||||
'AutoFormat.RemoveEmpty.RemoveNbsp' => false,
|
||||
],
|
||||
"youtube" => [
|
||||
"HTML.SafeIframe" => 'true',
|
||||
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|vimeo.com/)%",
|
||||
],
|
||||
'custom_definition' => [
|
||||
'id' => 'html5-definitions',
|
||||
'rev' => 1,
|
||||
'debug' => true,
|
||||
'elements' => [
|
||||
// http://developers.whatwg.org/sections.html
|
||||
['section', 'Block', 'Flow', 'Common'],
|
||||
['nav', 'Block', 'Flow', 'Common'],
|
||||
['article', 'Block', 'Flow', 'Common'],
|
||||
['aside', 'Block', 'Flow', 'Common'],
|
||||
['header', 'Block', 'Flow', 'Common'],
|
||||
['footer', 'Block', 'Flow', 'Common'],
|
||||
|
||||
// Content model actually excludes several tags, not modelled here
|
||||
['address', 'Block', 'Flow', 'Common'],
|
||||
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/grouping-content.html
|
||||
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
|
||||
['figcaption', 'Inline', 'Flow', 'Common'],
|
||||
['oembed', 'Inline', 'Flow', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/the-video-element.html#the-video-element
|
||||
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
'width' => 'Length',
|
||||
'height' => 'Length',
|
||||
'poster' => 'URI',
|
||||
'preload' => 'Enum#auto,metadata,none',
|
||||
'controls' => 'Bool',
|
||||
]],
|
||||
['source', 'Block', 'Flow', 'Common', [
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
]],
|
||||
|
||||
// http://developers.whatwg.org/text-level-semantics.html
|
||||
['s', 'Inline', 'Inline', 'Common'],
|
||||
['var', 'Inline', 'Inline', 'Common'],
|
||||
['sub', 'Inline', 'Inline', 'Common'],
|
||||
['sup', 'Inline', 'Inline', 'Common'],
|
||||
['mark', 'Inline', 'Inline', 'Common'],
|
||||
['wbr', 'Inline', 'Empty', 'Core'],
|
||||
|
||||
// http://developers.whatwg.org/edits.html
|
||||
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
],
|
||||
'attributes' => [
|
||||
['iframe', 'allowfullscreen', 'Bool'],
|
||||
['table', 'height', 'Text'],
|
||||
['td', 'border', 'Text'],
|
||||
['th', 'border', 'Text'],
|
||||
['tr', 'width', 'Text'],
|
||||
['tr', 'height', 'Text'],
|
||||
['tr', 'border', 'Text'],
|
||||
['figure', 'class', 'Text'],
|
||||
['oembed', 'url', 'Text'],
|
||||
['span', 'style', 'Text'],
|
||||
],
|
||||
],
|
||||
'custom_attributes' => [
|
||||
['a', 'target', 'Enum#_blank,_self,_target,_top'],
|
||||
['ol', 'style', 'Text'],
|
||||
['oembed', 'url', 'Text'],
|
||||
],
|
||||
'custom_elements' => [
|
||||
['u', 'Inline', 'Inline', 'Common'],
|
||||
['oembed', 'Inline', 'Inline', 'Common'],
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
85
config/translation.php
Normal file
85
config/translation.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Package driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The package supports different drivers for translation management.
|
||||
|
|
||||
| Supported: "file", "database"
|
||||
|
|
||||
*/
|
||||
'driver' => 'file',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route group configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The package ships with routes to handle language management. Update the
|
||||
| configuration here to configure the routes with your preferred group options.
|
||||
|
|
||||
*/
|
||||
'route_group_config' => [
|
||||
'middleware' => [
|
||||
'web',
|
||||
'auth:web',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Translation methods
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Update this array to tell the package which methods it should look for
|
||||
| when finding missing translations.
|
||||
|
|
||||
*/
|
||||
'translation_methods' => ['trans', '__'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Scan paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Update this array to tell the package which directories to scan when
|
||||
| looking for missing translations.
|
||||
|
|
||||
*/
|
||||
'scan_paths' => [
|
||||
//app_path(),
|
||||
//resource_path().'\views\back',
|
||||
resource_path().'/views/front',
|
||||
resource_path().'/views/layouts/frontend',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| UI URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Define the URL used to access the language management too.
|
||||
|
|
||||
*/
|
||||
'ui_url' => 'bo/languages',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Define the settings for the database driver here.
|
||||
|
|
||||
*/
|
||||
'database' => [
|
||||
|
||||
'connection' => '',
|
||||
|
||||
'languages_table' => 'languages',
|
||||
|
||||
'translations_table' => 'translations',
|
||||
],
|
||||
];
|
||||
45
database/factories/AdviceFactory.php
Normal file
45
database/factories/AdviceFactory.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Advice;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
|
||||
class AdviceFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Advice::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/repas.jpg'));
|
||||
$advice = new Advice();
|
||||
$imgpath = Utils::storeImage($upload, $advice->getTable());
|
||||
|
||||
return [
|
||||
'title1' => $this->faker->text(40),
|
||||
'title2' => $this->faker->text(40),
|
||||
'picture1' => $imgpath,
|
||||
'alt_text_picture1' => $this->faker->sentence(10),
|
||||
'picture2' => $imgpath,
|
||||
'alt_text_picture2' => $this->faker->sentence(10),
|
||||
'picture3' => $imgpath,
|
||||
'alt_text_picture3' => $this->faker->sentence(10),
|
||||
'text1' => $this->faker->paragraph(10),
|
||||
'text2' => $this->faker->paragraph(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
40
database/factories/EncartFactory.php
Normal file
40
database/factories/EncartFactory.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Encart;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
|
||||
class EncartFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Encart::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/prez-img.jpg'));
|
||||
$encart = new Encart();
|
||||
$imgpath = Utils::storeImage($upload, $encart->getTable());
|
||||
|
||||
return [
|
||||
'title' => $this->faker->text(5),
|
||||
'subtitle' => $this->faker->sentence(7, false),
|
||||
'text' => $this->faker->paragraph(10, false),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
40
database/factories/GammeFactory.php
Normal file
40
database/factories/GammeFactory.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Gamme;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class GammeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$title = $this->faker->text(10) . rand(1, 100);
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/cookrange.jpg'));
|
||||
$picture = new Gamme();
|
||||
$imgpath = Utils::storeImage($upload, $picture->getTable());
|
||||
$upload = new SplFileInfo(resource_path('assets/images/entete_sous_gammes.jpg'));
|
||||
$bannerpath = Utils::storeImage($upload, $picture->getTable());
|
||||
|
||||
return [
|
||||
'parent_gamme_id' => null,
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title),
|
||||
'text' => $this->faker->text(5),
|
||||
'color' => $this->faker->hexColor(),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
'banner' => $bannerpath,
|
||||
'alt_text_banner' => $this->faker->sentence(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
34
database/factories/MomentFactory.php
Normal file
34
database/factories/MomentFactory.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Moment;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
|
||||
class MomentFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Moment::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->text(5),
|
||||
'subtitle' => $this->faker->sentence(7, false),
|
||||
'text' => $this->faker->paragraph(10, false),
|
||||
'picture' => new SplFileInfo(resource_path('assets/images/prez-img.jpg')),
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
39
database/factories/PictoBrandFactory.php
Normal file
39
database/factories/PictoBrandFactory.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\PictoBrand;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
|
||||
class PictoBrandFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = PictoBrand::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/site-production.jpg'));
|
||||
$encart = new PictoBrand();
|
||||
$imgpath = Utils::storeImage($upload, $encart->getTable());
|
||||
|
||||
return [
|
||||
'title' => $this->faker->randomNumber(3, false),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
'text' => $this->faker->text(20),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/PictoFactory.php
Normal file
37
database/factories/PictoFactory.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Picto;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use SplFileInfo;
|
||||
|
||||
class PictoFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Picto::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$upload = new SplFileInfo(resource_path('assets/images/qualite.png'));
|
||||
$picto = new Picto();
|
||||
$imgpath = Utils::storeImage($upload, $picto->getTable());
|
||||
|
||||
return [
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
'text' => $this->faker->text(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
39
database/factories/PostFactory.php
Normal file
39
database/factories/PostFactory.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Post;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
use SplFileInfo;
|
||||
|
||||
class PostFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/burger-fond.jpg'));
|
||||
$picture = new Post();
|
||||
$imghomepath = Utils::storeImage($upload, $picture->getTable());
|
||||
$upload = new SplFileInfo(resource_path('assets/images/burger.jpg'));
|
||||
$imgnewspath = Utils::storeImage($upload, $picture->getTable());
|
||||
|
||||
return [
|
||||
'title' => $this->faker->text(5),
|
||||
'text' => $this->faker->paragraph(10, false),
|
||||
'picture_home' => $imghomepath,
|
||||
'alt_text_picture_home' => $this->faker->sentence(10),
|
||||
'picture_news' => $imgnewspath,
|
||||
'alt_text_picture_news' => $this->faker->sentence(10),
|
||||
'date_start' => Carbon::now(),
|
||||
'date_end' => Carbon::now()->addDays(2),
|
||||
'on_top' => true
|
||||
];
|
||||
}
|
||||
}
|
||||
140
database/factories/ProductFactory.php
Normal file
140
database/factories/ProductFactory.php
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use SplFileInfo;
|
||||
|
||||
class ProductFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$name = $this->faker->text(10) . rand(1, 100);
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => '1h30mins.',
|
||||
'temp' => '200°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => '15 minutes',
|
||||
'temp' => '100°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPoele = array(
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => '5 minutes sur chaque face',
|
||||
'temp' => '100°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => '3 h',
|
||||
'temp' => '80°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPlancha = array(
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => '20mins',
|
||||
'temp' => '130°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => '30 mins à 45 mins',
|
||||
'temp' => '80°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => '30 minutes',
|
||||
'temp' => '200°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/microondes.png',
|
||||
'time' => '3mins',
|
||||
'temp' => '900 Watts',
|
||||
'status' => false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => '10mins',
|
||||
'temp' => '90°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlusProduit1 = array(
|
||||
'id' => 0,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
'id' => 1,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
'id' => 2,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/product_sample_01.png'));
|
||||
$picture = new Product();
|
||||
$imgpath = Utils::storeImage($upload, $picture->getTable());
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'description' => $this->faker->paragraph(),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
'pictos' => json_encode([
|
||||
'four' => $tabFour,
|
||||
'friteuse' => $tabFriteuse,
|
||||
'poele' => $tabPoele,
|
||||
'cocotte' => $tabCocotte,
|
||||
'plancha' => $tabPlancha,
|
||||
'bainmarie' => $tabBainMarie,
|
||||
'barbecue' => $tabBarbecue,
|
||||
'microondes' => $tabMicroOndes,
|
||||
'casserole' => $tabCasserole
|
||||
]),
|
||||
'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]),
|
||||
'is_published' => true,
|
||||
'is_on_top' => rand(true, false),
|
||||
'is_news' => rand(true, false),
|
||||
'is_food_service' => rand(true, false),
|
||||
'is_halal' => rand(true, false),
|
||||
'seo_title' => $this->faker->text(5),
|
||||
'seo_description' => $this->faker->sentence(20),
|
||||
];
|
||||
}
|
||||
}
|
||||
45
database/factories/SlideFactory.php
Normal file
45
database/factories/SlideFactory.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Lib\Utils;
|
||||
use App\Models\Slide;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
use SplFileInfo;
|
||||
|
||||
class SlideFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Slide::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/image-sample.jpg'));
|
||||
$slide = new Slide();
|
||||
$imgpath = Utils::storeImage($upload, $slide->getTable());
|
||||
|
||||
return [
|
||||
'title' => $this->faker->unique()->word(),
|
||||
'text' => $this->faker->realText(25),
|
||||
'link_label' => $this->faker->text(128),
|
||||
'link' => route('wasup'),
|
||||
'link_new_tab' => rand(0, 1),
|
||||
'date_start' => Carbon::now(),
|
||||
'date_end' => Carbon::now()->addDays(2),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
35
database/factories/SliderFactory.php
Normal file
35
database/factories/SliderFactory.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Slider;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SliderFactory extends Factory
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Slider::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$label = $this->faker->unique()->word();
|
||||
|
||||
return [
|
||||
'label' => $label,
|
||||
'slug' => Str::slug($label),
|
||||
'commentaire' => $this->faker->realText(50),
|
||||
'published' => true
|
||||
];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue