I have the following table in the database
public function up()
{
Schema::create('cidades', function (Blueprint $table) {
$table->increments('id');
$table->integer('uf');
$table->string('nome_uf');
$table->integer('mesorregiao_geografica');
$table->string('nome_nesorregiao');
$table->integer('microrregiao_geografica');
$table->string('nome_microrregiao');
$table->integer('municipio');
$table->integer('cod_municipio_completo');
$table->string('nome_municipio');
});
}
I've already created the city model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Cidade extends Model
{
//
}
I have already tried to insert data from tinker and it worked.
use App\Cidade
$cidade= new cidade
$cidade->nome_uf= "teste";
$franqueado->save();
But now I can not give a foreach, in the view .... How do I list the names of all cities and give a foreach to appear in the view?