Create a link to a single user without a password in the database

0

Currently I have a DB of budgets, clients and workshops. When I generate a customer demand I have to quote the value in the workshops and then choose the best cost x benefit and pass it on to the customer.

What I want to do is generate a link to the workshop type www.meusite.com.br/orcamentos/$$@#@@##2252525234. This hash would be the budget ID and when entering the link it will have to enter the CNPJ (this one I have in the DB). So it will enter the values and conditions and record. I'll get a notification and step into the client.

I'm developing in Laravel and VueJS. I would like to know if this is feasible, I do not want the workshops to have a login system on the site.

Did you understand?

Thank you guys!

    
asked by anonymous 13.07.2018 / 03:48

1 answer

0

I will make an example based on what I understood, and using the standard models and relationships through models.

Controller in question:

public function acao1 ($id_orcamento){
    return view('view.digitar.cpf');
}

public function acao2 ($cpf,$id_orcamento){
    try{
        $usuario = UsuarioModel::where('cpf', $cpf')->firstOrFail();
        $orcamento = OrcamentoModel::find($id_orcamento);
        return view('info.orcamento', compact('orcamento'));
    } catch (ModelNotFoundException $e) {
        return view('usuario.nao.encontrado');
    }
}

You could do something of the sort. Of course I can structure it better there, but since I'm setting an example just to give you a north, that's a good start.

You do not necessarily need to use firstorfail within a trycatch, you can simply use first () then a if( isset($usuario) ){...} else {...}

    
13.07.2018 / 16:06