Files
besttechfrom.eu/routes/web.php
T

79 lines
3.3 KiB
PHP

<?php
use App\Http\Controllers\BookmarkController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\UpvoteController;
use Illuminate\Support\Facades\Route;
Route::get('/', [ProductController::class, 'homepage'])->name('homepage');
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');
// Upvotes
Route::post('/products/{product}/upvote', [UpvoteController::class, 'store'])->name('products.upvote');
// Comments
Route::post('/products/{product}/comments', [CommentController::class, 'store'])->name('products.comments.store');
Route::delete('/comments/{comment}', [CommentController::class, 'destroy'])->name('comments.destroy');
// Bookmarks
Route::post('/products/{product}/bookmark', [BookmarkController::class, 'store'])->name('products.bookmark');
});
// 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');
});