added a new route to edit the profile

This commit is contained in:
Ghostie 2024-08-22 20:07:30 -05:00
parent c615dbbbfb
commit 85522ececc
4 changed files with 12 additions and 6 deletions

View File

@ -14,6 +14,6 @@ class ProfileController extends Controller implements HasMiddleware
public function index()
{
dd("Showing edit form...");
return view("profile.index");
}
}

View File

@ -18,7 +18,7 @@
@auth
@if ($user->id === auth()->user()->id)
<a href="{{ route('profile.index', $user) }}" class="text-gray-500 hover:text-gray-600">
<a href="{{ route('profile.index') }}" class="text-gray-500 hover:text-gray-600">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round"

View File

@ -0,0 +1,6 @@
@extends('layouts.app')
@section('title', 'Edit profile')
@section('content')
@endsection

View File

@ -22,6 +22,10 @@ Route::get("/login", [LoginController::class, "index"])->name("login");
Route::post("/login", [LoginController::class, "store"]);
Route::post("/logout", [LogoutController::class, "store"])->name("logout");
// profile
Route::get("/edit-profile", [ProfileController::class, "index"])->name("profile.index");
Route::post("/edit-profile", [ProfileController::class, "store"])->name("profile.store");
Route::get("/{user:username}", [PostController::class, "index"])->name("posts.index");
Route::get("/posts/create", [PostController::class, "create"])->name("posts.create");
Route::post("/posts", [PostController::class, "store"])->name("posts.store");
@ -35,7 +39,3 @@ Route::post("/images", [ImageController::class, "store"])->name("images.store");
// likes
Route::post("/posts/{post}/likes", [LikeController::class, "store"])->name("posts.likes.store");
Route::delete("/posts/{post}/likes", [LikeController::class, "destroy"])->name("posts.likes.destroy");
// profile
Route::get("/{user:username}/edit-profile", [ProfileController::class, "index"])->name("profile.index");
Route::post("/{user:username}/edit-profile", [ProfileController::class, "store"])->name("profile.store");