Issues (158)

app/Http/Controllers/Auth/RegisterController.php (1 issue)

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