Comments + 1N relations

This commit is contained in:
Clément
2025-04-17 14:30:56 +02:00
parent ea0884d39f
commit dad50e035f
15 changed files with 380 additions and 29 deletions

View File

@@ -39,6 +39,8 @@ class BilletController extends Controller
public function show(Billet $billet)
{
//
$commentaires = $billet->commentaires;
return view('vBillet', compact('billet', 'commentaires'));
}
/**

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreCommentaireRequest;
use App\Http\Requests\UpdateCommentaireRequest;
use App\Models\Commentaire;
class CommentaireController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreCommentaireRequest $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Commentaire $commentaire)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Commentaire $commentaire)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateCommentaireRequest $request, Commentaire $commentaire)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Commentaire $commentaire)
{
//
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreCommentaireRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCommentaireRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}