Skip to content

Commit

Permalink
Added: create function
Browse files Browse the repository at this point in the history
  • Loading branch information
hengratana committed Jan 11, 2023
1 parent 8c374da commit b4c4641
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,20 @@ public function save(array $options = [])
return $saved;
}

/**
* Save a new model and return the instance.
*
* @param array $fillables
* @param array $options
* @return \Kitar\Dynamodb\Model\Model|$this
*/
public static function create(array $fillables = [], array $options = [])
{
$instance = new static($fillables);
$instance->save($options);
return $instance;
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit b4c4641

Please sign in to comment.