How do I assign a view to an Submit input?

Asked

Viewed 71 times

0

I want to assign a link to an input in my code. For example: The view is called 'panel.Blade' and I wanted an input in the 'Adm.Blade' view to return it.

Controller

class Clientscontroller extends Controller { public Function showClient($id){ $client = App Clients::find($id); Return view('showclient')->with('client', $client); }

public function adm()
{
    $clients = \App\Clients::all();
    return View('/inicioadm')->with('clients', $clients);
}

public function des()
{
    $clients = \App\Clients::all()->where('Tipo', 'Desenvolvedor');
    return View('/iniciodes')->with('clients', $clients);
}

public function painel()
{
    $user = \App\User::all();
    return view('painel', ['users' => $user]);
}

public function ativar($id)
{
    $estado = \App\User::find($id);
    if ($estado->Estado == 0){
        $estado->Estado = 1;
        $estado->save();
    }
    return redirect('/painel');               
}

public function desativar($id)
{
    $estado = \App\User::find($id);
    if ($estado->Estado == 1){
        $estado->Estado = 0;
        $estado->save();
    }
    return redirect ('/painel');
}

initial.

<form method="POST" action="inicioadm">

     <h1> BEM VINDO ADMINISTRADOR! </h1> 

</form>

@foreach ($clients as $client)
    <p><a href="/cliente/{{$client->ID}}">{{$client->Nome}}</a></p>
@endforeach

<input type="submit" value="Clientes" id="clientes" name="Clientes">


</body>

1 answer

0

I do not know if I understand correctly your doubt, but if it is to send by this btn your application to another page of the Lade in the panel case having the route created you could use (I do not know be is the best way):

<input type="submit" value="Clientes" id="clientes" name="Clientes" onclick="location.href='{{ route('informe sua rota aqui') }}'" >

OR even (Maybe more recommended in this case)

<a id="btn" href="{{ route('informe sua rota aqui') }}"></a>

Browser other questions tagged

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