From 8c898bf63b11f30a3b278847fa35f5c3c9290edf Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Mon, 2 May 2022 08:34:40 +0200 Subject: [PATCH] fixes on merchandise --- app/Datatables/Botanic/SpeciesDataTable.php | 2 +- app/Datatables/Botanic/VarietiesDataTable.php | 4 +- app/Datatables/Shop/ArticlesDataTable.php | 2 +- app/Datatables/Shop/MerchandisesDataTable.php | 3 +- app/Datatables/Shop/ProducersDataTable.php | 3 +- app/Repositories/Shop/Merchandises.php | 18 ++-- app/Repositories/Shop/Tags.php | 5 + config/cookie-consent.php | 20 ++++ config/seo.php | 101 ++++++++++++++++++ config/snooze.php | 54 ++++++++++ .../2022_04_30_220318_create_seo_table.php | 24 +++++ .../Shop/Baskets/partials/article.blade.php | 8 +- .../Baskets/partials/modalBasket.blade.php | 4 +- 13 files changed, 230 insertions(+), 18 deletions(-) create mode 100644 config/cookie-consent.php create mode 100644 config/seo.php create mode 100644 config/snooze.php create mode 100644 database/migrations/2022_04_30_220318_create_seo_table.php diff --git a/app/Datatables/Botanic/SpeciesDataTable.php b/app/Datatables/Botanic/SpeciesDataTable.php index ee891c59..fb95eee2 100644 --- a/app/Datatables/Botanic/SpeciesDataTable.php +++ b/app/Datatables/Botanic/SpeciesDataTable.php @@ -29,7 +29,7 @@ class SpeciesDataTable extends DataTable ->editColumn('tags2', function (Specie $specie) { $html = ''; foreach ($specie->tags as $tag) { - $html .= '' . $tag->slug . ' '; + $html .= Tags::getTagHtml($tag); } return $html; }) diff --git a/app/Datatables/Botanic/VarietiesDataTable.php b/app/Datatables/Botanic/VarietiesDataTable.php index 9df6c858..38d5d5b4 100644 --- a/app/Datatables/Botanic/VarietiesDataTable.php +++ b/app/Datatables/Botanic/VarietiesDataTable.php @@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column; use App\Datatables\ParentDataTable as DataTable; use App\Models\Botanic\Variety; use App\Repositories\Botanic\Varieties; +use App\Repositories\Shop\Tags; class VarietiesDataTable extends DataTable { @@ -17,7 +18,6 @@ class VarietiesDataTable extends DataTable return $this->buildQuery($model); } - public function modifier($datatables) { $datatables @@ -27,7 +27,7 @@ class VarietiesDataTable extends DataTable ->editColumn('tags2', function (Variety $variety) { $html = ''; foreach ($variety->tags as $tag) { - $html .= '' . $tag->slug . ' '; + $html .= Tags::getTagHtml($tag); } return $html; }) diff --git a/app/Datatables/Shop/ArticlesDataTable.php b/app/Datatables/Shop/ArticlesDataTable.php index dd52912a..9a31ba0f 100644 --- a/app/Datatables/Shop/ArticlesDataTable.php +++ b/app/Datatables/Shop/ArticlesDataTable.php @@ -76,7 +76,7 @@ class ArticlesDataTable extends DataTable ->editColumn('tags2', function (Article $article) { $html = ''; foreach ($article->tags as $tag) { - $html .= '' . Tags::getFullnameByTag($tag) . ' '; + $html .= Tags::getTagHtml($tag); } return $html; }) diff --git a/app/Datatables/Shop/MerchandisesDataTable.php b/app/Datatables/Shop/MerchandisesDataTable.php index 80877524..c854acba 100644 --- a/app/Datatables/Shop/MerchandisesDataTable.php +++ b/app/Datatables/Shop/MerchandisesDataTable.php @@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column; use App\Datatables\ParentDataTable as DataTable; use App\Models\Shop\Merchandise; use App\Repositories\Shop\Merchandises; +use App\Repositories\Shop\Tags; class MerchandisesDataTable extends DataTable { @@ -27,7 +28,7 @@ class MerchandisesDataTable extends DataTable ->editColumn('tags2', function (Merchandise $merchandise) { $html = ''; foreach ($merchandise->tags as $tag) { - $html .= '' . $tag->slug . ' '; + $html .= Tags::getTagHtml($tag); } return $html; }) diff --git a/app/Datatables/Shop/ProducersDataTable.php b/app/Datatables/Shop/ProducersDataTable.php index 4c667ab7..61025d39 100644 --- a/app/Datatables/Shop/ProducersDataTable.php +++ b/app/Datatables/Shop/ProducersDataTable.php @@ -6,6 +6,7 @@ use Yajra\DataTables\Html\Column; use App\Datatables\ParentDataTable as DataTable; use App\Models\Shop\Producer; use App\Repositories\Shop\Producers; +use App\Repositories\Shop\Tags; class ProducersDataTable extends DataTable { @@ -27,7 +28,7 @@ class ProducersDataTable extends DataTable ->editColumn('tags2', function (Producer $producer) { $html = ''; foreach ($producer->tags as $tag) { - $html .= '' . $tag->slug . ' '; + $html .= Tags::getTagHtml($tag); } return $html; }) diff --git a/app/Repositories/Shop/Merchandises.php b/app/Repositories/Shop/Merchandises.php index 19d731f5..2351d30f 100644 --- a/app/Repositories/Shop/Merchandises.php +++ b/app/Repositories/Shop/Merchandises.php @@ -50,21 +50,22 @@ class Merchandises return Merchandise::find($id); } + public static function getFull($id) + { + $data = self::get($id)->toArray(); + return $data; + } + public static function getTags($id) { return self::get($id)->tags; } - public static function storeTags($merchandise, $tags) - { - return Tag::storeTags($merchandise, $tags); - } - public static function store($data) { $id = isset($data['id']) ? $data['id'] : false; $item = $id ? self::update($data, $id) : self::create($data); - return $item->id; + return $item; } public static function storeFull($data) @@ -79,6 +80,11 @@ class Merchandises return $merchandise; } + public static function storeTags($merchandise, $tags) + { + return Tag::storeTags($merchandise, $tags); + } + public static function create($data) { return Merchandise::create($data); diff --git a/app/Repositories/Shop/Tags.php b/app/Repositories/Shop/Tags.php index dd773e94..ff44a376 100644 --- a/app/Repositories/Shop/Tags.php +++ b/app/Repositories/Shop/Tags.php @@ -8,6 +8,11 @@ use App\Models\Shop\Tag; class Tags { + public static function getTagHtml($tag) + { + return '' . self::getFullnameByTag($tag) . ''; + } + public static function getOptions() { return Tag::pluck('name', 'id')->toArray(); diff --git a/config/cookie-consent.php b/config/cookie-consent.php new file mode 100644 index 00000000..4f4f1662 --- /dev/null +++ b/config/cookie-consent.php @@ -0,0 +1,20 @@ + env('COOKIE_CONSENT_ENABLED', true), + + /* + * The name of the cookie in which we store if the user + * has agreed to accept the conditions. + */ + 'cookie_name' => 'laravel_cookie_consent', + + /* + * Set the cookie duration in days. Default is 365 * 20. + */ + 'cookie_lifetime' => 365 * 20, +]; diff --git a/config/seo.php b/config/seo.php new file mode 100644 index 00000000..42373685 --- /dev/null +++ b/config/seo.php @@ -0,0 +1,101 @@ + SEO::class, + + /** + * Use this setting to specify the site name that will be used in OpenGraph tags. + */ + 'site_name' => null, + + /** + * Use this setting to specify the path to the sitemap of your website. This exact path will outputted, so + * you can use both a hardcoded url and a relative path. We recommend the later. + * + * Example: '/storage/sitemap.xml' + * Do not forget the slash at the start. This will tell the search engine that the path is relative + * to the root domain and not relative to the current URL. The `spatie/laravel-sitemap` package + * is a great package to generate sitemaps for your application. + */ + 'sitemap' => null, + + /** + * Use this setting to specify whether you want self-referencing `` tags to + * be added to the head of every page. There has been some debate whether this a good practice, but experts + * from Google and Yoast say that this is the best strategy. + * See https://yoast.com/rel-canonical/. + */ + 'canonical_link' => true, + + /** + * Use this setting to specify the path to the favicon for your website. The url to it will be generated using the `secure_url()` function, + * so make sure to make the favicon accessibly from the `public` folder. + * + * You can use the following filetypes: ico, png, gif, jpeg, svg. + */ + 'favicon' => null, + + 'title' => [ + /** + * Use this setting to let the package automatically infer a title from the url, if no other title + * was given. This will be very useful on pages where you don't have an Eloquent model for, or where you + * don't want to hardcode the title. + * + * For example, if you have a with the url '/foo/about-me', we'll automatically set the title to 'About me' and append the site suffix. + */ + 'infer_title_from_url' => true, + + /** + * Use this setting to provide a suffix that will be added after the title on each page. + * If you don't want a suffix, you should specify an empty string. + */ + 'suffix' => '', + + /** + * Use this setting to provide a custom title for the homepage. We will not use the suffix on the homepage, + * so you'll need to add the suffix manually if you want that. If set to null, we'll determine the title + * just like the other pages. + */ + 'homepage_title' => null, + ], + + 'description' => [ + /** + * Use this setting to specify a fallback description, which will be used on places + * where we don't have a description set via an associated ->seo model or via + * the ->getDynamicSEOData() method. + */ + 'fallback' => null, + ], + + 'image' => [ + /** + * Use this setting to specify a fallback image, which will be used on places where you + * don't have an image set via an associated ->seo model or via the ->getDynamicSEOData() method. + * This should be a path to an image. The url to the path is generated using the `secure_url()` function (`secure_url($yourProvidedPath)`). + */ + 'fallback' => null, + ], + + 'author' => [ + /** + * Use this setting to specify a fallback author, which will be used on places where you + * don't have an author set via an associated ->seo model or via the ->getDynamicSEOData() method. + */ + 'fallback' => null, + ], + + 'twitter' => [ + /** + * Use this setting to enter your username and include that with the Twitter Card tags. + * Enter the username like 'yourUserName', so without the '@'. + */ + '@username' => null, + ], +]; diff --git a/config/snooze.php b/config/snooze.php new file mode 100644 index 00000000..9cbebe6e --- /dev/null +++ b/config/snooze.php @@ -0,0 +1,54 @@ + 'scheduled_notifications', + + /* + * The ScheduledNotification model to use. + * If you need to customise the model you can override this + */ + 'model' => ScheduledNotification::class, + + /* + * The frequency at which to send notifications + * + * Available options are everyMinute, everyFiveMinutes, everyTenMinutes, + * everyFifteenMinutes, everyThirtyMinutes, hourly, and daily. + */ + 'sendFrequency' => env('SCHEDULED_NOTIFICATION_SEND_FREQUENCY', 'everyMinute'), + + /* + * The tolerance at which to look for old notifications waiting to be sent, in seconds. + * This is to prevent sending a large amount of notifications if the command stops + * running. By default it's set to 24 hours + */ + 'sendTolerance' => env('SCHEDULED_NOTIFICATION_SEND_TOLERANCE', 60 * 60 * 24), + + /* + * The age at which to prune sent/cancelled notifications, in days. + * If set to null, pruning will be turned off. By default it's turned off + */ + 'pruneAge' => env('SCHEDULED_NOTIFICATION_PRUNE_AGE', null), + + /* + * Disable sending of scheduled notifications + * You will still be able to schedule notifications, + * and they will be sent once the scheduler is enabled. + */ + 'disabled' => env('SCHEDULED_NOTIFICATIONS_DISABLED', false), + + /* + * Should the snooze commands utilise the Laravel onOneServer functionality + */ + 'onOneServer' => env('SCHEDULED_NOTIFICATIONS_ONE_SERVER', false), + + /* + * Should snooze automatically schedule the snooze:send and snooze:prune commands + */ + 'scheduleCommands' => env('SCHEDULED_NOTIFICATIONS_SCHEDULE_COMMANDS', true), +]; diff --git a/database/migrations/2022_04_30_220318_create_seo_table.php b/database/migrations/2022_04_30_220318_create_seo_table.php new file mode 100644 index 00000000..d77a99ad --- /dev/null +++ b/database/migrations/2022_04_30_220318_create_seo_table.php @@ -0,0 +1,24 @@ +id(); + + $table->morphs('model'); + + $table->longText('description')->nullable(); + $table->string('title')->nullable(); + $table->string('image')->nullable(); + $table->string('author')->nullable(); + + $table->timestamps(); + }); + } +}; diff --git a/resources/views/Shop/Baskets/partials/article.blade.php b/resources/views/Shop/Baskets/partials/article.blade.php index 9813fbfa..474a6ce7 100644 --- a/resources/views/Shop/Baskets/partials/article.blade.php +++ b/resources/views/Shop/Baskets/partials/article.blade.php @@ -1,4 +1,4 @@ -
+
@@ -10,7 +10,7 @@ {{ $item['variation'] }}
- {{ $item['price'] }} € / unité + {{ number_format($item['price'],2) }} € / unité
@include('components.form.inputs.number', [ @@ -21,8 +21,8 @@ ])
- {{ $item['quantity'] * $item['price'] }} € - + {{ number_format($item['quantity'] * $item['price'],2) }} € +
diff --git a/resources/views/Shop/Baskets/partials/modalBasket.blade.php b/resources/views/Shop/Baskets/partials/modalBasket.blade.php index 2519d8bf..ab57812c 100644 --- a/resources/views/Shop/Baskets/partials/modalBasket.blade.php +++ b/resources/views/Shop/Baskets/partials/modalBasket.blade.php @@ -1,5 +1,5 @@
-
+
... @@ -23,7 +23,7 @@
-
+
Il y a {{ $basket['quantity'] ?? 0 }} articles dans votre panier.