added routing for the comments
This commit is contained in:
parent
bb3993e05d
commit
ba57f19319
@ -6,5 +6,11 @@ use Illuminate\Http\Request;
|
||||
|
||||
class CommentController extends Controller
|
||||
{
|
||||
//
|
||||
public function store()
|
||||
{
|
||||
// validate
|
||||
|
||||
// store
|
||||
dd("commenting...");
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ class PostController extends Controller implements HasMiddleware
|
||||
public function show(User $user, Post $post)
|
||||
{
|
||||
return view("posts.show", [
|
||||
"post" => $post
|
||||
"post" => $post,
|
||||
"user" => $user
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container mx-auto flex">
|
||||
<div class="container mx-auto md:flex">
|
||||
<div class="md:w-1/2">
|
||||
<img src="{{ asset('uploads') . '/' . $post->image }}" alt="{{ $post->title }}">
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
@auth
|
||||
<p class="text-xl font-bold text-center mb-4">Add a new Comment</p>
|
||||
|
||||
<form action="#">
|
||||
<form action="{{ route('comment.store', ['post' => $post, 'user' => $user]) }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-5">
|
||||
<label for="comment" class="mb-2 block uppercase text-gray-500 font-bold">Comment</label>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\CommentController;
|
||||
use App\Http\Controllers\ImageController;
|
||||
use App\Http\Controllers\LoginController;
|
||||
use App\Http\Controllers\LogoutController;
|
||||
@ -24,4 +25,6 @@ Route::get("/posts/create", [PostController::class, "create"])->name("posts.crea
|
||||
Route::post("/posts", [PostController::class, "store"])->name("posts.store");
|
||||
Route::get("/{user:username}/posts/{post}", [PostController::class, "show"])->name("posts.show");
|
||||
|
||||
Route::post("/{user:username}/posts/{post}", [CommentController::class, "store"])->name("comment.store");
|
||||
|
||||
Route::post("/images", [ImageController::class, "store"])->name("images.store");
|
||||
|
Loading…
x
Reference in New Issue
Block a user