feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.
This commit is contained in:
27
app/Http/Controllers/CommentController.php
Normal file
27
app/Http/Controllers/CommentController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CommentController extends Controller
|
||||
{
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'content' => 'required|string|max:1000',
|
||||
'commentable_id' => 'required|integer',
|
||||
'commentable_type' => 'required|string',
|
||||
]);
|
||||
|
||||
$comment = Comment::create([
|
||||
'user_id' => auth()->id(),
|
||||
'content' => $validated['content'],
|
||||
'commentable_id' => $validated['commentable_id'],
|
||||
'commentable_type' => $validated['commentable_type'],
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Commentaire ajouté.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user