Differences between all() and get()

All() and get () in Eloquent basically has the same functions. All() is a static method. Get() method is on Eloquent\Builder and you can modify the query if you want to. For example User::where(‘name’,’John’). 

All() creates new query object then calls get() on it. You cannot modify the query performed. Get() will always return a collection.

All() will return all the results in the model’s table.

An example:

<?php

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

foreach ($flights as $flight) {

    echo $flight->name;

}

?>

Example: get()

$flights = App\Flight::where('active', 1)

               ->orderBy('name', 'desc')

               ->take(10)

               ->get();