I have a table in my bd called lost_animals, it was created without using migrations.
I created a class for her:
namespace App;
use Illuminate\Database\Eloquent\Model;
class AnimalPerdido extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id', 'id_usuario', 'lat', 'lng', 'id_tipo_pet', 'raca', 'id_sexo', 'data', 'possui_identificador', 'id_cores', 'informacoes_adicionais'
];
}
I created a controller to return all the data in this table:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App/AnimalPerdidoController;
class AnimalPerdidoController extends Controller
{
//Retorna todos os cadastros
public function index()
{
$animaisPerdidos = AnimalPerdido::->get();
return response()->json($animaisPerdidos);
}
}
And on my route:
Route::get('animalperdido', 'AnimalPerdidoController@index');
How can I talk about how my lost-animals table will use this model / controller?