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
or add this to require section in your composer.json file:
12
17
13
-
"laravel-repository-query/repositories": "0.*"
18
+
"laravel-repository-query/repositories": "0.1.*"
14
19
15
20
last command
16
21
17
22
composer update
18
23
19
24
### Demo
20
-
A simple demo could help us unserstand this library,Let's assume that you start to design your api which shows your user in diffent enterprises that contains several departments and positions.
25
+
A simple demo could help us unserstand this library,Let's assume that we start to design our api which shows our users in diffent enterprises that contains several departments and positions.
21
26
The relationship is Enterprises has some Departments,Department has some Positions,and Users belows to one of them,so we bulid four models '**User**','**Department**','**Position**','**Enterprise**' here
22
27
23
-
At first,in the route file, we find *web.php* and write a simple Resource Route here.(Laravel 5.2 or lower version also similiar)
28
+
<?php
24
29
25
-
Route::resource('user', 'UserController');
30
+
namespace App\Models;
31
+
32
+
use Illuminate\Notifications\Notifiable;
33
+
use Illuminate\Foundation\Auth\User as Authenticatable;
To follow the laravel docs to fill other models in our code.Here I omitted them.
74
+
75
+
In the routes folder, we find *web.php* and write a simple Resource Route here.
76
+
77
+
Route::resource('user', 'UserController');
27
78
28
79
I consider Repository as an interactive Data Layer to help us insulate models and controllers ,so here we write a method named 'getUserPaginate' in UserController.
29
80
And in Laravel Docs,they do it like this.
@@ -49,10 +100,11 @@ And in Laravel Docs,they do it like this.
0 commit comments