Created
January 19, 2015 19:47
-
-
Save juniorb2ss/da64d92205e53a914c40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Wiki_Creature extends \Illuminate\Database\Eloquent\Model { | |
protected $table = 'wiki_creature'; | |
protected $with = ['getloot']; | |
public function getLoot() | |
{ | |
return $this->hasMany('DevAAC\Models\Wiki_Creature_Loot', 'name'); | |
} | |
} | |
class Wiki_Creature_Loot extends \Illuminate\Database\Eloquent\Model { | |
protected $table = 'wiki_creature_loot'; | |
public function getMonster() | |
{ | |
return $this->belongsToMany('DevAAC\Models\Wiki_Creature','name'); | |
} | |
} | |
//Codigo utilizado no router | |
$monster = Wiki_Creature::where('name', $name)->first(); | |
dd($monster->getLoot); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment