Completed
Push — master ( b26393...c85308 )
by Scott
04:39
created

Categories::index()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 3
nop 1
1
<?php namespace Bedard\Shop\Api;
2
3
use Bedard\Shop\Classes\ApiController;
4
use Bedard\Shop\Repositories\CategoryRepository;
5
use Exception;
6
use Log;
7
8
class Categories extends ApiController
9
{
10
    /**
11
     * Fetch categories.
12
     *
13
     * @return \October\Rain\Database\Collection
14
     */
15
    public function index(CategoryRepository $repository)
16
    {
17
        try {
18
            $data = input();
19
20
            return $repository->fetch($data);
21
        } catch (Exception $e) {
22
            Log::error($e->getMessage());
23
24
            abort(500, $e->getMessage());
25
        }
26
    }
27
}
28