Skip to content

Commit 9a0ca7b

Browse files
committed
Update README.md, update document to use get method instead of all method
1 parent 23d047f commit 9a0ca7b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class UserController extends Controller
149149

150150
public function index()
151151
{
152-
return $this->users->all();
152+
return $this->users->get();
153153
}
154154
}
155155
```
@@ -161,7 +161,7 @@ Or alternatively, you may use **Route Model Binding** on the controller actions
161161
```php
162162
public function index(UserRepository $user)
163163
{
164-
return $user->all();
164+
return $user->get();
165165
}
166166

167167
public function show(UserRepository $user)
@@ -170,7 +170,10 @@ public function show(UserRepository $user)
170170
// Check https://laravel.com/docs/master/authorization
171171
$this->authorize('view', $user->model());
172172

173-
return $user->all();
173+
// This $user will resolved by the id provided by the router
174+
// e.g. /api/user/1
175+
// $user will be the result of $user->id === 1
176+
return $user;
174177
}
175178
```
176179

0 commit comments

Comments
 (0)