Skip to content

Commit

Permalink
created trait to handle models w/ non id primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed May 31, 2016
1 parent 1791e77 commit 19f1fc4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Support/Traits/RelayModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Nuwave\Lighthouse\Support\Traits;

trait RelayModel
{
/**
* ID Attribute mutator.
*
* Note: Can be used if your Eloquent model doesn't
* have an id field.
*
* @return integer
*/
public function getIdAttribute()
{
return $this->attributes[$this->getKeyName()];
}
}

0 comments on commit 19f1fc4

Please sign in to comment.