This commit is contained in:
2025-02-16 21:11:07 +02:00
parent 87bbfc33d3
commit e8d7e6a1c4
253 changed files with 3879 additions and 72 deletions
+16 -1
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Http\Requests\Movie\CommentRequest;
use App\Models\Comment;
use App\Models\Movie;
use Illuminate\Http\Request;
@@ -31,7 +32,21 @@ class MovieController extends Controller
})
->paginate(15);
return view('movie.show', compact('movie', 'comments'));
}
public function storeComment(CommentRequest $request, string $movieSlug)
{
$movie = Movie::where('slug', $movieSlug)->firstOrFail();
Comment::create([
'entity_id' => $movie->id,
'entity_type' => Comment::TYPE_MOVIE,
'user_id' => auth()->user()->id,
'content' => $request->get('content'),
'published_at' => new \DateTime(),
]);
return redirect()->back()->with('success', 'Comment posted!');
}
}