HistoryApiController::getHistoryWithSymbol()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 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
/**
12
 * Class HistoryApiController
13
 * @package App\Http\Controllers
14
 */
15
class HistoryApiController extends ApiGuardController
16
{
17
18
    /**
19
     * @var array
20
     */
21
    protected $apiMethods = [
22
        'getHistoryWithSymbol' =>[
23
            'keyAuthentication' => true
24
        ],
25
        'getHistoryOnlyDatesAndValues'=>[
26
            'keyAuthentication' => true
27
        ]
28
    ];
29
30
31
    /**
32
     * @param Request $request
33
     * @return array|static[]
34
     */
35
    public function getHistoryWithSymbol(Request $request)
36
    {
37
        $symbol=$request->symbol_query;
38
39
        $query = DB::table('exchange_history')
40
            ->where('symbol','=',$symbol)
41
            ->get();
42
43
        return $query;
44
    }
45
46
    /**
47
     * @param Request $request
48
     * @return array|static[]
49
     */
50
    public function getHistoryOnlyDatesAndValues(Request $request)
51
    {
52
        $symbol=$request->symbol_query;
53
54
        $query = DB::table('exchange_history')
55
            ->select('symbol','dates','values')
56
            ->where('symbol','=',$symbol)
57
            ->get();
58
59
        return $query;
60
    }
61
62
63
64
}
65