File: D:/HostingSpaces/brameda/brameda.nl/app/Komma/Shop/Catalog/catalogRoutes.php
<?php declare(strict_types = 1);
namespace App\Komma\Shop\Catalog;
use App\Komma\Shop\Catalog\Kms\CatalogService;
use Illuminate\Support\Facades\Route;
final class CatalogRoutes
{
public static function web()
{
Route::get('/search', CatalogService::class . '@search')->name('catalog.search');
}
public static function kms()
{
//Note that this route hits a service. This is expected as it is hit from an artisan command and a future "index" button in the kms.
//Also notice that authentication middleware is linked to the route directly. Normally we assign auth middleware to the controllers these route hit.
Route::get('kms/catalog/index', CatalogService::class . '@index')->middleware('auth:kms');
Route::get('/kms/catalog/reindexSearch', function () {
//Saves all models so that they will be re-indexed in the search databases again.
CatalogService::reIndexSearch();
echo 'Done!';
});
}
}