Issues (25)

app/Http/Controllers/Auth/RegisterController.php (2 issues)

1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Models\User;
6
use App\Http\Controllers\Controller;
7
use Illuminate\Support\Facades\Validator;
8
use Illuminate\Foundation\Auth\RegistersUsers;
9
10
class RegisterController extends Controller
11
{
12
    /*
13
    |--------------------------------------------------------------------------
14
    | Register Controller
15
    |--------------------------------------------------------------------------
16
    |
17
    | This controller handles the registration of new users as well as their
18
    | validation and creation. By default this controller uses a trait to
19
    | provide this functionality without requiring any additional code.
20
    |
21
    */
22
23
    use RegistersUsers;
24
25
    /**
26
     * Where to redirect users after registration.
27
     *
28
     * @var string
29
     */
30
    protected $redirectTo = '/host/dashboard';
31
32
    /**
33
     * Create a new controller instance.
34
     *
35
     * @return void
36
     */
37
    public function __construct()
38
    {
39
        $this->middleware('guest');
40
    }
41
42
    public function showRegistrationForm() 
43
    {
44
        return view('quiz_host.auth.register');
45
    }
46
47
    /**
48
     * Get a validator for an incoming registration request.
49
     *
50
     * @param  array  $data
51
     * @return \Illuminate\Contracts\Validation\Validator
52
     */
53
    protected function validator(array $data)
54
    {
55
        return Validator::make($data, [
56
            'username' => 'required|string|max:255|unique:users',
57
            'email' => 'required|string|email|max:255|unique:users',
58
            'password' => 'required|string|min:6|confirmed',
59
        ]);
60
    }
61
62
    /**
63
     * Create a new user instance after a valid registration.
64
     *
65
     * @param  array  $data
66
     * @return \App\User
0 ignored issues
show
The type App\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
67
     */
68
    protected function create(array $data)
69
    {
70
        return User::create([
0 ignored issues
show
Bug Best Practice introduced by
The expression return App\Models\User::...pt($data['password']))) returns the type App\Models\User which is incompatible with the documented return type App\User.
Loading history...
71
            'username' => $data['username'],
72
            'email' => $data['email'],
73
            'password' => bcrypt($data['password']),
74
        ]);
75
    }
76
}
77