dashboard gereparerd
This commit is contained in:
parent
ccb3598da0
commit
b2a7e2557e
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
67
app/Policies/ChatPolicy.php
Normal file
67
app/Policies/ChatPolicy.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class ChatPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Chat $chat): bool
|
||||
{
|
||||
$chatable = $chat->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;
|
||||
}
|
||||
}
|
||||
@ -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 {
|
||||
<div class="c-dashboard__container">
|
||||
<h2 class="c-dashboard__title">Recent Activity</h2>
|
||||
|
||||
<div v-if="unreadEntities.length > 0" class="c-dashboard__grid">
|
||||
<div v-if="unreadDynamics.length > 0" class="c-dashboard__grid">
|
||||
<div
|
||||
v-for="entity in unreadEntities"
|
||||
:key="entity.id"
|
||||
v-for="dynamic in unreadDynamics"
|
||||
:key="dynamic.id"
|
||||
class="c-dashboard__card"
|
||||
>
|
||||
<div class="c-dashboard__card-header">
|
||||
<div class="c-dashboard__entity-meta">
|
||||
<span class="c-dashboard__badge-type c-dashboard__badge-type--dynamic">
|
||||
<span
|
||||
class="c-dashboard__badge-type c-dashboard__badge-type--dynamic"
|
||||
>
|
||||
Dynamic
|
||||
</span>
|
||||
<span class="c-dashboard__unread-count">
|
||||
@ -102,9 +104,7 @@ function formatTime(isoString: string): string {
|
||||
v-if="dynamic.new_activities.length > 0"
|
||||
class="c-dashboard__divider"
|
||||
>
|
||||
<span class="c-dashboard__divider-text"
|
||||
>NEW</span
|
||||
>
|
||||
<span class="c-dashboard__divider-text">NEW</span>
|
||||
</div>
|
||||
|
||||
<!-- New / Unread Activities -->
|
||||
|
||||
@ -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);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user