Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created

ReportsController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App\Modules\Reporting\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use App\Modules\Core\Http\Controllers\BaseApiController;
7
use \App\Modules\Reporting\Repositories\ReportRepository;
8
use App\Modules\Core\Utl\CoreConfig;
9
10
class ReportsController extends BaseApiController
11
{
12
    /**
13
     * List of all route actions that the base api controller
14
     * will skip permissions check for them.
15
     * @var array
16
     */
17
    protected $skipPermissionCheck = ['getReport'];
18
19
    /**
20
     * Init new object.
21
     *
22
     * @param   ReportRepository $repo
23
     * @param   CoreConfig       $config
24
     * @return  void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
25
     */
26
    public function __construct(ReportRepository $repo, CoreConfig $config)
27
    {
28
        parent::__construct($repo, $config, 'App\Modules\Reporting\Http\Resources\Report');
29
    }
30
31
    /**
32
     * Render the given report name with the given conditions.
33
     *
34
     * @param  \Illuminate\Http\Request  $request
35
     * @param  string  $reportName Name of the requested report
36
     * @param  integer $perPage    Number of rows per page default all data.
37
     * @return \Illuminate\Http\Response
38
     */
39
    public function getReport(Request $request, $reportName, $perPage = 0)
40
    {
41
        return \Response::json($this->repo->getReport($reportName, $request->all(), $perPage), 200);
42
    }
43
}
44