path); foreach($files as $file) { if ($file === '.' || $file === '..') { continue; } $meta = stat($bucket->path.'/'.$file); $size = ($meta['size'] / 1000); if (($meta['size'] / 1000) < 1000) { $size = ($meta['size'] / 1000); } $results[] = [ 'filename' => $file, 'is_file' => is_file($bucket->path.'/'.$file), 'meta' => [ 'size' => $this->formatBytes($meta['size']), 'updated_at' => \Carbon\Carbon::parse($meta['mtime'])->format('d.m.Y h:m:i') ] ]; } return view('bucket.single', [ 'bucket' => $bucket, 'files' => $results ]); } /** * * * @return [type] [description] * */ public function create() { return view('bucket.create'); } /** * * */ public function store() { $validated = request()->validate([ 'name' => 'required|max:255', 'description' => 'max:255', 'path' => 'present', 'is_public' => 'boolean', ]); if ($validated) { // create bucket $bucket = Bucket::create($validated); return redirect() ->route('bucket.single', [ 'id' => $bucket->id ]); } else { return back() ->withInput(); } } }