FEATURE: use even more route model binding

This commit is contained in:
Michal Kváček
2017-08-01 19:51:12 +02:00
parent 3275e5aeed
commit 2d60010f9e
16 changed files with 158 additions and 100 deletions
@@ -7,16 +7,21 @@ use App\Models\Templates\TemplatePath;
class TemplateOverview extends Controller
{
public function getPath($path)
/**
* Display overview of all templates in given path
*
* @param TemplatePath $templatePath
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getPath(TemplatePath $templatePath)
{
$path = TemplatePath::findOrFail($path);
return view('admin.templates.list', [
'directory' => $path,
'isWritable' => is_writable(base_path($path->path)),
'templates' => $path->templates()
'directory' => $templatePath,
'isWritable' => is_writable(base_path($templatePath->path)),
'templates' => $templatePath->templates()
->get(),
'subdirectories' => $path->subdirectories()
'subdirectories' => $templatePath->subdirectories()
->get()
]);
}