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

ReportsController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 3
dl 0
loc 32
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getReport() 0 7 2
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