Compare commits
No commits in common. "be1bd0541c2cd1ed9d0e1b3391f8548ee3ce7e24" and "ffcdd4600336ec4e6d5373f6a19a816479eea1db" have entirely different histories.
be1bd0541c
...
ffcdd46003
@ -17,42 +17,4 @@ class AffectationController extends AbstractController
|
||||
'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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
{% 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 %}
|
@ -7,11 +7,11 @@
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Label</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Label</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for category in categories %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user