Skip to content

Instantly share code, notes, and snippets.

@aranw
Created November 9, 2012 11:42
Show Gist options
  • Save aranw/4045289 to your computer and use it in GitHub Desktop.
Save aranw/4045289 to your computer and use it in GitHub Desktop.
Models
class Album extends \Eloquent
{
public static $timestamps = true;
public function artist()
{
return $this->belongs_to('Askonasholt\Artist');
}
public function image()
{
return $this->belongs_to('Askonasholt\Image');
}
}
class Artist extends \Eloquent
{
public static $timestamps = true;
public function album()
{
return $this->has_many('Askonasholt\Album');
}
}
Artist
-----
ID
Name
Album
-----------
ID
artist_id
image_id
Images
------
ID
Name
class Image extends \Eloquent
{
public function album()
{
return $this->has_many('Askonasholt\Album');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment