File tree Expand file tree Collapse file tree 5 files changed +18
-10
lines changed Expand file tree Collapse file tree 5 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 1
1
<?php namespace Octommerce \API \Controllers ;
2
2
3
+ use Input ;
3
4
use Octobro \API \Classes \ApiController ;
4
5
use Octommerce \Octommerce \Models \Brand ;
5
6
use Octommerce \API \Transformers \BrandTransformer ;
@@ -9,9 +10,10 @@ class Brands extends ApiController
9
10
10
11
public function index ()
11
12
{
12
- $ brand = Brand::get ();
13
+
14
+ $ paginator = Brand::paginate (Input::get ('number ' , 20 ));
13
15
14
- return $ this ->respondwithCollection ( $ brand , new BrandTransformer );
16
+ return $ this ->respondWithPaginator ( $ paginator , new BrandTransformer );
15
17
}
16
18
17
19
public function show ($ id )
Original file line number Diff line number Diff line change 1
1
<?php namespace Octommerce \API \Controllers ;
2
2
3
+ use Input ;
3
4
use Octobro \API \Classes \ApiController ;
4
5
use Octommerce \Octommerce \Models \Category ;
5
6
use Octommerce \API \Transformers \CategoryTransformer ;
@@ -9,9 +10,10 @@ class Categories extends ApiController
9
10
10
11
public function index ()
11
12
{
12
- $ categories = Category::get ();
13
13
14
- return $ this ->respondwithCollection ($ categories , new CategoryTransformer );
14
+ $ paginator = Category::paginate (Input::get ('number ' , 20 ));
15
+
16
+ return $ this ->respondWithPaginator ($ paginator , new CategoryTransformer );
15
17
}
16
18
17
19
public function show ($ id )
Original file line number Diff line number Diff line change 1
1
<?php namespace Octommerce \API \Controllers ;
2
2
3
+ use Input ;
3
4
use Auth ;
4
5
use Octommerce \Octommerce \Models \Order ;
5
6
use Octobro \API \Classes \ApiController ;
@@ -11,7 +12,8 @@ class Orders extends ApiController
11
12
12
13
public function index ()
13
14
{
14
- return $ this ->respondwithCollection ($ this ->user ->orders ()->orderBy ('created_at ' , 'desc ' )->get (), new OrderTransformer );
15
+ $ paginator = $ this ->user ->orders ()->orderBy ('created_at ' , 'desc ' )->paginate (Input::get ('number ' , 20 ));
16
+ return $ this ->respondWithPaginator ($ paginator , new OrderTransformer );
15
17
16
18
}
17
19
Original file line number Diff line number Diff line change 1
1
<?php namespace Octommerce \API \Controllers ;
2
2
3
+ use Input ;
3
4
use Octobro \API \Classes \ApiController ;
4
5
use Octommerce \Octommerce \Models \ProductList ;
5
6
use Octommerce \API \Transformers \ProductListTransformer ;
@@ -9,8 +10,8 @@ class ProductLists extends ApiController
9
10
10
11
public function index ()
11
12
{
12
- $ productLists = ProductList::get ();
13
- return $ this ->respondwithCollection ( $ productLists , new ProductListTransformer );
13
+ $ paginator = ProductList::paginate (Input:: get (' number ' , 20 ) );
14
+ return $ this ->respondWithPaginator ( $ paginator , new ProductListTransformer );
14
15
}
15
16
16
17
public function show ($ id )
Original file line number Diff line number Diff line change 1
1
<?php namespace Octommerce \API \Controllers ;
2
2
3
+ use Input ;
3
4
use Octobro \API \Classes \ApiController ;
4
5
use Octommerce \Octommerce \Models \Review ;
5
6
use Octommerce \API \Transformers \ReviewTransformer ;
@@ -9,9 +10,9 @@ class Reviews extends ApiController
9
10
10
11
public function index ()
11
12
{
12
- $ review = Review:: get ();
13
-
14
- return $ this ->respondwithCollection ( $ review , new ReviewTransformer );
13
+
14
+ $ paginator = Review:: paginate (Input:: get ( ' number ' , 20 ));
15
+ return $ this ->respondWithPaginator ( $ paginator , new ReviewTransformer );
15
16
}
16
17
17
18
public function show ($ id )
You can’t perform that action at this time.
0 commit comments