当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::performInsert方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::performInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::performInsert方法的具体用法?PHP Model::performInsert怎么用?PHP Model::performInsert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::performInsert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: performInsert

 /**
  * (non-PHPdoc)
  * @see \Illuminate\Database\Eloquent\Model::performInsert()
  */
 public function performInsert(Builder $query, array $options = [])
 {
     if (!Auth::user() instanceof User) {
         App::error(function (InvalidUserException $exception) {
             Log::error($exception);
             return 'Access denid for creating a new ' . get_called_class();
         });
     }
     $this->attributes['active'] = 1;
     $this->attributes[self::CREATED_AT] = new \DateTime('now', new \DateTimeZone(env('APP_TIMEZONE', 'UTC')));
     $this->attributes[self::CREATED_BY] = Auth::user()->id;
     $this->attributes[self::UPDATED_AT] = new \DateTime('now', new \DateTimeZone(env('APP_TIMEZONE', 'UTC')));
     $this->attributes[self::UPDATED_BY] = Auth::user()->id;
     return parent::performInsert($query, $options);
 }
开发者ID:tlan16,项目名称:lara-doc,代码行数:19,代码来源:BaseEntityAbstract.php

示例2: performInsert

 /**
  *
  */
 protected function performInsert(\Illuminate\Database\Eloquent\Builder $query, array $options)
 {
     $this->attributes['uid'] = md5(uniqid(mt_rand(), true));
     parent::performInsert($query, $options);
 }
开发者ID:subbly,项目名称:cms,代码行数:8,代码来源:ProductCategory.php

示例3: performInsert

 /**
  * Perform a model insert operation.
  *
  * @param  EloquentBuilder $query
  * @param  array $options
  *
  * @return bool
  */
 protected function performInsert(EloquentBuilder $query, array $options = [])
 {
     if ($this->isMoved === false) {
         $this->position = $this->position !== null ? $this->position : $this->getNextAfterLastPosition();
         $this->real_depth = $this->getNewRealDepth($this->parent_id);
     }
     return parent::performInsert($query, $options);
 }
开发者ID:rexfordkelly-on-php,项目名称:ClosureTable,代码行数:16,代码来源:Entity.php

示例4: performInsert

 /**
  * @param OriginBuilder $query   Illuminate database eloquent buildere
  * @param array         $options options
  * @return bool
  */
 protected function performInsert(OriginBuilder $query, array $options = [])
 {
     if ($this->incrementing !== true && is_null($this->{$this->getKeyName()}) === true) {
         $this->{$this->getKeyName()} = $this->getKeyGen()->generate();
     }
     return parent::performInsert($query, $options);
     // TODO: Change the autogenerated stub
 }
开发者ID:xpressengine,项目名称:xpressengine,代码行数:13,代码来源:DynamicModel.php

示例5: performInsert

 /** This is just to enable a postCreate() method subclasses can implement
  * to take particular action after a new instance has been created and saved
  * <P>
  * <b><tt>performInsert</tt></b> is only called from Model::save() - 
  * So every insert will also involve a save, but not every save involves an
  * insert - SO ANYTHING THAT INVOKES postCreate() WILL ALSO CALL postSave()!
  * Put another way, postSave() will aslo be called on create, so you can put it all in there...
  * @param Builder $query
  * @param array $options
  * @return type
  */
 protected function performInsert(Builder $query, array $options = [])
 {
     $result = parent::performInsert($query, $options);
     if ($result === true) {
         $this->postCreate($options);
     }
     return $result;
 }
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:19,代码来源:PkModel.php


注:本文中的Illuminate\Database\Eloquent\Model::performInsert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。