LiveInfoController::getCompanyFollowFromDB()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 7
Ratio 87.5 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use DB;
6
use Illuminate\Http\Request;
7
8
use App\Http\Requests;
9
10
/**
11
 * Class LiveInfoController
12
 * @package App\Http\Controllers
13
 */
14 View Code Duplication
class LiveInfoController extends Controller
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
17
    /**
18
     * LiveInfoController constructor.
19
     */
20
    public function __construct()
21
    {
22
        $this->middleware('auth');
23
    }
24
25
    /**
26
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
27
     */
28
    public function index()
29
    {
30
        $data_grid = $this->getCompanyFollowFromDB();
31
32
        $columns="['id', 'symbol', 'name', 'lastPrice', 'change', 'volume', 'open']";
33
34
        return view('live_info', ['data_grid' => $data_grid, 'columns'=> $columns]);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getCompanyFollowFromDB()
41
    {
42
        $data = DB::table('company_follow')->get();
43
44
        $data = json_encode($data);
45
46
        return $data;
47
    }
48
49
}
50