You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,19 +93,21 @@ use PPSpaces\Repositories\Model as Repository;
93
93
94
94
class UserRepository extends Repository {
95
95
96
+
protected $user;
97
+
96
98
public function __construct(User $user) {
97
-
$this->model = $user;
99
+
$this->user = $user;
98
100
}
99
101
100
102
public function all($columns = ['*']) {
101
-
return $this->model
103
+
return $this->user
102
104
->role('staff')
103
105
->paginate();
104
106
}
105
107
}
106
108
```
107
109
108
-
> NOTE: Check `PPSpaces\Repositories\Model` for available methods that you may override.
110
+
> NOTE: Check `PPSpaces\Repositories\Model` for available methods that you may override. Keep in mind that you still have access to all Model instance that you've created. The `$this->user` is the instance of your `\App\User` model.
109
111
110
112
Within your `UserController` assume you have a resource controller created. Inject the `UserRepository` to the contoller.
0 commit comments