What is the right way to pass variables to the Create Laravel page

Asked

Viewed 127 times

0

I’m making my TCC and I have a pre-registration page, where information like [nome, email, senha, token] and she saved on the table pre_register. Then a email for the person with a link, it contains the following:

http://server/user/be848aa209755d11bd8657816d56cc34/kFoeu0JJMtMqe7yU233VyQfIR/create

It contains, after user, the email in md5, and after / has the token and this is sent to the controller UserController@createPreUser, the method is this:

public function createPreUser($mail, $token)
{
    $register = PreRegister::where('register_token', $token)->first();
    return redirect()->action('UserController@create', compact('register'));
}

It sends to another create method:

public function create(Request $r)
{
     $user = PreRegister::find($r->register);
     return view('user.register', compact('user'));
}

This view has the rest of the registration, to fill in the information like this, I just sent it to this create method because it leaves the URL like this:

http://server/user/create? Register=104

If I sent in the other method, it would be a giant URL with email and token I know I’m doing the wrong things because it’s ugly.

  • What can I improve?
  • You have to send this data to View for POST, so that it doesn’t appear in the URL?
  • I don’t understand the idea of précadastro. If you already have the user data, you don’t need to do anything else... in any case, just send the token that redirects to the create page with data already filled. In your case.

  • the pre-registration is because the user table is almost all notnull, and I do not want the "first" registration at home, is full of fields... so I make a pre registration, with email and name and password, and after confirmation, fills the rest of fields...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.