Personal Notes Parmi

web.php

<?php

use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

require __DIR__.'/auth.php';

// Routes halaman
Route::get('/home-page', [App\Http\Controllers\PageController::class, 'home']);
Route::get('/about', [App\Http\Controllers\PageController::class, 'about']);
Route::get('/contact', [App\Http\Controllers\PageController::class, 'contact']);

// Routes Post
Route::resource('posts', App\Http\Controllers\PostController::class);
// Override resource routes dengan middleware
Route::middleware('auth')->group(function () {
    Route::resource('posts', App\Http\Controllers\PostController::class)
        ->except(['index', 'show']);
});

// Routes Category
Route::get('/categories', [App\Http\Controllers\CategoryController::class, 'index']);
Route::middleware('auth')->group(function () {
    Route::resource('categories', App\Http\Controllers\CategoryController::class)
        ->except(['index', 'show']);
});

// User Profile
Route::middleware('auth')->group(function () {
    Route::get('/profile', [App\Http\Controllers\UserProfileController::class, 'edit']);
    Route::put('/profile', [App\Http\Controllers\UserProfileController::class, 'updateProfile']);
    Route::put('/profile/password', [App\Http\Controllers\UserProfileController::class, 'updatePassword']);
});