Tuesday, August 13, 2019

Retrieving Models

Retrieving Models

Once you have created a model and its associated database table, you are ready to start retrieving data from your database. Think of each Eloquent model as a powerful query builder allowing you to fluently query the database table associated with the model. For example:
<?php

$flights = App\Flight::all();

foreach ($flights as $flight) {
    echo $flight->name;
}

No comments:

Post a Comment