Added a profile controller

This commit is contained in:
Ghostie 2024-08-22 19:47:11 -05:00
parent 34792dd253
commit c615dbbbfb
3 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Routing\Controllers\HasMiddleware;
class ProfileController extends Controller implements HasMiddleware
{
public static function middleware()
{
return ["auth"];
}
public function index()
{
dd("Showing edit form...");
}
}

View File

@ -18,7 +18,7 @@
@auth
@if ($user->id === auth()->user()->id)
<a href="#" class="text-gray-500 hover:text-gray-600">
<a href="{{ route('profile.index', $user) }}" 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

@ -6,6 +6,7 @@ use App\Http\Controllers\LikeController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\LogoutController;
use App\Http\Controllers\PostController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\SignupController;
use Illuminate\Support\Facades\Route;
@ -34,3 +35,7 @@ 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");