cms/app/Http/Controllers/Admin/Themes/ThemeEditorFileTreeController.php
Funky Waddle 37ed997989 feat(cms): initialize Laravel project structure and core CMS files
- Added standard Laravel directory structure and configuration.

- Included Svelte and Tailwind configuration for the admin interface.

- Added core PHPUnit and testing scripts.
2026-04-13 12:48:06 -05:00

34 lines
947 B
PHP

<?php
namespace App\Http\Controllers\Admin\Themes;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Themes\ThemeFileTreeRequest;
use App\Services\ThemeEditorService;
use Exception;
/**
* Controller for retrieving the file tree of a theme.
*/
class ThemeEditorFileTreeController extends Controller
{
/**
* Handle the file tree request.
*
* @param \App\Http\Requests\Admin\Themes\ThemeFileTreeRequest $request
* @param \App\Services\ThemeEditorService $editorService
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(ThemeFileTreeRequest $request, ThemeEditorService $editorService)
{
$theme = $request->query('theme');
try {
$tree = $editorService->getFileTree($theme);
return response()->json($tree);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 404);
}
}
}