Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Waptik's avatar

Creating a custom registration system for guest users

Hi everyone. I'm kinda new to Laravel. I'm using v5.5. I want to achieve something like http://www.chatiw.com homepage registration form. I'm trying to create a custom registration system using a new controller. This is what I want to achieve: when a user fills in the form and clicks the submit button, a jQuery Ajax api sends a get request at the backend to check some specific requirements before User::create() does his thing. But when I try it, I get an error

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
No message

Here's the code https://pastebin.com/Facdf5Ux . I even added a new route:

Route::post('check_username/{username}', 'WelcomeController@checkUsername'); 

I now added in routes/web.php

Route::post('/', 'WelcomeController@index');

but still facing same error. 2- Then i did some research and found this: https://ysk-override.com/Multi-Auth-in-laravel-54-Registration-20170202 . I followed all the steps in there but after submitting, nothing happens. I get stuck with the registration page. So can anyone help with this issue?

0 likes
5 replies
arthurvillar's avatar

You used the get() method on the route, but your form's attribute method is set to POST. Just change the route to

// Use post instead of get
Route::post('check_username/{username}', 'WelcomeController@checkUsername');
Waptik's avatar

Thanks for the feedback. But it doesn't work. i get redirected back to the form and no query performed. I even add a new post route to the root page

Route::post('/', 'WelcomeController@index');
Snapey's avatar

I think in this case you are probably better off with a get route.

In your JS I cant see how _username gets set?

but before then, have you tested your controller and route by just typing the route in your browser?

p.s. what if the user puts a space, ?, # or similar in the username?

Waptik's avatar

Yes, when I type the the ajax link in my browser it works well. When a user enters a space or special characters in the username field it'll give an error I programmed. _username was set in the upper portion of the js code that I didn't include in my pastebin. I don't know if someone can replicate what I want to achieve

Please or to participate in this conversation.