fipamo/app/Http/Controllers/API/InitAPIController.php

40 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\Upkeep\InitService;
use App\Services\Upkeep\ResetService;
class InitAPIController extends Controller
{
protected $init;
protected $reset;
public function __construct(InitService $initService, ResetService $resetService)
{
$this->init = $initService;
$this->reset = $resetService;
}
//init stuff
public function setupFresh(Request $request)
{
$result = $this->init->fresh(json_decode($request->getContent()));
return response()->json($result)->header('Content-Type', 'application/json');
}
public function setupRestore(Request $request)
{
$result = $this->init->restore($request);
return response()->json($result)->header('Content-Type', 'application/json');
}
public function setupReset(Request $request)
{
$result = $this->reset->site($request);
return response()->json($result)->header('Content-Type', 'application/json');
}
}