當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。