diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 0138c0d..efba3f5 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -11,10 +11,10 @@ class DashboardController extends Controller public function index(Request $request, ActivityService $activityService) { $user = $request->user(); - $unreadEntities = $activityService->getUnreadEntitiesGrouped($user); + $unreadDynamics = $activityService->getUnreadEntitiesGrouped($user); return Inertia::render('Dashboard', [ - 'unreadEntities' => $unreadEntities, + 'unreadDynamics' => $unreadDynamics, ]); } } diff --git a/app/Policies/ChatPolicy.php b/app/Policies/ChatPolicy.php new file mode 100644 index 0000000..39aa39f --- /dev/null +++ b/app/Policies/ChatPolicy.php @@ -0,0 +1,67 @@ +chatable; + return $user->can('view', $chatable); + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return false; + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, Chat $chat): bool + { + return $this->view($user, $chat); + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, Chat $chat): bool + { + return false; + } + + /** + * Determine whether the user can restore the model. + */ + public function restore(User $user, Chat $chat): bool + { + return false; + } + + /** + * Determine whether the user can permanently delete the model. + */ + public function forceDelete(User $user, Chat $chat): bool + { + return false; + } +} diff --git a/resources/js/pages/Dashboard.vue b/resources/js/pages/Dashboard.vue index bf37bb7..aaac91b 100644 --- a/resources/js/pages/Dashboard.vue +++ b/resources/js/pages/Dashboard.vue @@ -14,7 +14,7 @@ defineOptions({ }); defineProps<{ - unreadEntities: Array<{ + unreadDynamics: Array<{ id: number; name: string; url: string; @@ -50,15 +50,17 @@ function formatTime(isoString: string): string {

Recent Activity

-
+
- + Dynamic @@ -102,9 +104,7 @@ function formatTime(isoString: string): string { v-if="dynamic.new_activities.length > 0" class="c-dashboard__divider" > - NEW + NEW
diff --git a/routes/channels.php b/routes/channels.php index a645d2e..d705b1d 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -8,5 +8,5 @@ Broadcast::channel('App.Models.User.{id}', function ($user, $id) { }); Broadcast::channel('chats.{chat}', function ($user, Chat $chat) { - return $user->can('view', $chat->chatable); + return $user?->can('view', $chat); });