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>