I want to assign a blade to an input in my code. For example: The view is called 'panel.blade' and I wanted an input in the view 'adm.blade' 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');
}
inicioadm.blade
<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>