Model.php 548 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Model base class. All models should extend this class.
  4. *
  5. * @package KO7
  6. * @category Models
  7. *
  8. * @copyright (c) 2007-2016 Kohana Team
  9. * @copyright (c) since 2016 Koseven Team
  10. * @license https://koseven.dev/LICENSE
  11. */
  12. abstract class KO7_Model {
  13. /**
  14. * Create a new model instance.
  15. *
  16. * $model = Model::factory($name);
  17. *
  18. * @param string $name model name
  19. * @return Model
  20. */
  21. public static function factory($name)
  22. {
  23. // Add the model prefix
  24. $class = 'Model_'.$name;
  25. return new $class;
  26. }
  27. }