diff --git a/app/Http/Controllers/Club/CustomerController.php b/app/Http/Controllers/Club/CustomerController.php index bf68820b..846abdae 100644 --- a/app/Http/Controllers/Club/CustomerController.php +++ b/app/Http/Controllers/Club/CustomerController.php @@ -35,7 +35,7 @@ class CustomerController extends Controller $questions = Customer::cacheCrm( $customer->hashcode, 'questions', - fn () => collect(Question::all())->filter(function ($question) { + fn() => collect(Question::all())->filter(function ($question) { return $question->id === intval(config('crm.question')); }) ); @@ -67,7 +67,9 @@ class CustomerController extends Controller if ( $this->updateCrmCustomerInfo($customer, collect($request->validated())->except([ - 'password', 'ok_cgv', 'ok_cgu' + 'password', + 'ok_cgv', + 'ok_cgu' ])->toArray()) ) { if ($customer->saveOrFail()) { @@ -165,7 +167,7 @@ class CustomerController extends Controller public function indexRecipes(): \Illuminate\Contracts\View\View { $models = Recipe::query()->with('products', 'consumptionMoment') - ->where('published', true)->take(15)->paginate(9); + ->where('published', true)->take(15)->paginate(9); return view('club.pages.customers.favorites.recipes', compact('models')); } } diff --git a/app/Http/Controllers/Club/HomeController.php b/app/Http/Controllers/Club/HomeController.php index 9f75768a..ab3176a7 100644 --- a/app/Http/Controllers/Club/HomeController.php +++ b/app/Http/Controllers/Club/HomeController.php @@ -15,8 +15,8 @@ class HomeController extends Controller */ public function index(): \Illuminate\Contracts\View\View { - $newsClubModels = NewsClub::query()->where('published', true)->orderBy('publish_at', 'asc')->take(3)->get(); - $discountModels = Discount::query()->get(); + $newsClubModels = NewsClub::getPublishedOrderedByPublishAt(); + $discountModels = Discount::getCachedDiscounts(); $discountsTotal = $discountModels->sum('value'); return (auth('club')->check()) ? view('club.pages.home.homepage', compact('newsClubModels', 'discountModels', 'discountsTotal')) diff --git a/app/Http/Controllers/Fo/HomeController.php b/app/Http/Controllers/Fo/HomeController.php index 3286f9d8..e83cf172 100644 --- a/app/Http/Controllers/Fo/HomeController.php +++ b/app/Http/Controllers/Fo/HomeController.php @@ -39,12 +39,14 @@ class HomeController extends Controller $mainSlideModels = MainSlide::getPublishedOrderedWithApproaches(); $demarcheSlideModels = DemarcheSlide::getPublishedOrdered(); $rangeModels = Range::getPublishedOrderedBySlug(); - $productViews = Product::getProductsViewsByRange(); + $productViews = Cache::remember('HomeProductsViews', 86400, function () { + return Product::getProductsViewsByRange(); + }); $hotNewsSettings = GeneralSetting::getCachedGeneralSetting(SettingsType::hotNews); $newsModels = News::getPublishedWithNewsCategory(); $recipeModels = Recipe::get9PublishedWithProducts(); $videoModels = Video::get9PublishedHomeVideosOrderedWithProducts(); - $discountsTotal = Discount::query()->get()->sum('value'); + $discountsTotal = Discount::getCachedDiscounts()->sum('value'); return view('fo.pages.home', compact( 'staticPageModel', 'mainSlideModels', diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 69aa1a32..5d5e5c7c 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -141,8 +141,8 @@ class Customer extends Authenticatable implements MustVerifyEmail */ public function conversations(): array { - $dateSort = fn (Message $a, Message $b) => $a->created_at->timestamp > $b->created_at->timestamp; - $messageFilter = fn (Collection $item) => $item->all(); + $dateSort = fn(Message $a, Message $b) => $a->created_at->timestamp > $b->created_at->timestamp; + $messageFilter = fn(Collection $item) => $item->all(); $messageWith = ['fromCustomer', 'toCustomer']; /** * Hack workaround https://github.com/livewire/livewire/issues/1054 @@ -304,7 +304,7 @@ class Customer extends Authenticatable implements MustVerifyEmail public function apiData(): \Illuminate\Database\Eloquent\Casts\Attribute { return Attribute::make( - get: fn (): CrmCustomer => self::cacheCrm($this->hashcode, "apiData", function () { + get: fn(): CrmCustomer => self::cacheCrm($this->hashcode, "apiData", function () { /** @var \LDC\LDCCRM\CrmApiV4 */ $crm = app('crmAPI'); $crmCustomer = $crm->getCustomer($this->hashcode); @@ -334,10 +334,12 @@ class Customer extends Authenticatable implements MustVerifyEmail if (!$crmCustomer) { throw new CrmException('CRM get Customer returned null'); } + $data['postcode'] = Arr::get($data, 'postal_code'); unset( $data["username"], $data["question_id"], - $data["answers"] + $data["answers"], + $data["postal_code"] ); $crmCustomer->fill($data); $result = $crmCustomer->save(); diff --git a/app/Models/Discount.php b/app/Models/Discount.php index e22449c2..b1e21950 100644 --- a/app/Models/Discount.php +++ b/app/Models/Discount.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Arr; use Illuminate\Support\Str; +use Illuminate\Support\Facades\Cache; /** * @property string $name Discount name. @@ -73,6 +74,7 @@ class Discount extends Model $discountModel = new self(); self::fillModel($discountModel, $coupon); } + self::getCachedDiscounts(); } /** @@ -192,4 +194,16 @@ class Discount extends Model ]))->all(); return $res; } + + /** + * Get cached discounts or remember it for 24h. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public static function getCachedDiscounts(): \Illuminate\Database\Eloquent\Collection + { + return Cache::remember('publishedDiscounts', 86400, function () { + return self::query()->get(); + }); + } } diff --git a/app/Models/NewsClub.php b/app/Models/NewsClub.php index a06c874c..d0dc0865 100644 --- a/app/Models/NewsClub.php +++ b/app/Models/NewsClub.php @@ -8,6 +8,7 @@ use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; +use Illuminate\Support\Facades\Cache; use App\Lib\Helpers\ToolboxHelper; /** @@ -69,15 +70,20 @@ class NewsClub extends Model self::assertTitleIsUnique($newsClub->title); self::manageFields($newsClub); }); + static::created(function () { + self::resetCache(); + }); static::updating(function (self $newsClub) { self::assertTitleIsUnique($newsClub->title, $newsClub->getKey()); self::manageFields($newsClub); }); static::updated(function (self $model) { FileStorageHelper::removeOldFile($model, 'picture'); + self::resetCache(); }); static::deleted(function (self $model) { FileStorageHelper::removeFile($model, 'picture'); + self::resetCache(); }); } @@ -110,6 +116,29 @@ class NewsClub extends Model ToolboxHelper::assertFieldIsUnique($table, 'slug', Str::slug($title), $id); } + /** + * Reset all cache elements related to this model. + * + * @return void + */ + private static function resetCache(): void + { + Cache::forget('publishedNewsClubOrderedByPublishAt'); + self::getPublishedOrderedByPublishAt(); + } + + /** + * Get all published news with categories relations. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public static function getPublishedOrderedByPublishAt(): \Illuminate\Database\Eloquent\Collection + { + return Cache::rememberForever('publishedNewsClubOrderedByPublishAt', function () { + return self::query()->where('published', true)->orderBy('publish_at', 'asc')->take(3)->get(); + }); + } + // * RELATIONSHIPS /** diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index e8e3cae4..f6c8cbd9 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -63,6 +63,19 @@ class AppServiceProvider extends ServiceProvider }); } + /** + * Register any application services. + * + * @return void + */ + public function register(): void + { + if ($this->app->environment('local')) { + $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); + $this->app->register(TelescopeServiceProvider::class); + } + } + /** * Set formatters and payment currency. * diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php new file mode 100644 index 00000000..470ef171 --- /dev/null +++ b/app/Providers/TelescopeServiceProvider.php @@ -0,0 +1,64 @@ +hideSensitiveRequestDetails(); + + $isLocal = $this->app->environment('local'); + + Telescope::filter(function (IncomingEntry $entry) use ($isLocal) { + return $isLocal || + $entry->isReportableException() || + $entry->isFailedRequest() || + $entry->isFailedJob() || + $entry->isScheduledTask() || + $entry->hasMonitoredTag(); + }); + } + + /** + * Prevent sensitive request details from being logged by Telescope. + */ + protected function hideSensitiveRequestDetails(): void + { + if ($this->app->environment('local')) { + return; + } + + Telescope::hideRequestParameters(['_token']); + + Telescope::hideRequestHeaders([ + 'cookie', + 'x-csrf-token', + 'x-xsrf-token', + ]); + } + + /** + * Register the Telescope gate. + * + * This gate determines who can access Telescope in non-local environments. + */ + protected function gate(): void + { + Gate::define('viewTelescope', function ($user) { + return in_array($user->email, [ + // + ]); + }); + } +} diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 90c5c1aa..21600892 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -96,11 +96,20 @@ class ViewServiceProvider extends ServiceProvider }); // * Inject some data for the bo menu. + $customerModelsCount = Cache::remember('customerModelsCount', 86400, function () { + return Customer::query()->count(); + }); + $firstMeat = Cache::remember('firstMeat', 86400, function () { + return Meat::query()->first(); + }); + $firstRange = Cache::remember('firstRange', 86400, function () { + return Range::query()->first(); + }); // @phpcs:disable Generic.Files.LineLength.TooLong collect([ - ['name' => 'customerModelsCount', 'value' => Customer::query()->count()], - ['name' => 'firstMeat', 'value' => Meat::query()->first()], - ['name' => 'firstRange', 'value' => Range::query()->first()], + ['name' => 'customerModelsCount', 'value' => $customerModelsCount], + ['name' => 'firstMeat', 'value' => $firstMeat], + ['name' => 'firstRange', 'value' => $firstRange], ['name' => 'mainMenuRangeModels', 'value' => Range::getPublishedOrdered()], ['name' => 'mainMenuMeatModels', 'value' => Meat::getPublishedOrdered()], ['name' => 'homeStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::home)], diff --git a/composer.json b/composer.json index 87da2e1a..9ffe7440 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,7 @@ "laravel-lang/common": "^4.0", "laravel/pint": "^1.0", "laravel/sail": "^1.18", + "laravel/telescope": "^5.2", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^8.1", "phpunit/phpunit": "^10.0", @@ -87,7 +88,9 @@ }, "extra": { "laravel": { - "dont-discover": [] + "dont-discover": [ + "laravel/telescope" + ] } }, "config": { diff --git a/composer.lock b/composer.lock index 8ed496e7..eda42993 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "330991754ddc1dffc7b61172bcbc72ea", + "content-hash": "e2e7d8fb63efe18287324559a12425ea", "packages": [ { "name": "24slides/laravel-saml2", @@ -2511,19 +2511,20 @@ }, { "name": "ldc/ldccrmv4client", - "version": "4.0.2", + "version": "4.0.8", "source": { "type": "git", "url": "git@lab.s-web.fr:ldc-web/projets/crm-client.git", - "reference": "01c616ef3316f257646252dc971852dacdc20bcd" + "reference": "588e74e951f376096a7bdea0c74e41200496a47e" }, "dist": { "type": "zip", - "url": "https://lab.s-web.fr/api/v4/projects/26/packages/composer/archives/ldc/ldccrmv4client.zip?sha=01c616ef3316f257646252dc971852dacdc20bcd", - "reference": "01c616ef3316f257646252dc971852dacdc20bcd", + "url": "https://lab.s-web.fr/api/v4/projects/26/packages/composer/archives/ldc/ldccrmv4client.zip?sha=588e74e951f376096a7bdea0c74e41200496a47e", + "reference": "588e74e951f376096a7bdea0c74e41200496a47e", "shasum": "" }, "require": { + "doctrine/inflector": "^2.0", "ext-curl": "*", "guzzlehttp/guzzle": "^7.4", "php": "^8.2", @@ -9901,6 +9902,75 @@ }, "time": "2024-09-27T14:58:09+00:00" }, + { + "name": "laravel/telescope", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/laravel/telescope.git", + "reference": "a7e9e1332361a31de6eb94cf1d356500c3a89301" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/telescope/zipball/a7e9e1332361a31de6eb94cf1d356500c3a89301", + "reference": "a7e9e1332361a31de6eb94cf1d356500c3a89301", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel/framework": "^8.37|^9.0|^10.0|^11.0", + "php": "^8.0", + "symfony/console": "^5.3|^6.0|^7.0", + "symfony/var-dumper": "^5.0|^6.0|^7.0" + }, + "require-dev": { + "ext-gd": "*", + "guzzlehttp/guzzle": "^6.0|^7.0", + "laravel/octane": "^1.4|^2.0|dev-develop", + "orchestra/testbench": "^6.40|^7.37|^8.17|^9.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.0|^10.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Telescope\\TelescopeServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Telescope\\": "src/", + "Laravel\\Telescope\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Mohamed Said", + "email": "mohamed@laravel.com" + } + ], + "description": "An elegant debug assistant for the Laravel framework.", + "keywords": [ + "debugging", + "laravel", + "monitoring" + ], + "support": { + "issues": "https://github.com/laravel/telescope/issues", + "source": "https://github.com/laravel/telescope/tree/v5.2.3" + }, + "time": "2024-10-13T15:11:07+00:00" + }, { "name": "mockery/mockery", "version": "1.6.12", @@ -12523,5 +12593,5 @@ "ext-bcmath": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/config/telescope.php b/config/telescope.php new file mode 100644 index 00000000..4418e692 --- /dev/null +++ b/config/telescope.php @@ -0,0 +1,205 @@ + env('TELESCOPE_ENABLED', false), + + /* + |-------------------------------------------------------------------------- + | Telescope Domain + |-------------------------------------------------------------------------- + | + | This is the subdomain where Telescope will be accessible from. If the + | setting is null, Telescope will reside under the same domain as the + | application. Otherwise, this value will be used as the subdomain. + | + */ + + 'domain' => env('TELESCOPE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Telescope Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Telescope will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('TELESCOPE_PATH', 'telescope'), + + /* + |-------------------------------------------------------------------------- + | Telescope Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the storage driver that will + | be used to store Telescope's data. In addition, you may set any + | custom options as needed by the particular driver you choose. + | + */ + + 'driver' => env('TELESCOPE_DRIVER', 'database'), + + 'storage' => [ + 'database' => [ + 'connection' => env('DB_CONNECTION', 'mysql'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Queue + |-------------------------------------------------------------------------- + | + | This configuration options determines the queue connection and queue + | which will be used to process ProcessPendingUpdate jobs. This can + | be changed if you would prefer to use a non-default connection. + | + */ + + 'queue' => [ + 'connection' => env('TELESCOPE_QUEUE_CONNECTION', null), + 'queue' => env('TELESCOPE_QUEUE', null), + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Telescope route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => [ + 'web', + Authorize::class, + ], + + /* + |-------------------------------------------------------------------------- + | Allowed / Ignored Paths & Commands + |-------------------------------------------------------------------------- + | + | The following array lists the URI paths and Artisan commands that will + | not be watched by Telescope. In addition to this list, some Laravel + | commands, like migrations and queue commands, are always ignored. + | + */ + + 'only_paths' => [ + // 'api/*' + ], + + 'ignore_paths' => [ + 'livewire*', + 'nova-api*', + 'pulse*', + ], + + 'ignore_commands' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Watchers + |-------------------------------------------------------------------------- + | + | The following array lists the "watchers" that will be registered with + | Telescope. The watchers gather the application's profile data when + | a request or task is executed. Feel free to customize this list. + | + */ + + 'watchers' => [ + Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), + + Watchers\CacheWatcher::class => [ + 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), + 'hidden' => [], + ], + + Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + + Watchers\CommandWatcher::class => [ + 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), + 'ignore' => [], + ], + + Watchers\DumpWatcher::class => [ + 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), + 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), + ], + + Watchers\EventWatcher::class => [ + 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), + 'ignore' => [], + ], + + Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), + + Watchers\GateWatcher::class => [ + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'ignore_abilities' => [], + 'ignore_packages' => true, + 'ignore_paths' => [], + ], + + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + + Watchers\LogWatcher::class => [ + 'enabled' => env('TELESCOPE_LOG_WATCHER', true), + 'level' => 'error', + ], + + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + + Watchers\ModelWatcher::class => [ + 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), + 'events' => ['eloquent.*'], + 'hydrations' => true, + ], + + Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), + + Watchers\QueryWatcher::class => [ + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'ignore_packages' => true, + 'ignore_paths' => [], + 'slow' => 100, + ], + + Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), + + Watchers\RequestWatcher::class => [ + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), + 'ignore_http_methods' => [], + 'ignore_status_codes' => [], + ], + + Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), + Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), + ], +]; diff --git a/database/migrations/2018_08_08_100000_create_telescope_entries_table.php b/database/migrations/2018_08_08_100000_create_telescope_entries_table.php new file mode 100644 index 00000000..700a83f0 --- /dev/null +++ b/database/migrations/2018_08_08_100000_create_telescope_entries_table.php @@ -0,0 +1,70 @@ +getConnection()); + + $schema->create('telescope_entries', function (Blueprint $table) { + $table->bigIncrements('sequence'); + $table->uuid('uuid'); + $table->uuid('batch_id'); + $table->string('family_hash')->nullable(); + $table->boolean('should_display_on_index')->default(true); + $table->string('type', 20); + $table->longText('content'); + $table->dateTime('created_at')->nullable(); + + $table->unique('uuid'); + $table->index('batch_id'); + $table->index('family_hash'); + $table->index('created_at'); + $table->index(['type', 'should_display_on_index']); + }); + + $schema->create('telescope_entries_tags', function (Blueprint $table) { + $table->uuid('entry_uuid'); + $table->string('tag'); + + $table->primary(['entry_uuid', 'tag']); + $table->index('tag'); + + $table->foreign('entry_uuid') + ->references('uuid') + ->on('telescope_entries') + ->onDelete('cascade'); + }); + + $schema->create('telescope_monitoring', function (Blueprint $table) { + $table->string('tag')->primary(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $schema = Schema::connection($this->getConnection()); + + $schema->dropIfExists('telescope_entries_tags'); + $schema->dropIfExists('telescope_entries'); + $schema->dropIfExists('telescope_monitoring'); + } +}; diff --git a/public/.htaccess b/public/.htaccess index 3aec5e27..d4398806 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -19,3 +19,64 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] + +## contrôle du cache navigateur - Expire headers + +ExpiresActive On +ExpiresDefault "access plus 7200 seconds" + +# Images +ExpiresByType image/jpg "access plus 1 month" +ExpiresByType image/jpeg "access plus 1 month" +ExpiresByType image/png "access plus 1 month" +ExpiresByType image/gif "access plus 1 month" +ExpiresByType image/svg+xml "access plus 1 month" + +# Video +ExpiresByType video/webm "access plus 1 year" +ExpiresByType video/mp4 "access plus 1 year" +ExpiresByType video/mpeg "access plus 1 year" + +# Fonts +ExpiresByType font/ttf "access plus 1 year" +ExpiresByType font/otf "access plus 1 year" +ExpiresByType font/woff "access plus 1 year" +ExpiresByType font/woff2 "access plus 1 year" +ExpiresByType application/font-woff "access plus 1 year" + +# Icons +AddType image/x-icon .ico +ExpiresByType image/ico "access plus 1 year" +ExpiresByType image/icon "access plus 1 year" +ExpiresByType image/x-icon "access plus 1 year" + +# CSS, JavaScript +ExpiresByType text/css "access plus 1 month" +ExpiresByType text/javascript "access plus 1 month" +ExpiresByType application/javascript "access plus 1 month" +ExpiresByType application/x-javascript "access plus 1 month" +ExpiresByType text/html "access plus 7200 seconds" +ExpiresByType application/xhtml+xml "access plus 7200 seconds" + +# Others +ExpiresByType application/pdf "access plus 1 month" +ExpiresByType image/vnd.microsoft.icon "access plus 1 year" + + + + +Header set Cache-Control "max-age=2592000, public" + + +Header set Cache-Control "max-age=604800, public" + + +Header set Cache-Control "max-age=216000, private" + + + + + +SetOutputFilter DEFLATE + + diff --git a/resources/views/club/pages/customers/partials/customer-fields.blade.php b/resources/views/club/pages/customers/partials/customer-fields.blade.php index 3fd716b8..6ade574a 100644 --- a/resources/views/club/pages/customers/partials/customer-fields.blade.php +++ b/resources/views/club/pages/customers/partials/customer-fields.blade.php @@ -22,12 +22,12 @@ --}} {{-- LASTNAME --}} -@if(!in_array('lastname', $hideFields)) +@if (!in_array('lastname', $hideFields))
- + @foreach ($errors->get('lastname') as $message)
{{ $message }}
@endforeach @@ -35,12 +35,12 @@ @endif {{-- FIRSTNAME --}} -@if(!in_array('firstname', $hideFields)) +@if (!in_array('firstname', $hideFields))
- + @foreach ($errors->get('firstname') as $message)
{{ $message }}
@endforeach @@ -48,13 +48,12 @@ @endif {{-- PSEUDO --}} -@if(!in_array('username', $hideFields)) +@if (!in_array('username', $hideFields))
- + @foreach ($errors->get('username') as $message)
{{ $message }}
@endforeach @@ -62,13 +61,12 @@ @endif {{-- EMAIL --}} -@if(!in_array('email', $hideFields)) +@if (!in_array('email', $hideFields))
- + @foreach ($errors->get('email') as $message)
{{ $message }}
@endforeach @@ -76,7 +74,7 @@ @endif {{-- BIRTHDAY --}} -@if(!in_array('birth_date', $hideFields)) +@if (!in_array('birth_date', $hideFields)) @@ -99,14 +97,14 @@ @endif {{-- PHONE --}} -@if(!in_array('phone', $hideFields)) +@if (!in_array('phone', $hideFields))
- + @foreach ($errors->get('phone') as $message)
{{ $message }}
@endforeach @@ -114,13 +112,13 @@ @endif {{-- ADDRESS --}} -@if(!in_array('address', $hideFields)) +@if (!in_array('address', $hideFields))
- @foreach ($errors->get('address') as $message)
{{ $message }}
@@ -129,13 +127,13 @@ @endif {{-- ADDRESS 2 --}} -@if(!in_array('address2', $hideFields)) +@if (!in_array('address2', $hideFields))
- @foreach ($errors->get('address2') as $message)
{{ $message }}
@@ -144,29 +142,29 @@ @endif {{-- POSTCODE --}} -@if(!in_array('postcode', $hideFields)) +@if (!in_array('postal_code', $hideFields))
- - @foreach ($errors->get('postcode') as $message) + @foreach ($errors->get('postal_code') as $message)
{{ $message }}
@endforeach
@endif {{-- CITY --}} -@if(!in_array('city', $hideFields)) +@if (!in_array('city', $hideFields))
- + @foreach ($errors->get('city') as $message)
{{ $message }}
@endforeach @@ -174,7 +172,7 @@ @endif {{-- COUNTRY --}} -@if(!in_array('country', $hideFields)) +@if (!in_array('country', $hideFields)) @@ -182,14 +180,9 @@ @php // * Avoir les DROM-COM + France $franceCountries = collect(\LDC\LDCCRM\Enums\Country::getValidCountries())->filter( - fn($enum) => !in_array($enum, [ - LDC\LDCCRM\Enums\Country::belgium, - LDC\LDCCRM\Enums\Country::luxembourg, - ]), - ); - $countries = collect(\LDC\LDCCRM\Enums\Country::getValidCountries())->filter( - fn($enum) => !$franceCountries->contains($enum), + fn($enum) => !in_array($enum, [LDC\LDCCRM\Enums\Country::belgium, LDC\LDCCRM\Enums\Country::luxembourg]), ); + $countries = collect(\LDC\LDCCRM\Enums\Country::getValidCountries())->filter(fn($enum) => !$franceCountries->contains($enum)); $old_country = old('country', optional($crmCustomer->country ?? null)->value ?: null); @endphp