Completed
Push — master ( 0668ff...240876 )
by Alex
03:13
created

HistoryApiController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHistoryWithSymbol() 0 10 1
A getHistoryOnlyDatesAndValues() 0 11 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Chrisbjr\ApiGuard\Http\Controllers\ApiGuardController;
6
use DB;
7
use Illuminate\Http\Request;
8
9
use App\Http\Requests;
10
11
class HistoryApiController extends ApiGuardController
12
{
13
14
    protected $apiMethods = [
15
        'getHistoryWithSymbol' =>[
16
            'keyAuthentication' => true
17
        ],
18
        'getHistoryOnlyDatesAndValues'=>[
19
            'keyAuthentication' => true
20
        ]
21
    ];
22
23
24
    public function getHistoryWithSymbol(Request $request)
25
    {
26
        $symbol=$request->symbol_query;
27
28
        $query = DB::table('exchange_history')
29
            ->where('symbol','=',$symbol)
30
            ->get();
31
32
        return $query;
33
    }
34
35
    public function getHistoryOnlyDatesAndValues(Request $request)
36
    {
37
        $symbol=$request->symbol_query;
38
39
        $query = DB::table('exchange_history')
40
            ->select('symbol','dates','values')
41
            ->where('symbol','=',$symbol)
42
            ->get();
43
44
        return $query;
45
    }
46
47
48
49
}
50