Files
rkm-conectasus-ci-sandbox/api/app/Http/Controllers/ExampleController.php
Antonio Lopes dos Santos afec302c3e
All checks were successful
build-api-image / build (push) Successful in 51s
init commit
2026-08-04 16:52:02 -03:00

65 lines
1.4 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\Example;
use App\Services\ExampleService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class ExampleController extends Controller
{
protected $modulo = 'modulo';
protected $funcionalidade = 'funcionalidade';
public function index()
{
$this->auth(__FUNCTION__);
return response()->json($this->get(Example::class)->get(), Response::HTTP_OK);
}
public function create()
{
$this->auth(__FUNCTION__);
// ...
}
public function store(Request $request)
{
$this->auth(__FUNCTION__);
return response()->json(ExampleService::store($request->all()), Response::HTTP_CREATED);
}
public function show($id)
{
$this->auth(__FUNCTION__);
return response()->json($this->get(Example::class, $id), Response::HTTP_OK);
}
public function edit($id)
{
$this->auth(__FUNCTION__);
// ...
}
public function update(Request $request, $id)
{
$this->auth(__FUNCTION__);
return response()->json(ExampleService::update($id, $request->all()), Response::HTTP_OK);
}
public function destroy($id)
{
$this->auth(__FUNCTION__);
return response()->json(ExampleService::destroy($id), Response::HTTP_NO_CONTENT);
}
}