summaryrefslogtreecommitdiff
path: root/app/Http/Controllers/DashboardController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http/Controllers/DashboardController.php')
-rw-r--r--app/Http/Controllers/DashboardController.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php
index 7335629..c104e77 100644
--- a/app/Http/Controllers/DashboardController.php
+++ b/app/Http/Controllers/DashboardController.php
@@ -16,10 +16,29 @@ class DashboardController extends Controller
{
$user = Auth::user();
- // You can add any additional data preparation here
- // before passing to the view
-
- return view('dashboard');
+ // Storage stats
+ $usedStorage = $user->getStorageUsed();
+ $totalStorage = $user->storage_quota;
+ $storagePercent = $totalStorage > 0 ? min(100, round(($usedStorage / $totalStorage) * 100)) : 0;
+
+ // File stats
+ $fileCount = 0; // TODO: update when DB schema supports user->files()
+ $recentFiles = collect();
+
+ // Writing stats
+ $writingCount = $user->writings()->count();
+ $recentWritings = $user->writings()->orderBy('created_at', 'desc')->take(3)->get();
+
+ return view('dashboard', compact(
+ 'user',
+ 'usedStorage',
+ 'totalStorage',
+ 'storagePercent',
+ 'fileCount',
+ 'recentFiles',
+ 'writingCount',
+ 'recentWritings',
+ ));
}
/**