Skip to content

Instantly share code, notes, and snippets.

@mcamiano
Last active December 28, 2015 23:58
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 mcamiano/7582370 to your computer and use it in GitHub Desktop.
Save mcamiano/7582370 to your computer and use it in GitHub Desktop.
Eloquent Collection Methods; these are the methods you'd see on a model 1:M or M:M relation.
public Illuminate\Database\Eloquent\Model find( mixed $key
 mixed $default = null )   # Find a model in the collection by key.
public load( )   # Load a set of relationships onto the collection.
public Illuminate\Database\Eloquent\Collection	add( mixed $item )   # Add an item to the collection.
public boolean	contains( mixed $key )   # Determine if a key exists in the collection.
public array	modelKeys( )   # Get the array of primary keys

Methods inherited from Illuminate\Support\Collection

  • __construct()
  • __toString()
  • all()
  • collapse()
  • count()
  • each()
  • fetch()
  • filter()
  • first()
  • flatten()
  • forget()
  • get()
  • getIterator()
  • has()
  • implode()
  • isEmpty()
  • last()
  • lists()
  • make()
  • map()
  • merge()
  • offsetExists()
  • offsetGet()
  • offsetSet()
  • offsetUnset()
  • pop()
  • push()
  • put()
  • reverse()
  • shift()
  • slice()
  • sort()
  • sortBy()
  • toArray()
  • toJson()
  • values()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment