// 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);
<?php
namespace AppModels;
use IlluminateDatabaseEloquentModel;
class Flight extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'flight_id';
}
<?php
namespace AppModels;
use IlluminateDatabaseEloquentModel;
class Flight extends Model
{
/**
* The connection name for the model.
*
* @var string
*/
protected $connection = 'connection-name';
}