1
0
mirror of https://github.com/allerta-vvf/allerta-vvf synced 2025-06-06 00:49:21 +02:00
Files
allerta-vvf/backend/app/Http/Controllers/ServiceTypeController.php
2023-09-01 14:24:10 +02:00

37 lines
709 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\ServiceType;
use Illuminate\Http\Request;
use App\Utils\Logger;
class ServiceTypeController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return response()->json(
ServiceType::get()
);
}
/**
* Add a new ServiceType.
*/
public function create(Request $request)
{
$serviceType = new ServiceType();
$serviceType->name = $request->name;
$serviceType->save();
Logger::log("Aggiunto tipo di intervento ($serviceType->name)");
return response()->json(
$serviceType
);
}
}