Skip to content

How to use Coloquent

DavidDuwaer edited this page Aug 31, 2017 · 17 revisions
Teacher
    .where('gender', 'm')                   // sets a filter
    .with('students')                       // eager loads related models
    .with('schools.address')                // eager loads directly and indirectly related models
    .get()                                  // submits the HTTP request, returns an ES6 Promise
    .then(function (response: PluralResponse) {
        let teachers = response.getData();
    });

Clone this wiki locally