change display on categories

This commit is contained in:
Ludovic CANDELLIER
2022-05-31 23:21:04 +02:00
parent 5b74c93b2e
commit e31978b1e3
10 changed files with 297 additions and 5 deletions

View File

@@ -11,9 +11,11 @@ use App\Repositories\Shop\Offers;
use App\Repositories\Shop\Tags;
use App\Repositories\Shop\TagGroups;
use App\Datatables\Shop\CategoriesDataTable;
class CategoryController extends Controller
{
public function index()
public function index(CategoriesDataTable $dataTable)
{
return $dataTable->render('Shop.Categories.list');
}
@@ -23,6 +25,7 @@ class CategoryController extends Controller
$data = self::init();
$data['display_by_rows'] = $by_rows;
$data['category'] = Categories::getFull($category_id);
$data['breadcrumb'] = Categories::getAncestorsByCategory($category_id);
$data['tags_selected'] = request()->input('tags') ?? [];
$data['articles'] = Articles::getArticlesToSell([
'category_id' => $category_id,

View File

@@ -8,6 +8,21 @@ use App\Repositories\Core\Categories as CategoryTrees;
class Categories
{
public static function getAncestorsByArticle($id)
{
$category = Articles::get($id)->categories()->first();
$ancestors = self::getAncestorsByCategory($category->id);
$ancestors[] = $category->toArray();
return $ancestors;
}
public static function getAncestorsByCategory($id)
{
$category = self::get($id);
$ancestors = $category->getAncestors()->toArray();
unset($ancestors[0]);
return $ancestors;
}
public static function getByHomepage()
{

90
config/captcha.php Normal file
View File

@@ -0,0 +1,90 @@
<?php
return [
/*
|------------------------------------------------------------
| Default Captcha Driver
|------------------------------------------------------------
|
| Here you may define the default captcha driver for your
| application. By default, we will use HCaptcha driver,
| but you may specify other drivers provided here.
|
| Supported: "hCaptcha", "reCaptcha"
|
*/
'driver' => env('CAPTCHA_DRIVER', 'hCaptcha'),
/*
|------------------------------------------------------------
| Captcha Site Key
|------------------------------------------------------------
|
| The site key is used for showing the captcha in the front
| end. You will get your site key from your preferred
| vendor like "ReCaptcha" or "HCaptcha".
|
| ReCaptcha Docs: https://developers.google.com/recaptcha/docs/display
| HCaptcha Docs: https://docs.hcaptcha.com/configuration
|
*/
'sitekey' => env('CAPTCHA_SITE_KEY', ''),
/*
|------------------------------------------------------------
| Captcha Secret Key
|------------------------------------------------------------
|
| The site key is used for validating the captcha responses.
| You will get you secret key from your preferred vendor
| like "ReCaptcha" or "HCaptcha".
|
| ReCaptcha Docs: https://developers.google.com/recaptcha/docs/display
| HCaptcha Docs: https://docs.hcaptcha.com/configuration
|
*/
'secret' => env('CAPTCHA_SECRET_KEY', ''),
/*
|------------------------------------------------------------
| Captcha Locale Configuration
|------------------------------------------------------------
|
| The captcha locale determines the default locale of your
| Captcha. You can add any locale value that supported
| by your captcha provider.
|
| ReCaptcha Language List: https://developers.google.com/recaptcha/docs/language
| HCaptcha Language List: https://docs.hcaptcha.com/languages
|
*/
'locale' => env('CAPTCHA_LOCALE', 'en'),
/*
|------------------------------------------------------------
| Captcha Theme
|------------------------------------------------------------
|
| The captcha theme is the default theme that will display
| the captcha checkbox.
|
| Supported: "light", "dark"
|
*/
'theme' => env('CAPTCHA_THEME', 'light'),
/*
|------------------------------------------------------------
| Captcha Size
|------------------------------------------------------------
|
| The captcha size is the default size of the captcha
| checkbox. According to your style preference you
| can use any of the supported captcha size.
|
| Supported: "normal", "compact"
|
*/
'size' => env('CAPTCHA_SIZE', 'normal'),
];

View File

@@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| units values
|--------------------------------------------------------------------------
| your custom units, the initial units its convert from mile to any value.
|
*/
'units' => [
'mile' => 1,
'km' => 1.609344,
'm' => (1.609344 * 1000),
'cm' => (1.609344 * 100),
'mm' => (1.609344 * 1000 * 1000),
],
/*
|--------------------------------------------------------------------------
| distance_key_prefix
|--------------------------------------------------------------------------
| if you declared more than tow points to resolve their distance,
| you will see the result in the following format:
| "1-2" => ["km" => "some result"],
| "2-3" => ["km" => "some result"],
| "3-4" => ["km" => "some result"],
| and if you want to set any prefix before each index
| you must change the below value to any value you want.
|
*/
'distance_key_prefix' => '',
];

70
config/htmlmin.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
/*
* This file is part of Laravel HTMLMin.
*
* (c) Graham Campbell <graham@alt-three.com>
* (c) Raza Mehdi <srmk@outlook.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| Automatic Blade Optimizations
|--------------------------------------------------------------------------
|
| This option enables minification of the blade views as they are
| compiled. These optimizations have little impact on php processing time
| as the optimizations are only applied once and are cached. This package
| will do nothing by default to allow it to be used without minifying
| pages automatically.
|
| Default: false
|
*/
'blade' => false,
/*
|--------------------------------------------------------------------------
| Force Blade Optimizations
|--------------------------------------------------------------------------
|
| This option forces blade minification on views where there such
| minification may be dangerous. This should only be used if you are fully
| aware of the potential issues this may cause. Obviously, this setting is
| dependent on blade minification actually being enabled.
|
| PLEASE USE WITH CAUTION
|
| Default: false
|
*/
'force' => false,
/*
|--------------------------------------------------------------------------
| Ignore Blade Files
|--------------------------------------------------------------------------
|
| Here you can specify paths, which you don't want to minify.
|
*/
'ignore' => [
'resources/views/emails',
'resources/views/html',
'resources/views/notifications',
'resources/views/markdown',
'resources/views/vendor/emails',
'resources/views/vendor/html',
'resources/views/vendor/notifications',
'resources/views/vendor/markdown',
],
];

49
config/httpauth.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication type
|--------------------------------------------------------------------------
|
| Intervention HttpAuth supports "basic" and "digest" authentication
| implementations. "Basic" is the simplest technique, while "Digest" applies
| hash functions to the password before sending it over the network.
|
| Supported: "basic", "digest"
|
*/
'type' => 'basic',
/*
|--------------------------------------------------------------------------
| Authentication name
|--------------------------------------------------------------------------
|
| Name of secured resource. Clients must authentificate to each named realm.
|
*/
'realm' => 'Secured',
/*
|--------------------------------------------------------------------------
| Authentication username
|--------------------------------------------------------------------------
|
| Username to access the secured realm in combination with a password.
|
*/
'username' => 'admin',
/*
|--------------------------------------------------------------------------
| Password
|--------------------------------------------------------------------------
|
| Password to access the secured realm in combination with the username.
|
*/
'password' => '1234'
];

17
config/min-auth.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
/*
* You can place your custom package configuration in here.
*/
return [
/**
* Toggle IP Address validation for client.
*/
'validate_ip' => true,
/**
* Set the default request header name here eg. api-key, token, x-api-key.
*/
'header_name' => 'api-key',
];

View File

@@ -17,7 +17,7 @@ return [
// Categories Models
'models' => [
'category' => App\Models\Core\Category::class,
'category' => App\Models\Shop\Category::class,
],
];

View File

@@ -1,7 +1,14 @@
<div class="row">
<div class="col-12 text-right">
@include('components.form.button', ['id' => 'by_cards', 'icon' => 'fa-th', 'class' => 'btn-success'])
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-success'])
@if ($display_by_rows ?? false)
@include('components.form.button', ['id' => 'by_cards', 'icon' => 'fa-th', 'class' => 'btn-secondary'])
@else
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-secondary'])
@endif
@include('components.form.button', ['id' => 'semences', 'icon' => 'fa-leaf', 'class' => 'bg-yellow yellow-dark'])
@include('components.form.button', ['id' => 'plants', 'icon' => 'fa-seedling', 'class' => 'bg-green text-white'])
</div>
</div>

View File

@@ -8,7 +8,14 @@
@include('Shop._partials.display_filters')
</div>
<div class="col-6">
<h1 style="font-size: 2em;">{{ $category['name'] }}</h1>
<h1 style="font-size: 1.5em;">
@foreach($breadcrumb ?? [] as $parent)
<a href="{{ route('Shop.Categories.show', ['id' => $parent['id']]) }}" style="text-decoration: none; color: inherit;">{{ $parent['name'] }}</a> /
@endforeach
<span style="font-size: 1.4em;">
{{ $category['name'] }}
</span>
</h1>
<h3 style="font-size: 1.2em;">{!! $category['description'] !!}</h3>
</div>
<div class="col-3">