Completed
Push — master ( 882deb...45265e )
by Sherif
03:17
created

ReportsController::getReport()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 3
nc 2
nop 3
1
<?php
2
namespace App\Modules\V1\Reporting\Http\Controllers;
3
4
use Illuminate\Foundation\Http\FormRequest;
5
use Illuminate\Http\Request;
6
use App\Modules\V1\Core\Http\Controllers\BaseApiController;
7
8
class ReportsController extends BaseApiController
9
{
10
    /**
11
     * The name of the model that is used by the base api controller 
12
     * to preform actions like (add, edit ... etc).
13
     * @var string
14
     */
15
    protected $model               = 'reports';
16
17
    /**
18
     * List of all route actions that the base api controller
19
     * will skip permissions check for them.
20
     * @var array
21
     */
22
    protected $skipPermissionCheck = ['getReport'];
23
24
    /**
25
     * Render the total income report db view between the given two dates.
26
     *
27
     * @param  \Illuminate\Http\Request  $request
28
     * @param  string  $reportName
29
     * @param  integer $perPage
30
     * @return \Illuminate\Http\Response
31
     */
32
    public function getReport(Request $request, $reportName, $perPage = 0) 
33
    {
34
        if ($this->model) 
35
        {
36
            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->getReport($reportName, $request->all(), $perPage), 200);
37
        }
38
    }
39
}
40