43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Integration\Controllers;
|
|
|
|
use App\Domains\Integration\Models\Integration;
|
|
use App\Domains\Integration\Requests\StoreIntegrationRequest;
|
|
use App\Domains\Integration\Requests\UpdateIntegrationRequest;
|
|
use Illuminate\Routing\Controller;
|
|
|
|
class IntegrationController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
return response()->json(Integration::all());
|
|
}
|
|
|
|
public function store(StoreIntegrationRequest $request)
|
|
{
|
|
$integration = Integration::create($request->validated());
|
|
|
|
return response()->json($integration, 201);
|
|
}
|
|
|
|
public function show(Integration $integration)
|
|
{
|
|
return response()->json($integration);
|
|
}
|
|
|
|
public function update(UpdateIntegrationRequest $request, Integration $integration)
|
|
{
|
|
$integration->update($request->validated());
|
|
|
|
return response()->json($integration->fresh());
|
|
}
|
|
|
|
public function destroy(Integration $integration)
|
|
{
|
|
$integration->delete();
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|