Redirect from a URL within the Laravel

Asked

Viewed 31 times

0

Good afternoon, I have a problem:

I have a system for the company that I work with that is used only internally, so it is accessed only through VPN, however we will open this system to external clients, so I have the url:

https://sistemainterno.com.br

and the customers:

https://sistemaclientes.com.br

The problem:

both systems use the same backend and frontend, I just wanted to redirect everything that comes from the url "https://sisteclientes.ocm.br" to "https://sistemainterno.com.br/clients/", the client system would only be a byword to protect the internal path and release only the Urls with /clients/, however I am doubtful on how to do this in the Aravel... someone has some solution?

Thanks in advance

1 answer

1

You have the following options

OPTION 1: Create a route Route::get('/customers','Your controller@your function');

in your controller create the function that calls the view,

    public function getView() {

    ## SUAS FUNÇÕES E OBJETOS...

   $cliente = Clientes::all(); #por exemplo
   return view('seudiretorio.suaview')->with('clientes',$clientes);

}

OPTION 2: Configure APACHE to understand that instead of /public it goes to /public/clients Example: https://www.digitalocean.com/community/tutorials/como-configurar-apache-virtual-hosts-no-ubuntu-16-04-pt

OPTION 3: When the person performs the authentication you point to that /clients instead of the /

In your Controller >> Auth >> Logincontroller for example :

$token = Users::where('email',$request->email)->select('token')->first();

##where e-mail would be your login field, if it is code you would put the input of that code.

Auth::attempt(['email'=>$request->email,'password'=>$request->password, 'token' => $token)

and no protected $redirectTo = '/clients';

Browser other questions tagged

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