ExtraModules.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\Users;
  7. class ExtraModules extends \We7Table {
  8. protected $tableName = 'users_extra_modules';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uid',
  12. 'module_name',
  13. 'support',
  14. );
  15. protected $default = array(
  16. 'uid' => '',
  17. 'module_name' => '',
  18. 'support' => '',
  19. );
  20. public function addExtraModule($uid, $module_name, $support) {
  21. $data = array(
  22. 'uid' => $uid,
  23. 'module_name' => $module_name,
  24. 'support' => $support,
  25. );
  26. return $this->fill($data)->save();
  27. }
  28. public function searchBySupport($support) {
  29. return $this->query->where('support', $support);
  30. }
  31. public function searchByUid($uid) {
  32. return $this->query->where('uid', $uid);
  33. }
  34. public function searchByModuleName($module_name) {
  35. return $this->query->where('module_name', $module_name);
  36. }
  37. public function getExtraModuleByUidAndModulename($uid, $module_name) {
  38. $where = array(
  39. 'uid' => $uid,
  40. 'module_name' => $module_name,
  41. );
  42. return $extra_module = $this->where($where)->get();
  43. }
  44. public function getExtraModulesByUid($uid) {
  45. return $this->where(array('uid' => $uid))->getall();
  46. }
  47. public function deleteExtraModulesByUid($uid) {
  48. return $this->where(array('uid' => $uid))->delete();
  49. }
  50. }