Skip to content

Instantly share code, notes, and snippets.

@matula
Last active August 29, 2015 13:57
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 matula/9788454 to your computer and use it in GitHub Desktop.
Save matula/9788454 to your computer and use it in GitHub Desktop.
Helper function to var_dump either Eloquent models or a regular object/array
<?php
function sd($obj) {
if ($obj instanceof Illuminate\Database\Eloquent\Collection) {
var_dump(json_decode((string)$obj, true));
} else {
var_dump((array)$obj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment