Skip to content

Commit c255278

Browse files
committed
adding missed parameters in authorize method, to Policy
1 parent 787d239 commit c255278

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ You can filter and paginate the data on the listing routes. To do this, send a p
230230
- [ ] OOP improvements
231231
- [ ] Add beforeAll and beforeFindById tests
232232
- [ ] Ask to confirm name
233+
- [ ] Add way to test Policies
233234

234235
## Testing
235236
```bash

src/Controller/Controller.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function index(Request $request)
3838

3939
public function show(Request $request, int $id)
4040
{
41-
$this->authorize('show', $this->searchService->getTableName());
41+
$this->authorize('show', [$this->searchService->getTableName(), $id]);
4242

4343
$request = $request->merge(['id' => $id]);
4444
$validatedData = $this->validateService->handle($request->all(), ValidateService::SHOW);
@@ -58,7 +58,7 @@ public function store(Request $request): JsonResponse
5858

5959
public function update(Request $request, $id): JsonResponse
6060
{
61-
$this->authorize('update', $this->persistenceService->getTableName());
61+
$this->authorize('update', [$this->persistenceService->getTableName(), $id]);
6262

6363
$request = $request->merge(['id' => $id]);
6464
$validatedData = $this->validateService->handle($request->all(), ValidateService::UPDATE);
@@ -69,7 +69,7 @@ public function update(Request $request, $id): JsonResponse
6969

7070
public function destroy(Request $request, int $id): JsonResponse
7171
{
72-
$this->authorize('destroy', $this->persistenceService->getTableName());
72+
$this->authorize('destroy', [$this->persistenceService->getTableName(), $id]);
7373

7474
$request = $request->merge(['id' => $id]);
7575
$validatedData = $this->validateService->handle($request->all(), ValidateService::DESTROY);

0 commit comments

Comments
 (0)