Ignore:
Timestamp:
10/23/21 04:03:46 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
b39afb5
Parents:
c6b84df
Message:

bug fixes, edited export, added fileSeeder for DB testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/Dashboard/IndexController.php

    rc6b84df r4b7e2d3  
    99use App\Models\User;
    1010use App\Http\Controllers\Controller;
     11use Carbon\Carbon;
     12use Illuminate\Support\Facades\DB;
    1113
    1214class IndexController extends Controller
     
    1820        );
    1921
     22        $date = Carbon::today()->subDays(5);
     23        $recentFiles = File::where('created_at', '>=', $date)->get();
     24
     25        $year = ['2021','2022','2023','2024', '2025'];
     26
     27        $file = [];
     28        foreach ($year as $key => $value) {
     29            $file[] = File::where(DB::raw("DATE_FORMAT(created_at, '%Y')"),$value)->count();
     30        }
     31
    2032        return view("dashboard.index")->with([
    2133            "counters" => $counters,
     34            "largestDepartments" => Department::orderBy('no_of_folders', 'desc')->limit(10)->get(),
     35            "folders" => Folder::all(),
     36            "files" => File::all(),
     37            "recentFiles" => $recentFiles,
     38            "year" => json_encode($year,JSON_NUMERIC_CHECK),
     39            "file" => json_encode($file,JSON_NUMERIC_CHECK),
    2240            "departments" => Department::all(),
    23             "folders" => Folder::all(),
    24             "files" => File::all()
    25         ]);
     41            "excelExt" => array("xls", "xlsx", "xls", "csv"),
     42            "textExt" => array("txt", "doc", "docx"),
     43            "imageExt" => array("png", "jpg", "jpeg"),
     44
     45         ]);
    2646    }
    2747}
Note: See TracChangeset for help on using the changeset viewer.