Ejemplo 1: consulta de búsqueda de laravel
// Retrieve a model by its primary key...
$flight = AppModelsFlight::find(1);
// Retrieve the first model matching the query constraints...
$flight = AppModelsFlight::where('active', 1)->first();
// Shorthand for retrieving the first model matching the query constraints...
$flight = AppModelsFlight::firstWhere('active', 1);
Ejemplo 2: consulta de búsqueda de laravel
<?php
namespace AppModels;
use IlluminateDatabaseEloquentModel;
class Flight extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'flight_id';
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)