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


PHP static::fill方法代码示例

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


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

示例1: createQuestion

 public function createQuestion(Model $questionable, $data, Model $author)
 {
     $question = new static();
     $question->fill(array_merge($data, ['author_id' => $author->id, 'author_type' => get_class($author)]));
     $questionable->questions()->save($question);
     return $question;
 }
开发者ID:DraperStudio,项目名称:Laravel-Questionable,代码行数:7,代码来源:Question.php

示例2: create

 public static function create(array $attributes)
 {
     $model = new static();
     $model->fill($attributes);
     $model->save();
     return $model;
 }
开发者ID:richarrieta,项目名称:miequipo,代码行数:7,代码来源:BaseModel.php

示例3: createAnswer

 public function createAnswer(Question $question, $data, Model $author)
 {
     $answer = new static();
     $answer->fill(array_merge($data, ['author_id' => $author->id, 'author_type' => get_class($author)]));
     $answer = $question->answers()->save($answer);
     return $answer;
 }
开发者ID:draperstudio,项目名称:laravel-questionable,代码行数:7,代码来源:Answer.php

示例4: createRating

 /**
  * @param Model $ratingable
  * @param $data
  * @param Model $author
  *
  * @return static
  */
 public function createRating(Model $ratingable, $data, Model $author)
 {
     $rating = new static();
     $rating->fill(array_merge($data, ['author_id' => $author->id, 'author_type' => get_class($author)]));
     $ratingable->ratings()->save($rating);
     return $rating;
 }
开发者ID:autocar,项目名称:rating,代码行数:14,代码来源:Rating.php

示例5: fromForm

 /**
  * Make a new photo instance from an uploaded file
  *
  * @var $file
  * @return self
  */
 public static function fromForm($file)
 {
     $photo = new static();
     $photo->file = $file;
     $photo->name = $photo->fileName();
     return $photo->fill(['path' => $photo->filePath(), 'thumbnail_path' => $photo->thumbnailPath()]);
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:13,代码来源:Photo.php

示例6: createReview

 /**
  * @param Model $reviewable
  * @param $data
  * @param Model $author
  *
  * @return static
  */
 public function createReview(Model $reviewable, $data, Model $author)
 {
     $review = new static();
     $review->fill(array_merge($data, ['author_id' => $author->id, 'author_type' => get_class($author)]));
     $reviewable->reviews()->save($review);
     return $review;
 }
开发者ID:patrickcurl,项目名称:draperstudio_laravel-reviewable,代码行数:14,代码来源:Review.php

示例7: createComment

 public function createComment(Model $commentable, $data, Model $creator)
 {
     $comment = new static();
     $comment->fill(array_merge($data, ['creator_id' => $creator->id, 'creator_type' => get_class($creator)]));
     $commentable->comments()->save($comment);
     return $comment;
 }
开发者ID:matheusgomes17,项目名称:Laravel-Commentable,代码行数:7,代码来源:Comment.php

示例8: fromFileWithEvent

 public static function fromFileWithEvent(UploadedFile $file, Event $event)
 {
     $photo = new static();
     $photo->file = $file;
     $photo->event = $event;
     $photo->eventInfo = $photo->buildEventArray($photo->event->name, $photo->event->date_start);
     return $photo->fill(['name' => $photo->fileName(), 'path' => $photo->filePath(), 'thumbnail_path' => $photo->thumbnailPath(), 'event_main' => 0]);
 }
开发者ID:jonbrobinson,项目名称:aaulyp,代码行数:8,代码来源:Event_Photo.php

示例9: current

 /**
  * Retorna inquilino logado.
  * @return Inquilino
  */
 public static function current()
 {
     $model = new static();
     $info = $model->getConnection()->get('/inquilino');
     $model->fill((array) $info);
     $model->syncOriginal();
     return $model;
 }
开发者ID:netforcecli,项目名称:erp.clients,代码行数:12,代码来源:InquilinoAtual.php

示例10: createFromFile

 public static function createFromFile(File $file, AccountInterface $account)
 {
     $baseline = new static();
     $baseline->fill($file->toArray());
     $baseline->account_id = $account->id;
     $baseline->save();
     return $baseline;
 }
开发者ID:joshwhatk,项目名称:super-scan,代码行数:8,代码来源:BaselineFile.php

示例11: init

 /**
  * @param array $attributes
  * @return Model
  */
 public static function init($attributes = [])
 {
     $model = new static(Di::getDefault()->get('mongo'), static::getDbName(), static::getSource());
     if (count($attributes) > 0) {
         $model->fill($attributes);
     }
     return $model;
 }
开发者ID:DenchikBY,项目名称:Phalcon-MongoDB-ODM,代码行数:12,代码来源:Model.php

示例12: assign

 /**
  * Assign a user to a project with a role
  *
  * @param  int   $user_id
  * @param  int   $project_id
  * @param  int   $role_id
  * @return void
  */
 public static function assign($user_id, $project_id, $role_id = 0)
 {
     if (!static::check_assign($user_id, $project_id)) {
         $fill = array('user_id' => $user_id, 'project_id' => $project_id, 'role_id' => $role_id);
         $relation = new static();
         $relation->fill($fill);
         $relation->save();
     }
 }
开发者ID:eliasyanni,项目名称:bugs,代码行数:17,代码来源:user.php

示例13: load

 public static function load($id)
 {
     $page_content_file = static::get_content_directory() . '/' . $id . '.yml';
     $page_content = file_get_contents($page_content_file);
     $page_content_data = Yaml::parse($page_content);
     $page = new static($id);
     $page->fill($page_content_data);
     return $page;
 }
开发者ID:brokunMusheen,项目名称:atomic-cms,代码行数:9,代码来源:ContentType.php

示例14: current

 /**
  * Get a new instance for the current user.
  *
  * @param null $fields
  *
  * @return static
  */
 public static function current($fields = null)
 {
     global $USER;
     $user = new static($USER->getId());
     if (!is_null($fields)) {
         $user->fill($fields);
     }
     return $user;
 }
开发者ID:arrilot,项目名称:bitrix-models,代码行数:16,代码来源:UserModel.php

示例15: first

 public function first()
 {
     $this->db->addQuery('LIMIT 1');
     $data = $this->db->first();
     if ($data) {
         $model = new static();
         $model->fill($data);
         return $model;
     }
     return [];
 }
开发者ID:nicebro,项目名称:wf-test-task,代码行数:11,代码来源:BaseModel.php


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