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

Completed
Push — master ( 183370...557c6a )
by Mark
02:40
created

Controller::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
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\Classes\Popup;
13
use App\Model\Account;
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
use Illuminate\Http\Request;
20
21
/**
22
 * Class Controller.
23
 */
24
class Controller extends ModuleEngine
25
{
26
    /**
27
     * @var AccountRepository
28
     */
29
    private $accounts;
30
31
    /**
32
     * @var RoleRepository
33
     */
34
    private $roles;
35
36
    /**
37
     * This is the dashboard controller, this should be used
38
     * whenever any class is going to show the dashboard to
39
     * the user.
40
     *
41
     * DashboardController constructor.
42
     * @param AccountRepository $accounts
43
     * @param RoleRepository $roles
44
     */
45
    public function __construct(AccountRepository $accounts, RoleRepository $roles)
46
    {
47
        $this->accounts = $accounts;
48
49
        $this->roles = $roles;
50
    }
51
52
    /**
53
     * Return all the accounts viable.
54
     */
55
    public function index()
56
    {
57
        return $this->make('index')->with('accounts', $this->accounts->all());
58
    }
59
60
    /**
61
     * Form to create a new account.
62
     *
63
     * @param RoleRepository $roleRepository
64
     * @return Controller|View
65
     */
66
    public function create(RoleRepository $roleRepository)
67
    {
68
        return $this->make('create')->with('groups', $roleRepository->get());
69
    }
70
71
    /**
72
     * Store a new account to the database.
73
     *
74
     * @param Request $request
75
     * @param Account $account
76
     * @return \Illuminate\Http\RedirectResponse
77
     */
78
    public function store(Request $request, Account $account)
79
    {
80
        $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',]);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 217 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
81
82
        $account->forename = $request['forename'];
83
        $account->surname = $request['surname'];
84
        $account->role_id = $request['group'];
85
        $account->email = $request['email'];
86
        $account->setPassword($request['password'])->save();
87
88
        return redirect()->route('admin.accounts.index');
89
    }
90
}
91