Skip to content

Instantly share code, notes, and snippets.

@montogeek
Created November 11, 2015 02:03
Show Gist options
  • Save montogeek/9d717656207831866aa0 to your computer and use it in GitHub Desktop.
Save montogeek/9d717656207831866aa0 to your computer and use it in GitHub Desktop.
$statutes = array(
'elegible' => array(
'id' => 0,
'nombre' => 'Elegible'
),
'elegido' => array(
'id' => 1,
'nombre' => 'Elegido'
),
'no-elegido' => array(
'id' => -1,
'nombre' => 'No elegido'
)
),
$col = new \Illuminate\Support\Collection($statutes);
$elegido = $this->elegido;
$filtered = $col->filter(function($status) use ($elegido) {
return $status['id'] === $elegido;
})->collapse()->toArray();
return $filtered['nombre'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment