Bindings.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\Modules;
  7. class Bindings extends \We7Table {
  8. protected $tableName = 'modules_bindings';
  9. protected $primaryKey = 'eid';
  10. protected $field = array(
  11. 'module',
  12. 'entry',
  13. 'call',
  14. 'title',
  15. 'do',
  16. 'state',
  17. 'direct',
  18. 'url',
  19. 'icon',
  20. 'displayorder',
  21. 'multilevel',
  22. 'parent',
  23. );
  24. protected $default = array(
  25. 'module' => '',
  26. 'entry' => '',
  27. 'call' => '',
  28. 'title' => '',
  29. 'do' => '',
  30. 'state' => '',
  31. 'direct' => 0,
  32. 'url' => '',
  33. 'icon' => 'wi wi-appsetting',
  34. 'displayorder' => 0,
  35. 'multilevel' => '',
  36. 'parent' => '',
  37. );
  38. public function searchWithModuleEntry($modulename, $entry) {
  39. return $this->query->where('module', $modulename)->where('entry', $entry);
  40. }
  41. public function deleteByName($modulename) {
  42. return $this->query->where('module', $modulename)->delete();
  43. }
  44. public function isEntryExists($modulename, $entry, $do) {
  45. return $this->query->where('module', $modulename)->where('entry', $entry)->where('do', $do)->exists();
  46. }
  47. public function isCallExists($modulename, $entry, $call) {
  48. return $this->query->where('module', $modulename)->where('entry', $entry)->where('call', $call)->exists();
  49. }
  50. public function getByEntryDo($modulename, $entry, $do) {
  51. return $this->query->where('module', $modulename)->where('entry', $entry)->where('do', $do)->get();
  52. }
  53. public function getByEntryCall($modulename, $entry, $call) {
  54. return $this->query->where('module', $modulename)->where('entry', $entry)->where('call', $call)->get();
  55. }
  56. }