Velocity Routes Improvement

This commit is contained in:
Devansh 2021-10-26 15:14:38 +05:30
parent 18d1cf0eb5
commit ec42983e6e
4 changed files with 18 additions and 18 deletions

View File

@ -1,11 +1,13 @@
<?php <?php
use Webkul\Velocity\Velocity; if (! function_exists('velocity')) {
/**
if (! function_exists('velocity')) { * Velocity helper.
function velocity() *
{ * @return \Webkul\Velocity\Velocity
return app()->make(Velocity::class); */
} function velocity()
{
return app()->make(\Webkul\Velocity\Velocity::class);
} }
?> }

View File

@ -4,7 +4,6 @@ namespace Webkul\Velocity\Providers;
use Illuminate\Foundation\AliasLoader; use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router; use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Webkul\Velocity\Facades\Velocity as VelocityFacade; use Webkul\Velocity\Facades\Velocity as VelocityFacade;
@ -19,9 +18,9 @@ class VelocityServiceProvider extends ServiceProvider
{ {
include __DIR__ . '/../Http/helpers.php'; include __DIR__ . '/../Http/helpers.php';
include __DIR__ . '/../Http/admin-routes.php'; include __DIR__ . '/../Routes/admin-routes.php';
include __DIR__ . '/../Http/front-routes.php'; include __DIR__ . '/../Routes/front-routes.php';
$this->app->register(EventServiceProvider::class); $this->app->register(EventServiceProvider::class);

View File

@ -1,28 +1,27 @@
<?php <?php
// Controllers use Illuminate\Support\Facades\Route;
use Webkul\Velocity\Http\Controllers\Admin\ConfigurationController; use Webkul\Velocity\Http\Controllers\Admin\ConfigurationController;
use Webkul\Velocity\Http\Controllers\Admin\ContentController; use Webkul\Velocity\Http\Controllers\Admin\ContentController;
Route::group(['middleware' => ['web', 'admin_locale']], function () { Route::group(['middleware' => ['web', 'admin_locale']], function () {
Route::prefix(config('app.admin_url') . '/velocity')->group(function () { Route::prefix(config('app.admin_url') . '/velocity')->group(function () {
Route::group(['middleware' => ['admin']], function () { Route::group(['middleware' => ['admin']], function () {
// Content Pages Route
Route::get('/content', [ContentController::class, 'index'])->defaults('_config', [ Route::get('/content', [ContentController::class, 'index'])->defaults('_config', [
'view' => 'velocity::admin.content.index' 'view' => 'velocity::admin.content.index'
])->name('velocity.admin.content.index'); ])->name('velocity.admin.content.index');
Route::get('/content/search', [ContentController::class, 'search'])->name('velocity.admin.content.search'); Route::get('/content/search', [ContentController::class, 'search'])->name('velocity.admin.content.search');
Route::get('/content/create', [ContentController::class, 'create'])->defaults('_config',[ Route::get('/content/create', [ContentController::class, 'create'])->defaults('_config', [
'view' => 'velocity::admin.content.create' 'view' => 'velocity::admin.content.create'
])->name('velocity.admin.content.create'); ])->name('velocity.admin.content.create');
Route::post('/content/create', [ContentController::class, 'store'])->defaults('_config',[ Route::post('/content/create', [ContentController::class, 'store'])->defaults('_config', [
'redirect' => 'velocity.admin.content.index' 'redirect' => 'velocity.admin.content.index'
])->name('velocity.admin.content.store'); ])->name('velocity.admin.content.store');
Route::get('/content/edit/{id}', [ContentController::class, 'edit'])->defaults('_config',[ Route::get('/content/edit/{id}', [ContentController::class, 'edit'])->defaults('_config', [
'view' => 'velocity::admin.content.edit' 'view' => 'velocity::admin.content.edit'
])->name('velocity.admin.content.edit'); ])->name('velocity.admin.content.edit');
@ -49,4 +48,4 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
])->name('velocity.admin.store.meta-data'); ])->name('velocity.admin.store.meta-data');
}); });
}); });
}); });

View File

@ -1,6 +1,6 @@
<?php <?php
// Controllers use Illuminate\Support\Facades\Route;
use Webkul\Velocity\Http\Controllers\Shop\CartController; use Webkul\Velocity\Http\Controllers\Shop\CartController;
use Webkul\Velocity\Http\Controllers\Shop\ComparisonController; use Webkul\Velocity\Http\Controllers\Shop\ComparisonController;
use Webkul\Velocity\Http\Controllers\Shop\ShopController; use Webkul\Velocity\Http\Controllers\Shop\ShopController;