Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel retrieving single record

use AppModelsFlight;

// Retrieve a model by its primary key...
$flight = Flight::find(1);

// Retrieve the first model matching the query constraints...
$flight = Flight::where('active', 1)->first();

// Alternative to retrieving the first model matching the query constraints...
$flight = Flight::firstWhere('active', 1);
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #Laravel #retrieving #single #record
ADD COMMENT
Topic
Name
4+9 =