2024-10-29 20:11:51 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Exports\Controllers;
|
|
|
|
|
|
|
|
use BookStack\Http\Controller;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class ImportController extends Controller
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('can:content-import');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function start(Request $request)
|
|
|
|
{
|
2024-10-29 22:21:32 +08:00
|
|
|
// TODO - Show existing imports for user (or for all users if admin-level user)
|
|
|
|
|
2024-10-29 20:11:51 +08:00
|
|
|
return view('exports.import');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function upload(Request $request)
|
|
|
|
{
|
2024-10-30 21:13:41 +08:00
|
|
|
$this->validate($request, [
|
|
|
|
'file' => ['required', 'file']
|
|
|
|
]);
|
|
|
|
|
|
|
|
$file = $request->file('file');
|
|
|
|
$file->getRealPath();
|
2024-10-29 22:21:32 +08:00
|
|
|
// TODO - Read existing ZIP upload and send through validator
|
|
|
|
// TODO - If invalid, return user with errors
|
|
|
|
// TODO - Upload to storage
|
|
|
|
// TODO - Store info/results from validator
|
|
|
|
// TODO - Send user to next import stage
|
2024-10-29 20:11:51 +08:00
|
|
|
}
|
|
|
|
}
|