UserController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use App\Models\AccountModel;
7
use App\Models\Eloquent\User;
8
use App\Models\Eloquent\UserExtra;
9
use App\Models\Eloquent\Tool\Socialite;
10
use Auth;
11
12
class UserController extends Controller
13
{
14
    /**
15
     * Show the account index.
16
     *
17
     * @return \Illuminate\View\View
18
     */
19
    public function index()
20
    {
21
        return redirect("/");
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect('/') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\View\View.
Loading history...
22
    }
23
24
    /**
25
     * Show the account dashboard.
26
     *
27
     * @return \Illuminate\View\View
28
     */
29
    public function view($uid)
30
    {
31
        $accountModel=new AccountModel();
32
        $info=$accountModel->detail($uid);
33
        if ($info==null) {
34
            return redirect("/");
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect('/') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\View\View.
Loading history...
35
        }
36
        $feed=$accountModel->feed($uid);
37
        $extraInfo=User::find($uid)->getExtra(['gender', 'contact', 'school', 'country', 'location'], 0);
38
        $socialiteInfo=User::find($uid)->getSocialiteInfo(0);
39
        return view("account.dashboard", [
40
            'page_title'=>$info["name"],
41
            'site_title'=>config("app.name"),
42
            'navigation'=>"DashBoard",
43
            'info'=>$info,
44
            'userView'=>true,
45
            'settingsView' => false,
46
            'feed'=>$feed,
47
            'extra_info' => $extraInfo,
48
            'extraDict' => UserExtra::$extraDict,
49
            'socialite_info' => $socialiteInfo,
50
            'socialites' => Socialite::getAvailable(),
51
        ]);
52
    }
53
}
54