fipamo/app/Http/Controllers/DashController.php

34 lines
728 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
class DashController extends Controller
{
protected $files = [];
protected $folder = '../content/pages';
public function __construct()
{
$this->read($this->folder);
}
public function start()
{
var_dump($this->files[2]);
return view('back.start', []);
}
public function read($folder)
{
$folders = glob("$folder/*", GLOB_ONLYDIR);
foreach ($folders as $folder) {
//$this->files[] = $folder . "/";
$this->read($folder);
}
$files = array_filter(glob("$folder/*md"), 'is_file');
foreach ($files as $file) {
$this->files[] = $file;
}
}
}