Files

35 lines
909 B
PHP

<?php
namespace App\Http\Controllers\Admin\Templates;
use App\Http\Controllers\Admin\Controller;
use App\Models\Templates\TemplatePath;
class TemplateOverview extends Controller
{
public function index()
{
$templatePaths = TemplatePath::with('subdirectories')
->whereNull('parent_id')
->get();
return view('admin.templates.index', compact('templatePaths'));
}
/**
* Display overview of all templates in given path
*
* @param TemplatePath $templatePath
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getPath(TemplatePath $templatePath)
{
return view('admin.templates.list', [
'directory' => $templatePath,
'isWritable' => is_writable(base_path($templatePath->path))
]);
}
}