コード例 #1
0
ファイル: CartHandler.php プロジェクト: BryceHappy/lavender
 /**
  * todo move to command
  * @param $account
  */
 public function customer_logout(Entity $account)
 {
     if ($account->getEntityName() == 'customer') {
         $cart = app('App\\Cart');
         $cart->unsetCart();
     }
 }
コード例 #2
0
ファイル: BackendEntity.php プロジェクト: BryceHappy/lavender
 public function tableHeaders(Entity $entity, array $allowed)
 {
     $labels = [];
     $attributes = $entity->getAttributes();
     foreach ($allowed as $label => $attribute) {
         // use label provided
         if (is_string($label)) {
             $labels[] = $label;
             // use entity config label
         } elseif (isset($attributes[$attribute]['label'])) {
             $labels[] = $attributes[$attribute]['label'];
             // use the attribute code
         } else {
             $labels[] = $attribute;
         }
     }
     return $labels;
 }
コード例 #3
0
ファイル: MigrateEntity.php プロジェクト: lavender/framework
 protected function prepareRelationships(Entity $entity)
 {
     $attributes = [];
     $relationships = $entity->getRelationshipConfig();
     foreach ($relationships as $relationship) {
         $table = $relationship['table'];
         $foreignKey = $this->underscore($relationship['entity']) . '_id';
         $localKey = $this->underscore($entity->getEntityName()) . '_id';
         $attribute = $this->applyAttributeDefaults(['parent' => $relationship['entity']]);
         if ($relationship['type'] == Relationship::HAS_PIVOT && !isset($this->pivots[$relationship['table']])) {
             $this->pivots[$table][$foreignKey] = $attribute;
             $this->pivots[$table][$localKey] = $this->applyAttributeDefaults(['parent' => $entity->getEntityName()]);
         } elseif ($relationship['type'] == Relationship::HAS_ONE) {
             $attributes[$foreignKey] = $attribute;
         } elseif ($relationship['type'] == Relationship::BELONGS_TO) {
             $attributes[$foreignKey] = $attribute;
         }
     }
     return $attributes;
 }
コード例 #4
0
ファイル: Guard.php プロジェクト: master0mind/Lavender
 /**
  * Simply saves the given instance
  *
  * @param  Entity $instance
  *
  * @return  boolean Success
  */
 public function save(Entity $instance)
 {
     return $instance->save();
 }