forked from projects/fipamo
ro
bc7b1fe7ec
plugged in a new feature that will allow the site to be reset to its default state, clearing out all content and configurations to start fresh
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?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');
|
|
}
|
|
}
|