- 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/ChecklistCategoryController.php
Normal file
44
app/Http/Controllers/ChecklistCategoryController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ChecklistCategoryRequest;
|
||||
use App\Services\ChecklistCategoryService;
|
||||
|
||||
class ChecklistCategoryController extends Controller
|
||||
{
|
||||
|
||||
private $checklistCategoryService;
|
||||
|
||||
public function __construct(ChecklistCategoryService $checklistCategoryService)
|
||||
{
|
||||
$this->checklistCategoryService = $checklistCategoryService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$checklistCategories = $this->checklistCategoryService->with(['items']);
|
||||
|
||||
return response()->json($checklistCategories, 201);
|
||||
}
|
||||
|
||||
public function store(ChecklistCategoryRequest $request)
|
||||
{
|
||||
$checklistcategory = $this->checklistCategoryService->save($request->all());
|
||||
|
||||
return response()->json($checklistcategory, 201);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$checklistcategory = $this->checklistCategoryService->get($id);
|
||||
|
||||
return response()->json($checklistcategory);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checklistCategoryService->delete($id);
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user