- Complete GGZ Ecademy Laravel backend application - RESTful API for learning products, members, filters - Authentication and authorization system - Database migrations and seeders - Custom CRUD generator commands - Email notification system - Integration with frontend applications
This commit is contained in:
44
app/Http/Controllers/ChecklistController.php
Normal file
44
app/Http/Controllers/ChecklistController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ChecklistRequest;
|
||||
use App\Services\ChecklistService;
|
||||
|
||||
class ChecklistController extends Controller
|
||||
{
|
||||
|
||||
private $checklistService;
|
||||
|
||||
public function __construct(ChecklistService $checklistService)
|
||||
{
|
||||
$this->checklistService = $checklistService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$checklists = $this->checklistService->getAll();
|
||||
|
||||
return response()->json($checklists, 201);
|
||||
}
|
||||
|
||||
public function store(ChecklistRequest $request)
|
||||
{
|
||||
$checklist = $this->checklistService->save($request->all());
|
||||
|
||||
return response()->json($checklist, 201);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$checklist = $this->checklistService->get($id);
|
||||
|
||||
return response()->json($checklist);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checklistService->delete($id);
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user