Merge branch 'laravel-11' into 'develop'

Bump laravel 11 + php 8.3 + added sitemap generator + added robots.txt

See merge request ldc-web/projets/lionor!42
This commit is contained in:
Vincent BRIDIER 2025-03-06 16:24:07 +00:00
commit 1bb3c146b3
10 changed files with 1342 additions and 1487 deletions

View file

@ -1,5 +1,5 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:latest
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.3:latest
COPY --chown=www-data:www-data . /app/srcs
USER root
RUN chmod -R 755 /app/srcs/storage
USER www-data
USER www-data

View file

@ -15,11 +15,6 @@ php artisan schedule:run
```
ldcweb:admin-secure-sync
```
### Refresh-Sitemap
#### Available Commands
```
sitemap:refresh --dry-run
```
## TODO
Après le 30 juin 2024, retirer le code de la modal concernant le jeu (cf [ce commit](https://lab.s-web.fr/ldc-web/projets/lionor/-/commit/befd6848e0bb31bf9d79bac2a1f30d3015d8b14b))

View file

@ -10,8 +10,11 @@ use App\Traits\Models\HasFlashStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;
use Uwil\SitemapGenerator\Lib\SitemapHelper;
class Product extends Model
class Product extends Model implements Sitemapable
{
use HasFactory;
use HasFlashStatus;
@ -152,6 +155,19 @@ class Product extends Model
return $this->belongsToMany(Certification::class, 'product_certification');
}
/**
* toSitemapTag method
*
* @return Url|string|array
*/
public function toSitemapTag(): Url | string | array
{
$model = $this->loadMissing('range');
$route = 'products.show';
$params = ['publishedProduct' => $model->slug];
return SitemapHelper::generateUrl($route, $params, $model);
}
/**
* BelongsTo certifications relation
*

View file

@ -9,6 +9,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;
use Uwil\SitemapGenerator\Lib\SitemapHelper;
/**
* Gamme
@ -40,7 +43,7 @@ use Illuminate\Validation\ValidationException;
*
* @package App\Models
*/
class Range extends Model
class Range extends Model implements Sitemapable
{
use HasFactory;
use HasFlashStatus;
@ -134,6 +137,19 @@ class Range extends Model
}
}
/**
* toSitemapTag method
*
* @return Url|string|array
*/
public function toSitemapTag(): Url | string | array
{
$model = $this->loadMissing('products');
$route = 'ranges.products';
$params = ['publishedRange' => $model->slug, 'publishedProduct' => $model];
return SitemapHelper::generateUrl($route, $params, $model);
}
// * RELATIONSHIPS
/**

View file

@ -10,8 +10,11 @@ use App\Traits\Models\HasFlashStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;
use Uwil\SitemapGenerator\Lib\SitemapHelper;
class Recipe extends Model
class Recipe extends Model implements Sitemapable
{
use HasFactory;
use HasFlashStatus;
@ -161,6 +164,19 @@ class Recipe extends Model
return "{$nbHours}H {$nbMinutes}M";
}
/**
* toSitemapTag method
*
* @return Url|string|array
*/
public function toSitemapTag(): Url | string | array
{
$model = $this->loadMissing('recipes');
$route = 'recipes.show';
$params = ['publishedRecipe' => $model->slug, 'publishedProduct' => $model];
return SitemapHelper::generateUrl($route, $params, $model);
}
// * RELATIONSHIPS
/**

View file

@ -3,34 +3,33 @@
"type": "project",
"description": "Site de la marque Lionor",
"require": {
"php": "^8.2",
"php": "^8.3",
"axlon/laravel-postal-code-validation": "^3.3",
"carlos-meneses/laravel-mpdf": "^2.1",
"diglactic/laravel-breadcrumbs": "^8.1.1",
"diglactic/laravel-breadcrumbs": "^9.0",
"guzzlehttp/guzzle": "^7.2",
"kaishiyoku/laravel-color-validation": "^2.1.1",
"kwaadpepper/image-resizer": "^2.1",
"kwaadpepper/refresh-sitemap": "^2.0",
"laravel/framework": "^10.0",
"kaishiyoku/laravel-color-validation": "^3.2",
"kwaadpepper/image-resizer": "^3.1",
"laravel/framework": "^11.0",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"ldc/web-admin-secure-laravel": "^2.0.0",
"mews/purifier": "^3.4",
"propaganistas/laravel-phone": "^5.0.3",
"sentry/sentry-laravel": "*",
"uwil/k8s-laravel": "1.1.0"
"uwil/admin-secure-laravel": "^3.0",
"uwil/k8s-laravel": "^1.4",
"uwil/sitemap-generator": "^3.0"
},
"require-dev": {
"doctrine/dbal": "^3.3",
"fakerphp/faker": "^1.9.1",
"kitloong/laravel-migrations-generator": "^6.8",
"krlove/eloquent-model-generator": "dev-l10-compatibility",
"kitloong/laravel-migrations-generator": "^7.0",
"larastan/larastan": "^2.6",
"laravel-lang/lang": "10.0",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.0",
"slevomat/coding-standard": "^8.10",
"spatie/laravel-ignition": "^2.0",

2542
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,108 +0,0 @@
<?php
use Spatie\Sitemap\Tags\Url;
return [
/**
* A list of url to ignore
* These are hard coded
* Each url does not have to be exhaustive
*
* For example, if you want to ignore all routes
* of the backoffice group
* just add '/backoffice' into this table
*/
'ignoreRoutes' => [
'/bo',
'/frame',
'/api'
],
/**
* This table is needed to resolve models matching
* routes
*
* it has to be filled like following
*
* 'products.meat-type' => [
* 'slugMeatType' => [MeatTypes::class, 'slug']
* ],
* 'kitchen-side.health-nutrition.balanced-menu.menu' => [
* 'type' => [BalancedMenuType::class, 'type']
* ]
*
* The index is the complete route name, the array content is an array
* within index is the argument name with its model class.
* This will allow the generator to generate a route for each of the models
* in this table
*/
'routesBinder' => [],
/**
* You can put route conditions here
* These will be used to decide whether the route should appear
* in the sitemap or not
*
* These are called in Eloquent where
*
* example
*
* 'queryConditions' => [
* 'status' => true,
* 'ocbStatus' => EleveurOcbStatus::yes()->value,
* 'star_moment' => true
* ]
*
*/
'queryConditions' => [
'status' => true,
],
/**
* The default route frequency to use with sitemap generator
*/
'routeDefaultFrequency' => Url::CHANGE_FREQUENCY_DAILY,
/**
* The default route priority to use with sitemap generator
*
* priority should be a number between 0 and 1
* https://www.sitemaps.org/protocol.html
*/
'routeDefaultPriority' => 0.5,
/**
* Frequencies for routes
* use the full or partial route name as index
* and a frequency within \Spatie\Sitemap\Tags\Url constants
*/
'routeFrequencies' => [],
/**
* Priorities for routes
* use the full or partial route name as index
* and a priority number between 0 and 1
*/
'routePriorities' => [],
/**
* Enable or disable schedule for the job
* If set to true the sitemap generator will be run
* using the 'cron' instruction
*/
'schedule' => true,
/**
* If you want to set specific
* instruction for when to schedule job
* you can set this with a cron instruction
* You can generate one using https://crontab.guru/
* https://laravel.com/docs/8.x/scheduling#schedule-frequency-options
*
* schedule must be set to true
*
* Default is every day at 15:45
*/
'cron' => '45 15 * * *'
];

View file

@ -0,0 +1,82 @@
<?php
return [
/**
* Single route names
*
* Ex:
*
* 'singlePages' => [
* 'homepage',
* ],
*/
'singlePages' => [
'home',
'engagments',
'local',
'recipes.index',
'ranges.index',
'contact.show',
'map',
'policies',
'legals'
],
/**
* Model namespaces with filters
*
* Ex:
* 'cruds' => [
* [
* 'model' => 'App\Models\Product',
* 'filters' => [
* ['published', '=', true]
* ]
* ],
* [
* 'model' => 'App\Models\Article',
* 'filters' => []
* ]
* ],
*/
'cruds' => [
[
'model' => 'App\Models\Product',
'filters' => [
['status', '=', true]
],
],
[
'model' => 'App\Models\Recipe',
'filters' => [
['status', '=', true]
],
],
[
'model' => 'App\Models\Range',
'filters' => [
['status', '=', true]
],
]
],
/**
* Enable or disable schedule for the job
* If set to true the sitemap generator will be run
* using the 'cron' instruction
*/
'schedule' => true,
/**
* If you want to set specific
* instruction for when to schedule job
* you can set this with a cron instruction
* You can generate one using https://crontab.guru/
*
* schedule must be set to true
*
* Default is every day at 15:45
*/
'cron' => '45 15 * * *',
];

View file

@ -1,2 +1,13 @@
User-agent: *
Disallow:
Disallow: /bo
User-agent: GPTBot
Disallow: /
User-agent: Amazonbot
Disallow: /
User-agent: ClaudeBot
Disallow: /
Sitemap: https://www.lionor.fr/sitemap.xml