You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
885 B

3 years ago
  1. <?php
  2. namespace App\Models;
  3. use SleekDB\Store;
  4. use SleekDB\Query;
  5. /**
  6. * Abstract Class for Stores
  7. *
  8. *
  9. * @author Björn Hase
  10. * @link https://gitea.tentakelfabrik.de/mITSM/feedback GitHub Repository
  11. *
  12. */
  13. class ModelAbstract
  14. {
  15. // store of model
  16. public $store;
  17. // name of store
  18. protected $name;
  19. // configuration of store
  20. protected $configuration = [
  21. 'auto_cache' => true,
  22. 'cache_lifetime' => null,
  23. 'timeout' => 120,
  24. 'primary_key' => '_id',
  25. 'search' => [
  26. 'min_length' => 2,
  27. 'mode' => 'or',
  28. 'score_key' => 'scoreKey',
  29. 'algorithm' => Query::SEARCH_ALGORITHM['hits']
  30. ]
  31. ];
  32. /**
  33. *
  34. *
  35. */
  36. public function __construct()
  37. {
  38. $this->store = new Store($this->name, __DIR__.'/../../storage/database', $this->configuration);
  39. }
  40. }