forked from projects/fipamo
ro
b2493820e9
rather than make a massive downloadable archive file for ever image on the site (which still may happen), a method has been added to make copies of imags from an external site and store them on the fresh install based on the image list saved in the created back up file it's clean but some additional error checking is needed so the process does not crash out when a file can't be located and upon completion the user can be notified of what images did not make it over in the process
31 lines
756 B
PHP
31 lines
756 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Services\InitService;
|
|
|
|
class InitAPIController extends Controller
|
|
{
|
|
protected $init;
|
|
|
|
public function __construct(InitService $initService)
|
|
{
|
|
$this->init = $initService;
|
|
}
|
|
|
|
//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');
|
|
}
|
|
}
|