lundi 8 juin 2020

Trait method guestMiddleware has not been applied, because there are collisions with other trait methods on App\Http\Controllers\Auth\AuthController

So, this is my Auth Controller in my Laravel 5.2 application:

<?php

namespace App\Http\Controllers\Auth;
//use Illuminate\Foundation\Auth\ResetsPasswords;
use App\User;
use Validator;
//use Illuminate\Foundation\Auth\ResetsPasswords;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
 use AuthenticatesAndRegistersUsers, ThrottlesLogins;
    protected $redirectTo = '/home';
    public function __construct()
    {
        $this->middleware($this->guestMiddleware(), ['except' => 'logout']);
    }
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|min:6|confirmed',
        ]);
    }
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
//use ResetsPasswords;

public function register(array $data)
{
    /*$request = new LaravelRequest();
    $request->merge([ 'email' => $data['email'] ]);
    $this->sendResetLinkEmail($request);*/

    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'voted' => 0,
        'role' => 'IZBOR',
    ]);
    }
}

and when I uncomment everything that I commented I get the error from the title. Can someone exaplain me why is this happening because in another Laravel application I used this commented code to trigger Reset password upon registration just in a different Controller and it worked normally.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UoSUbv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire