privatisable routes

This commit is contained in:
Olivier Legat 2022-03-19 11:26:12 +01:00
parent 7f29b7691b
commit c5ff55f2d2
8 changed files with 109 additions and 100 deletions

6
CHANGELOG.md Normal file
View file

@ -0,0 +1,6 @@
## 19-03-2022
* privatisable routes
* quickorder route
* quickorder route activated by theme settings
* improved tooltip for product reference wher regate orders are active

View file

@ -1,61 +1,29 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
## Boutique Click N Collect
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## Required systems
## About Laravel
* supervisor
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
## Installation
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
```
composer install
php artisan storage:link
cd /ressources/views/front/
mkdir <theme-folder>
cd <theme-folder>
git clone <theme-repo> .
cd ../../../.../
npm install && npm run prod
Laravel is accessible, powerful, and provides tools required for large, robust applications.
```
## Learning Laravel
## Back-Office
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
Création de compte
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
```
php artisan create:admin
```
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
URL : /bo

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Models\Setting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Config;
class SettingsController extends Controller
@ -42,7 +43,14 @@ class SettingsController extends Controller
}
$settings[$i]->save();
}
return redirect()->route('bo.settings')->with('success', 'Modifications enregistrés !');
//store redirector to keep flash message from being wipe pby artisan call below
$redirector = redirect()->route('bo.settings')->with('success', 'Modifications enregistrés !');
//all settings saved : cache routes
Artisan::call('route:cache');
return $redirector;
}
return view('bo.settings', compact('settingsToPrint'));

View file

@ -2,6 +2,7 @@
namespace App\Policies;
use App\Models\Customers;
use App\Models\User;
use App\Models\Product;
use Illuminate\Auth\Access\HandlesAuthorization;
@ -22,7 +23,7 @@ class ProductPolicy
//
}
public function addToCart(User $user = null, Product $product) {
public function addToCart(Customers $user = null, Product $product) {
$now = Carbon::now();
if($product->orderable_start === null or $product->orderable_start <= $now) {
//on est entré dans la période commandable ou c'est commandable depuis toujours

File diff suppressed because one or more lines are too long

View file

@ -74,6 +74,20 @@
<small class="text-muted">Information lorsqu'un client valide une commande</small>
</label>
</div>
<div class="form-group">
Boutique Privée
<span class="tipped"
data-tippy-content="L'activation de ce paramètres va rendre la boutique privée.
<br/> Une connexion sera necéssaire pour afficher les pages publiques du site.">
<i class="fas fa-question-circle"></i>
</span>
<div class="form-row">
<label class="col-form-label switch">
<input type="checkbox" name="private_shop" value="1" @if($settingsToPrint['private_shop'] ?? 0)checked @endif>
<span class="slider round"></span>
</label>
</div>
</div>
<div class="form-group">
Mode d'inscription
<span class="tipped"

50
routes/web-shop.php Normal file
View file

@ -0,0 +1,50 @@
<?php
use Illuminate\Support\Facades\Route;
// FRONT
use App\Http\Controllers\IndexController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\BasketController;
use App\Http\Controllers\ProductsController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\QuickOrderController;
// BO
use App\Http\Controllers\Bo\OrdersController;
Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('/mentions-legales', [IndexController::class, 'legalNotice'])->name('legal-notice');
Route::get('/cgv', [IndexController::class, 'terms'])->name('terms');
Route::get('/politique-de-confidentialite', [IndexController::class, 'privacy'])->name('privacy');
Route::get('/faq', [IndexController::class, 'faq'])->name('faq');
//Route::get('/mon-panier', [BasketController::class, 'index'])->name('basket');
if (config('theme.quick_order_page')) {
Route::get('/commande-express', [QuickOrderController::class, 'index'])->name('quickorder');
}
//Catalogue
Route::get('/gammes-de-produits', [ProductsController::class, 'ranges'])->name('ranges');
Route::get('/gamme-de-produits/{rangeSlug}', [ProductsController::class, 'range'])->name('range')->middleware('redirect-slugs');
Route::get('/produits', [ProductsController::class, 'allProducts'])->name('products');
Route::get('/produits/{tagSlug}', [ProductsController::class, 'tagFiltered'])->name('products.tagfilter');
Route::get('/recherche', [ProductsController::class, 'allProducts'])->name('search');
Route::get('/produit/{productSlug}', [ProductsController::class, 'product'])->name('product')->middleware('redirect-slugs');
// Route ajax pour Single Optin
Route::post('/optin', [HomeController::class, 'addOptIn'])->name('add-single-optin');
//Contact
Route::get('/contactez-nous', [ContactController::class, 'contact'])->name('contact');
Route::post('/contactez-nous', [ContactController::class, 'contactSubmit'])->name('contact-us.submit');
Route::prefix('ajax')
->name('ajx.')
->group(function () {
Route::post('/add-to-cart', [BasketController::class, 'addToCart'])->name('cart.add');
Route::post('/multi-add-to-cart', [BasketController::class, 'addToCartLot'])->name('cart.addlot');
Route::post('/get-cart', [BasketController::class, 'getCartRequest'])->name('cart.get');
Route::post('/remove-from-cart', [BasketController::class, 'removeFromCart'])->name('cart.remove');
Route::post('/empty-cart', [BasketController::class, 'emptyCart'])->name('cart.empty');
Route::post('/get-time-slots', [OrdersController::class, 'getAvailableCreneaux'])->name('get-creneaux');
});

View file

@ -2,13 +2,7 @@
use Illuminate\Support\Facades\Route;
// FRONT
use App\Http\Controllers\IndexController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\BasketController;
use App\Http\Controllers\ProductsController;
use App\Http\Controllers\CustomerController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\QuickOrderController;
// BO
use App\Http\Controllers\Bo\DashboardController;
use App\Http\Controllers\Bo\ContentController;
@ -16,9 +10,6 @@ use App\Http\Controllers\Bo\FaqController;
use App\Http\Controllers\Bo\SettingsController;
use App\Http\Controllers\Bo\OrdersController;
use App\Http\Controllers\Bo\CreneauxController;
//use App\Http\Controllers\Bo\RangesController;
//use App\Http\Controllers\Bo\MagasinsController;
//use App\Http\Controllers\Bo\TagsController;
// AUTH
use App\Http\Controllers\Auth\LoginController;
@ -32,44 +23,15 @@ use App\Http\Controllers\Auth\LoginController;
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('/mentions-legales', [IndexController::class, 'legalNotice'])->name('legal-notice');
Route::get('/cgv', [IndexController::class, 'terms'])->name('terms');
Route::get('/politique-de-confidentialite', [IndexController::class, 'privacy'])->name('privacy');
Route::get('/faq', [IndexController::class, 'faq'])->name('faq');
//Route::get('/mon-panier', [BasketController::class, 'index'])->name('basket');
if (config('theme.quick_order_page')) {
Route::get('/commande-express', [QuickOrderController::class, 'index'])->name('quickorder');
if ((bool) config('bosettings.private_shop')) {
Route::middleware('auth:customer')
->group(function () {
require_once __DIR__ . '/web-shop.php';
});
} else {
require_once __DIR__ . '/web-shop.php';
}
//Catalogue
Route::get('/gammes-de-produits', [ProductsController::class, 'ranges'])->name('ranges');
Route::get('/gamme-de-produits/{rangeSlug}', [ProductsController::class, 'range'])->name('range')->middleware('redirect-slugs');
Route::get('/produits', [ProductsController::class, 'allProducts'])->name('products');
Route::get('/produits/{tagSlug}', [ProductsController::class, 'tagFiltered'])->name('products.tagfilter');
Route::get('/recherche', [ProductsController::class, 'allProducts'])->name('search');
Route::get('/produit/{productSlug}', [ProductsController::class, 'product'])->name('product')->middleware('redirect-slugs');
// Route ajax pour Single Optin
Route::post('/optin', [HomeController::class, 'addOptIn'])->name('add-single-optin');
//Contact
Route::get('/contactez-nous', [ContactController::class, 'contact'])->name('contact');
Route::post('/contactez-nous', [ContactController::class, 'contactSubmit'])->name('contact-us.submit');
Route::prefix('ajax')
->name('ajx.')
->group(function () {
Route::post('/add-to-cart', [BasketController::class, 'addToCart'])->name('cart.add');
Route::post('/multi-add-to-cart', [BasketController::class, 'addToCartLot'])->name('cart.addlot');
Route::post('/get-cart', [BasketController::class, 'getCartRequest'])->name('cart.get');
Route::post('/remove-from-cart', [BasketController::class, 'removeFromCart'])->name('cart.remove');
Route::post('/empty-cart', [BasketController::class, 'emptyCart'])->name('cart.empty');
Route::post('/get-time-slots', [OrdersController::class, 'getAvailableCreneaux'])->name('get-creneaux');
});
Route::namespace('App\Http\Controllers\Bo')
->prefix('bo')
->name('bo.')