68 lines
2.7 KiB
PHP
68 lines
2.7 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\ProductController;
|
|
use App\Http\Controllers\ProfileController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::get('/', function () {
|
|
return view('welcome');
|
|
});
|
|
|
|
Auth::routes();
|
|
|
|
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
|
|
|
|
// Profile Routes
|
|
Route::middleware(['auth'])->group(function () {
|
|
Route::get('/profile/edit', [ProfileController::class, 'edit'])->name('profile.edit');
|
|
Route::put('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
|
Route::delete('/profile/avatar', [ProfileController::class, 'deleteAvatar'])->name('profile.avatar.delete');
|
|
});
|
|
|
|
Route::get('/profile/{user}', [ProfileController::class, 'show'])->name('profile.show');
|
|
|
|
// Product Routes
|
|
Route::get('/products', [ProductController::class, 'index'])->name('products.index');
|
|
Route::get('/products/{product}', [ProductController::class, 'show'])->name('products.show');
|
|
|
|
Route::middleware(['auth'])->group(function () {
|
|
Route::get('/products-submit', [ProductController::class, 'create'])->name('products.create');
|
|
Route::post('/products', [ProductController::class, 'store'])->name('products.store');
|
|
Route::get('/products/{product}/edit', [ProductController::class, 'edit'])->name('products.edit');
|
|
Route::put('/products/{product}', [ProductController::class, 'update'])->name('products.update');
|
|
Route::delete('/products/{product}', [ProductController::class, 'destroy'])->name('products.destroy');
|
|
});
|
|
|
|
// Admin/Moderator Product Management Routes
|
|
Route::middleware(['auth', 'moderator'])->group(function () {
|
|
Route::get('/products-manage', [ProductController::class, 'manage'])->name('products.manage');
|
|
Route::post('/products/{product}/approve', [ProductController::class, 'approve'])->name('products.approve');
|
|
Route::post('/products/{product}/reject', [ProductController::class, 'reject'])->name('products.reject');
|
|
});
|
|
|
|
// Admin Routes (example)
|
|
Route::middleware(['auth', 'admin'])->prefix('admin')->name('admin.')->group(function () {
|
|
Route::get('/dashboard', function () {
|
|
return 'Admin Dashboard';
|
|
})->name('dashboard');
|
|
|
|
Route::get('/users', function () {
|
|
return 'User Management (Admin Only)';
|
|
})->name('users.index');
|
|
|
|
Route::get('/settings', function () {
|
|
return 'Settings (Admin Only)';
|
|
})->name('settings');
|
|
});
|
|
|
|
// Moderator Routes (example)
|
|
Route::middleware(['auth', 'moderator'])->prefix('moderator')->name('moderator.')->group(function () {
|
|
Route::get('/dashboard', function () {
|
|
return 'Moderator Dashboard';
|
|
})->name('dashboard');
|
|
|
|
Route::get('/products/pending', function () {
|
|
return 'Pending Products (Moderator Only)';
|
|
})->name('products.pending');
|
|
});
|