Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Controller::create()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Mark
5
 * Date: 12/10/2016
6
 * Time: 20:13.
7
 */
8
9
namespace App\Modules\Accounts;
10
11
use App\Classes\Email;
12
use App\Model\Account;
13
use Illuminate\Http\Request;
14
use App\Modules\ModuleEngine;
15
use Illuminate\Contracts\View\View;
16
use App\Classes\Repositories\RoleRepository;
17
use App\Http\Controllers\DashboardController;
18
use App\Classes\Repositories\AccountRepository;
19
20
/**
21
 * Class Controller.
22
 */
23
class Controller extends ModuleEngine
24
{
25
    /**
26
     * @var AccountRepository
27
     */
28
    private $accounts;
29
30
    /**
31
     * @var RoleRepository
32
     */
33
    private $roles;
34
35
    /**
36
     * This is the dashboard controller, this should be used
37
     * whenever any class is going to show the dashboard to
38
     * the user.
39
     *
40
     * DashboardController constructor.
41
     * @param AccountRepository $accounts
42
     * @param RoleRepository $roles
43
     */
44
    public function __construct(AccountRepository $accounts, RoleRepository $roles)
45
    {
46
        $this->accounts = $accounts;
47
48
        $this->roles = $roles;
49
    }
50
51
    /**
52
     * Return all the accounts viable.
53
     */
54
    public function index()
55
    {
56
        return $this->make('index')->with('accounts', $this->accounts->all());
57
    }
58
59
    /**
60
     * Form to create a new account.
61
     *
62
     * @param RoleRepository $roleRepository
63
     * @return Controller|View
64
     */
65
    public function create(RoleRepository $roleRepository)
66
    {
67
        return $this->make('create')->with('groups', $roleRepository->get());
0 ignored issues
show
Bug introduced by
The method get() does not exist on App\Classes\Repositories\RoleRepository. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

67
        return $this->make('create')->with('groups', $roleRepository->/** @scrutinizer ignore-call */ get());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
    }
69
70
    /**
71
     * Store a new account to the database.
72
     *
73
     * @param Request $request
74
     * @param Account $account
75
     * @return \Illuminate\Http\RedirectResponse
76
     */
77
    public function store(Request $request, Account $account)
78
    {
79
        $this->validate($request, ['forename' => 'required|min:1|max:255', 'surname' => 'required|min:3|max:255', 'password' => 'required|min:3|max:255', 'email' => 'required|email', 'group' => 'required|integer']);
80
81
        $account->forename = $request['forename'];
82
        $account->surname = $request['surname'];
83
        $account->role_id = $request['group'];
84
        $account->email = $request['email'];
85
        $account->setPassword($request['password'])->save();
86
87
        return redirect()->route('admin.accounts.index');
88
    }
89
}
90