Register Controller return back upon Validator fail

Posted 4 months ago by DawgOnKing

I've added a few additional input fields to the default registration. When a user sends the request I capture their employee number and verify that it exists in the database. I'm trying to return back to the /register page if it does not (null).

use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

$pilot = Pilot::where('emp', request('emp'))->get()->sortBy('month')->last();
        if($pilot === null)
            flash('EMPLOYEE VALIDATION FAILED.');
            return back();
Call to undefined method Illuminate\Http\RedirectResponse::validate()

Also tried:

return redirect('/register');

Only thing that works is return abort(403).

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.