A
A
Analka2020-02-19 11:49:54
Laravel
Analka, 2020-02-19 11:49:54

How to find out what came in the Login Laravel controller?

How to find out if an email or a name has arrived?

went through a bunch of options, but did not find information about this

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    use AuthenticatesUsers;

    public function username($string)
    {
        dd($string);
        return 'username';
    }

    protected $redirectTo = RouteServiceProvider::PROFILE;

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2020-02-19
@Kostik_1993

OMG))) Where did you get the $string in the username() function if you don't have one in the trait?
There is also a request class. It is in itself and contains all the fields from your form. You need to get a name from it and check the email, this is either a regular string
UPD: here you are two morons)) Or one from two accounts!

public function username()
{
        dd(request()->all());
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question