@@ -17,54 +17,15 @@ class ItemsController extends LfmController
1717 */
1818 public function getItems (Request $ request )
1919 {
20- /*$currentPage = self::getCurrentPageFromRequest();
21- $keyword = $request->keyword;
22-
23- $perPage = $this->helper->getPaginationPerPage();
24- $items = array_merge($this->lfm->folders(), $this->lfm->files());
25-
26- $items = array_map(function ($item) {
27- return $item->fill()->attributes;
28- }, array_slice($items, ($currentPage - 1) * $perPage, $perPage));
29-
30- $c = count($items);
31-
32- if (!empty($keyword)) {
33- $items = array_values(array_filter($items, function ($item) use ($keyword) {
34- if ($this->like_match("%".$keyword."%", $item['name'])) {
35- return true;
36- } else {
37- return false;
38- }
39- }));
40- }
41-
42-
43- return [
44- 'items' => array_map(function ($item) {
45- return $item->fill()->attributes;
46- }, array_slice($items, ($currentPage - 1) * $perPage, $perPage)),
47- 'items' => $items,
48- 'paginator' => [
49- 'current_page' => $currentPage,
50- 'total' => $c,
51- 'per_page' => $perPage,
52- ],
53- 'display' => $this->helper->getDisplayMode(),
54- 'working_dir' => $this->lfm->path('working_dir'),
55- ];*/
56-
5720 $ currentPage = self ::getCurrentPageFromRequest ();
5821
5922 $ perPage = $ this ->helper ->getPaginationPerPage ();
6023 $ items = array_merge ($ this ->lfm ->folders (), $ this ->lfm ->files ());
6124
62- //var_dump($items);exit();
63-
6425 $ items = array_map (function ($ item ) {
6526 return $ item ->fill ()->attributes ;
6627 }, $ items );
67-
28+
6829 $ keyword = $ request ->keyword ;
6930 if (!empty ($ keyword )) {
7031 $ items = array_values (array_filter ($ items , function ($ item ) use ($ keyword ) {
0 commit comments