Skip to content

Instantly share code, notes, and snippets.

@buiquangduc
Created October 6, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buiquangduc/1f62f84db923ac0e5bd59df8e90bbac3 to your computer and use it in GitHub Desktop.
Save buiquangduc/1f62f84db923ac0e5bd59df8e90bbac3 to your computer and use it in GitHub Desktop.
Example of Reduce Complexity
<?php
// I'm pretty sure that We don't need to know the implementations to guess the return values
$person = App\Person::where('name', 'Duc')->first();
// Return value will be the first person by the name Duc
$count = App\Flight::where('active', 1)->count();
// Return value will be the number of active flight
$max = App\Flight::where('active', 1)->max('price');
// Return value will be the number of the max flight price
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment