Created
April 18, 2013 18:15
-
-
Save nWidart/5414981 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
// 1. Ajouté item X à la DB( items[id,name,modifier_id]) | |
// | |
$item = new Item; | |
$item->name = "name"; | |
$item->save(); | |
// 2. Ajouté des modifiers à un Item X | |
// | |
$modifier = new Modifier; | |
$modifier->dexterity = 1000; | |
$modifier->strength = 800; | |
$modifier->vitality = 1500; | |
$modifier->intelligence = 1800; | |
$item = Item::find( $item_id ); | |
$mods = $item->modifiers()->save($modifier); | |
// 3. Lié item X à un Character | |
// | |
$char = Character::find( $character_id ); | |
$char->items()->attach( $item_id ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment