public static function search($query)
 {
     $DBresults = DB::select('SELECT file_id, name, file_name, folder_id, size, created_at FROM files WHERE user_id = ' . Auth::id() . ' AND name LIKE "%' . $query . '%"');
     $results = [];
     for ($i = 0, $c = count($DBresults); $i < $c; $i++) {
         $results[$i] = ['file_id' => $DBresults[$i]->file_id, 'created_at' => $DBresults[$i]->created_at, 'folder_id' => $DBresults[$i]->folder_id, 'name' => $DBresults[$i]->name, 'file_name' => $DBresults[$i]->file_name, 'size' => $DBresults[$i]->size, 'path' => Folder::getSubLinks($DBresults[$i]->folder_id)];
     }
     return $results;
 }
 public function folder($id)
 {
     if (Auth::guest()) {
         return Redirect::to('/');
     }
     if (!Folder::isFolder($id)) {
         return abort(404);
     }
     $root = Folder::foldersStructure();
     $this->ViewTemplate['title'] .= ' - ' . Auth::user()->username;
     $this->ViewTemplate['root'] = $root;
     $this->ViewTemplate['folder_id'] = $id;
     $this->ViewTemplate['path'] = Folder::getSubLinks($id);
     $folderView = ['folder_id' => $this->ViewTemplate['folder_id']];
     return view('template', $this->ViewTemplate)->nest('content', 'content/folder', $folderView);
 }