Files
besttechfrom.eu/routes/web.php
T

81 lines
3.5 KiB
PHP
Raw Normal View History

2026-02-06 11:26:13 +02:00
<?php
2026-02-06 15:13:20 +02:00
use App\Http\Controllers\BookmarkController;
use App\Http\Controllers\CommentController;
2026-02-06 14:56:56 +02:00
use App\Http\Controllers\ProductController;
2026-02-06 14:33:11 +02:00
use App\Http\Controllers\ProfileController;
2026-02-06 15:13:20 +02:00
use App\Http\Controllers\UpvoteController;
2026-02-06 11:26:13 +02:00
use Illuminate\Support\Facades\Route;
2026-02-14 16:11:09 +02:00
Route::get('/', [ProductController::class, 'homepage'])->name('homepage');
2026-02-06 11:26:13 +02:00
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
2026-02-06 14:33:11 +02:00
// 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');
2026-02-06 14:56:56 +02:00
// 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');
2026-02-06 15:13:20 +02:00
// Upvotes
Route::post('/products/{product}/upvote', [UpvoteController::class, 'store'])->name('products.upvote');
Route::get('/upvotes', [UpvoteController::class, 'index'])->name('upvotes.index');
2026-02-06 15:13:20 +02:00
// 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');
Route::get('/bookmarks', [BookmarkController::class, 'index'])->name('bookmarks.index');
2026-02-06 14:56:56 +02:00
});
// 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');
});
2026-02-06 14:33:11 +02:00
// 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');
});