this is the blade.php
<h1> Cadastro de clientes </h1>
<hr/>
@if(count($cliente)>0)
<ul>
@foreach($cliente as $cliente)
<li>{{$nome->nome}}</li>
<li>{{$endereco->endereco}}</li>
<li>{{$email->email}}</li>
<li>{{$celular->celular}}</li>
@endforeach
</ul>
@else
<h4>Não há clientes</hr>
@endif
This is the model:
<?php
namespace App;
Use Illuminate\Database\Eloquent\Model;
class Cliente extends Model{
protected $table = 'cliente';
public $timestamps = false;
}
and this is the controller:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Cliente;
class CadCliController extends Controller {
public function cadCli() {
$cliente = Cliente::all();
$array = array('cliente'=>$cliente);
return view('cadCli', $array);
}
I'm unable to show the table on foreach. keep showing the error that variable nome is undefined. Could you please help?....................................................................................