- Changed bump to LARAVEL 8
- Changed bump composer deps - Changed bump npm deps - Upgraded AppServiceProvider to use LDC specifics
This commit is contained in:
parent
f672e05fae
commit
1a5eb157cb
15 changed files with 1748 additions and 1128 deletions
|
|
@ -4,23 +4,17 @@ namespace App\Providers;
|
|||
|
||||
use App\Models\Prizes;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
|
|
@ -28,11 +22,32 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (config('app.env') !== 'local') {
|
||||
\URL::forceScheme('https');
|
||||
// * LOCAL HTTPS FIX.
|
||||
if (!in_array(config('app.env'), ['local', 'testing'])) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
// * HA PROXY FIX.
|
||||
App::singleton('clientIp', function () {
|
||||
if (
|
||||
config('app.env') === 'local'
|
||||
) {
|
||||
return request()->getClientIp();
|
||||
} else {
|
||||
return request()->server('HTTP_X_FORWARDED_FOR') ??
|
||||
request()->getClientIp();
|
||||
}
|
||||
});
|
||||
// * LOCAL FORCE eg: for Carbon.
|
||||
setlocale(LC_ALL, \sprintf(
|
||||
'%s_%s.UTF-8',
|
||||
config('app.locale'),
|
||||
\strtoupper(config('app.locale'))
|
||||
));
|
||||
Carbon::setLocale(config('app.locale'));
|
||||
// * FORCE BOOTSTRAP PAGINATOR.
|
||||
if (!app()->runningInConsole()) {
|
||||
Paginator::useBootstrap();
|
||||
}
|
||||
|
||||
setlocale(LC_TIME, config('app.locale') . "_" . strtoupper(config('app.locale')) . '.utf8');
|
||||
|
||||
app()->singleton(Settings::class, function () {
|
||||
if (!($settings = Settings::find(1))) {
|
||||
|
|
@ -42,15 +57,17 @@ class AppServiceProvider extends ServiceProvider
|
|||
});
|
||||
|
||||
if (!app()->runningInConsole()) {
|
||||
// On ramène le nom du jeu et le nom de la société sur toute les pages
|
||||
// On ramène le nom du jeu et le nom de la société sur toute les pages.
|
||||
$settingsGlobal = Cache::get('settingsGlobal');
|
||||
if (!$settingsGlobal) {
|
||||
$settingsGlobal = app(Settings::class)->select('name', 'company', 'analytics', 'start_date', 'end_date')->first();
|
||||
$settingsGlobal = app(Settings::class)
|
||||
->select('name', 'company', 'analytics', 'start_date', 'end_date')
|
||||
->first();
|
||||
Cache::put('settingsGlobal', $settingsGlobal);
|
||||
}
|
||||
View::share('settingsGlobal', $settingsGlobal);
|
||||
|
||||
// On ramène aussi tout les prix car on en a besoin sur le header
|
||||
// On ramène aussi tout les prix car on en a besoin sur le header.
|
||||
$prizesGlobal = Cache::get('prizesGlobal');
|
||||
if (!$prizesGlobal) {
|
||||
$prizesGlobal = Prizes::all();
|
||||
|
|
@ -62,6 +79,6 @@ class AppServiceProvider extends ServiceProvider
|
|||
Blade::if('superadmin', function () {
|
||||
return auth()->user() && auth()->user()->role == 1;
|
||||
});
|
||||
}
|
||||
}//end if
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi
|
|||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
|
|
@ -19,16 +18,4 @@ class EventServiceProvider extends ServiceProvider
|
|||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
|
|
@ -14,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
protected $namespace = null;
|
||||
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
|
|
@ -24,48 +27,44 @@ class RouteServiceProvider extends ServiceProvider
|
|||
public const HOME = '/';
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
public function boot()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
$this->configureRateLimiting();
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
$this->routes(function () {
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
Route::middleware('web')
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web-bo.php'));
|
||||
Route::middleware('web')
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web-re7.php'));
|
||||
->group(base_path('routes/web-re7.php'));
|
||||
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2.5",
|
||||
"php": "^7.3",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"fideloper/proxy": "^4.2",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.6",
|
||||
"kwaadpepper/serial-int-caster": "^1.0",
|
||||
"laravel/framework": "^7.24",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "2.4"
|
||||
"laravel/ui": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^2.0",
|
||||
"facade/ignition": "^2.0",
|
||||
"facade/ignition": "^2.3.6",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.3.1",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^8.5",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"slevomat/coding-standard": "^7.0",
|
||||
"squizlabs/php_codesniffer": "^3.6"
|
||||
},
|
||||
|
|
@ -42,11 +42,11 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories",
|
||||
"class"
|
||||
]
|
||||
},
|
||||
|
|
|
|||
2529
composer.lock
generated
2529
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +1,26 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'email' => $this->faker->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
// * password
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class Laravel8UpgradeFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('failed_jobs', function (Blueprint $table) {
|
||||
$table->string('uuid')->after('id')->nullable()->unique();
|
||||
});
|
||||
DB::table('failed_jobs')->whereNull('uuid')->cursor()->each(function ($job) {
|
||||
DB::table('failed_jobs')
|
||||
->where('id', $job->id)
|
||||
->update(['uuid' => (string)Illuminate\Support\Str::uuid()]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Content;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
|
@ -12,16 +14,16 @@ class ContentSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
$mentions = new Content();
|
||||
$mentions->key = "mentions legales";
|
||||
$mentions = new Content();
|
||||
$mentions->key = "mentions legales";
|
||||
$mentions->value = "...";
|
||||
|
||||
$charte = new Content();
|
||||
$charte->key = "charte";
|
||||
$charte = new Content();
|
||||
$charte->key = "charte";
|
||||
$charte->value = "...";
|
||||
|
||||
$reglement = new Content();
|
||||
$reglement->key = "reglement";
|
||||
$reglement = new Content();
|
||||
$reglement->key = "reglement";
|
||||
$reglement->value = "...";
|
||||
|
||||
$mentions->save();
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
37
database/seeders/SettingsSeeder.php
Normal file
37
database/seeders/SettingsSeeder.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$settings = new Settings();
|
||||
$settings->name = "Nom du jeu";
|
||||
$settings->start_date = now();
|
||||
$settings->end_date = new Carbon(strtotime("+30 days"));
|
||||
$settings->nb_participation_player = 30;
|
||||
$settings->nb_participation_ip = 30;
|
||||
$settings->nb_unique_code_use = 0;
|
||||
$settings->use_ean_codes = false;
|
||||
$settings->activated_teaser = false;
|
||||
$settings->activated_close_page = false;
|
||||
$settings->redirect_close = "https://example.test";
|
||||
$settings->reductions_activated = false;
|
||||
$settings->facebook_activated = false;
|
||||
$settings->notification_emails = "[]";
|
||||
$settings->winning_proof = 0;
|
||||
$settings->company = "Société";
|
||||
$settings->web_coupons = "[]";
|
||||
$settings->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Settings;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$settings = new Settings();
|
||||
$settings->name = "Nom du jeu";
|
||||
$settings->start_date = now();
|
||||
$settings->end_date = new Carbon(strtotime("+30 days"));
|
||||
$settings->nb_participation_player = 30;
|
||||
$settings->nb_participation_ip = 30;
|
||||
$settings->nb_unique_code_use = 0;
|
||||
$settings->use_ean_codes = false;
|
||||
$settings->activated_teaser = false;
|
||||
$settings->activated_close_page = false;
|
||||
$settings->redirect_close = "https://example.test";
|
||||
$settings->reductions_activated = false;
|
||||
$settings->facebook_activated = false;
|
||||
$settings->notification_emails = "[]";
|
||||
$settings->winning_proof = 0;
|
||||
$settings->company = "Société";
|
||||
$settings->web_coupons = "[]";
|
||||
$settings->save();
|
||||
}
|
||||
}
|
||||
24
package.json
24
package.json
|
|
@ -10,28 +10,24 @@
|
|||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"bootstrap": "^4.6.0",
|
||||
"cross-env": "^7.0",
|
||||
"cssnano": "^5.0.2",
|
||||
"jquery": "^3.2",
|
||||
"laravel-mix": "^6.0.19",
|
||||
"laravel-mix-polyfill": "^3.0.0",
|
||||
"axios": "^0.21.4",
|
||||
"bootstrap": "^4.6.1",
|
||||
"jquery": "^3.6.0",
|
||||
"laravel-mix": "^6.0.39",
|
||||
"laravel-mix-polyfill": "^3.0.1",
|
||||
"lodash": "^4.17.19",
|
||||
"popper.js": "^1.12",
|
||||
"postcss": "^8.2.15",
|
||||
"resolve-url-loader": "^4.0.0",
|
||||
"sass": "^1.32.13",
|
||||
"sass-loader": "^11.1.1",
|
||||
"vue": "^2.6.12",
|
||||
"vue-loader": "^15.9.6",
|
||||
"vue-template-compiler": "^2.6.12"
|
||||
"sass": "^1.47.0",
|
||||
"sass-loader": "^12.4.0",
|
||||
"vue": "^2.6.14",
|
||||
"vue-loader": "^15.9.8",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fancyapps/fancybox": "^3.5.7",
|
||||
"@fortawesome/fontawesome-free": "^5.15.3",
|
||||
"chart.js": "^2.9.4",
|
||||
"jquery": "^3.5.1",
|
||||
"popper.js": "^1.16.1",
|
||||
"scratchcard-js": "^1.4.10",
|
||||
"swiper": "^6.6.1",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
|
||||
require __DIR__ . '/../storage/framework/maintenance.php';
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
{
|
||||
"/js/app.js": "/js/app.js",
|
||||
"/js/cuisinezvosidees-2021-min.js": "/js/cuisinezvosidees-2021-min.js",
|
||||
"/css/cuisinezvosidees-2021.css": "/css/cuisinezvosidees-2021.css",
|
||||
"/css/app.css": "/css/app.css"
|
||||
}
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ use App\Http\Controllers\Bo\FaqThemesController;
|
|||
use App\Http\Controllers\Bo\GainViewController;
|
||||
use App\Http\Controllers\Bo\InstantWinController;
|
||||
use App\Http\Controllers\Bo\PrizesController;
|
||||
use App\Http\Controllers\Bo\ProductsController;
|
||||
use App\Http\Controllers\Bo\RangeController;
|
||||
use App\Http\Controllers\Bo\SettingsController;
|
||||
use App\Http\Controllers\Bo\WinnersListController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
|
@ -69,9 +71,9 @@ Route::prefix('bo')
|
|||
Route::post('/winners-list/arcadia/{id}/send', [WinnersListController::class, 'createCourrierArcadia'])
|
||||
->name('courrier-arcadia');
|
||||
// Produits porteurs.
|
||||
Route::resource('products', 'Bo\ProductsController')
|
||||
Route::resource('products', ProductsController::class)
|
||||
->withoutMiddleware('is-super-admin');
|
||||
Route::resource('ranges', 'Bo\RangeController')
|
||||
Route::resource('ranges', RangeController::class)
|
||||
->withoutMiddleware('is-super-admin');
|
||||
|
||||
// Route::get('/products', 'ProductsController@index')->name('products');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue