-4
metodo gera pdf:
ordemController
$ordens = Ordem::all();
return \PDF::loadView('ordem.detalhes', compact('ordens'))
->setPaper('a4', 'landscape')
->stream('export.pdf');
view
<h1 class="text-warning">Ordem numero: {{$o->cliente_id}}</h1>
<ul>
<li>
<b>Cliente:</b> {{ $o->cliente->nome}}
</li>
<li>
<b>Telefone:</b> {{ $o->cliente->telefone}}
</li>
<li>
<b>Data:</b> {{ $o->data }}
</li>
<li>
<b>Problema:</b> {{ $o->problema }}
</li>
<li>
<b>Valor :</b> R$ {{ $o->valor }}
</li>
<li>
<b>Produto incluso :</b> {{ $o->produto->nome}}
</li>
<li>
<b>Tipo de servico :</b> {{ $o->servico->nome}}
</li>
listing view:
<div class="container-fluid">
<table class="table table-condensed table-striped table-bordered
table-hover">
<tr>
<th>Nome</th>
<th> Descrição</th>
<th class="text-right"> Valor entrada </th>
<th class="text-right"> Valor saída</th>
<th class="text-right"> Qtd. estoque </th>
<th class="text-center">Opções</th>
</tr>
@foreach($produtos as $p)
<tr class="{{$p->qtd_estoque <=2?'danger':''}}">
<td>{{$p->nome}}</td>
<td>{{$p->descricao}}</td>
<td class="text-right">{{$p->valor_entrada}}</td>
<td class="text-right">{{$p->valor_saida}}</td>
<td class="text-right">{{$p->qtd_estoque}}</td>
<td class="text-center">
<div class="btn-group" role="group">
<a href="/ordem/detalhes/ <?=$o->id ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
First of all, could you better define your problem? Second could post your full view?
– Darlei Fernando Zillmer
Method works only in list view
– Roni Cardoso
You use the wrong website read: 1, 2
– novic