mutations hebben single
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user