Compare commits

..

2 Commits

Author SHA1 Message Date
be1bd0541c Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	templates/category/index.html.twig
2024-12-20 09:04:49 +01:00
5cde70a7b3 Form login, WIP 2024-12-05 16:44:09 +01:00
3 changed files with 64 additions and 5 deletions

View File

@ -17,4 +17,42 @@ class AffectationController extends AbstractController
'controller_name' => 'AffectationController', 'controller_name' => 'AffectationController',
]); ]);
} }
public function add(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'description' => 'nullable|string',
]);
$affectation = Affectation::create($validated);
return response()->json([
'message' => 'Affectation réussie',
'data' => $affectation
], 201);
}
public function list()
{
$affectations = Affectation::all();
return response()->json([
'data' => $affectations
], 200);
}
public function delete($id)
{
$affectation = Affectation::find($id);
if (!$affectation) {
return response()->json(['message' => ''], 404);
}
$affectation->delete();
return response()->json(['message' => ''], 200);
}
} }

View File

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block title %}Affectation{% endblock %}
{% block body %}
<div class="wrapper">
<h1>Affectation des utilisateurs.</h1>
{% for employee in employees %}
<tr>
<td>{{ employee.id }}</td>
</tr>
{% else %}
<tr>
<td colspan="7">no records found</td>
</tr>
</div>
{% endblock %}