From 2ab1acf0409621958d4b5898b06b3612f3a91fff Mon Sep 17 00:00:00 2001 From: Daan Meijer Date: Mon, 6 Jul 2026 17:47:14 +0200 Subject: [PATCH] mutations hebben single --- app/Http/Controllers/MutationController.php | 15 ++ app/Policies/MutationPolicy.php | 14 +- resources/js/components/MutationList.vue | 213 ++---------------- resources/js/pages/Mutations/Show.vue | 236 ++++++++++++++++++++ 4 files changed, 282 insertions(+), 196 deletions(-) create mode 100644 resources/js/pages/Mutations/Show.vue diff --git a/app/Http/Controllers/MutationController.php b/app/Http/Controllers/MutationController.php index 8bf5993..39e162c 100644 --- a/app/Http/Controllers/MutationController.php +++ b/app/Http/Controllers/MutationController.php @@ -72,6 +72,21 @@ class MutationController extends Controller return redirect()->route('dynamics.ledgers.show', [$dynamic, $ledger]); } + public function show(Request $request, Dynamic $dynamic, Ledger $ledger, Mutation $mutation) + { + $this->authorize('view', $mutation); + + $mutation->load('user', 'ledger', 'media', 'chat.messages.user'); + $dynamic = $mutation->ledger->dynamic; + + $dynamic->load('participants'); + + return inertia('Mutations/Show', [ + 'mutation' => $mutation, + 'dynamic' => $dynamic, + ]); + } + public function update(Request $request, Dynamic $dynamic, Ledger $ledger, Mutation $mutation) { $this->authorize('update', $mutation); diff --git a/app/Policies/MutationPolicy.php b/app/Policies/MutationPolicy.php index 8579a0b..691125e 100644 --- a/app/Policies/MutationPolicy.php +++ b/app/Policies/MutationPolicy.php @@ -8,6 +8,14 @@ use App\Models\User; class MutationPolicy { + /** + * Determine whether the user can view the mutation. + */ + public function view(User $user, Mutation $mutation): bool + { + return $user->can('view', $mutation->ledger); + } + /** * Determine whether the user can create mutations. */ @@ -18,12 +26,6 @@ class MutationPolicy return $dynamic->participants()->where('user_id', $user->id)->exists(); } - public function view(User $user, Mutation $mutation): bool - { - $ledger = $mutation->ledger; - return $user->can('view', $ledger); - } - /** * Determine whether the user can update the mutation. */ diff --git a/resources/js/components/MutationList.vue b/resources/js/components/MutationList.vue index ba8bd74..4fff8c8 100644 --- a/resources/js/components/MutationList.vue +++ b/resources/js/components/MutationList.vue @@ -1,64 +1,22 @@ + + + +