Hello everyone, Testing the REST API to create a user, I created a small menu along the root of /home with the element “Create user” and the URL /testing_demo_user_update in the handler which curl call /register
The question is that when the validation error goes to /home , and not to /testing_demo_user_update , although I wrote this URL in app/Http/Controllers/Auth/RegisterController.php :
<?php namespace App\Http\Controllers\Auth; use App\User; class RegisterController extends Controller { use RegistersUsers; protected $redirectTo = '/testing_demo_user_update'; // !!!!!!!! /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest'); } use funcsTrait; protected function validator(array $data) { $this->debToFile( ' RegisterController::validator:: $data::' . print_r( $data, true ), false ); // ЭТОТ КОД ВЫЗЫВАЕТСЯ return Validator::make($data, [ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', ]); } protected function create(array $data) { $this->debToFile( ' RegisterController:create:: $data::' . print_r( $data, true ), false ); // ЭТОТ КОД НЕ ВЫЗЫВАЕТСЯ return User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), ]); } } And how to get a return to /testing_demo_user_update ?
Thank !
I posted in app / Http / Controllers / Auth / RegisterController.php middleware ('guest')
and checked that in app / Http / Middleware / RedirectIfAuthenticated.php code
if (Auth::guard($guard)->check()) { return redirect('/home'); } not called
Anyway, there is a transition to “/ Home” by displaying a message:
Redirecting to “/ home”
Having rummaged in the code I found that the transition is performed via the setTargetUrl method in the constructor of the RedirectResponse class file in the file vendor / symfony / http-foundation / RedirectResponse.php
There are no RedirectResponse links in my project files.
What can cause this method and how to remove it?
Still looking for solutions ... Rummaging through the code, I found that there is a definition of the RedirectResponse class in the file vendor / laravel / framework / src / Illuminate / Http / RedirectResponse.php
But the vendor / symfony / http-foundation / RedirectResponse.php class is called.
Can this be rewritten somewhere?
I inserted into my control and model challenge
use Illuminate\Http\RedirectResponse; but unsuccessfully...