PaymentChannelModel.php 913 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\common\model;
  3. class PaymentChannelModel extends BaseModel
  4. {
  5. protected $table = 'erp_payment_channel';
  6. protected function genSchema(array $schema)
  7. {
  8. // TODO: Implement genSchema() method.
  9. }
  10. protected function relation() {
  11. return $this->hasMany(CreditCardConfigModel::class,'channel_id', 'id')->where('is_delete',0);
  12. }
  13. public function findAll() {
  14. return $this->where('is_delete', 0)
  15. ->with('relation')
  16. ->order("id", "Asc")
  17. ->select();
  18. }
  19. public function findById($id)
  20. {
  21. return $this->with('relation')->where([
  22. ['is_delete', '=', 0],
  23. ['id', "=", $id]
  24. ])->find();
  25. }
  26. public function findByName($name) {
  27. return $this->where([
  28. ['is_delete', '=', 0],
  29. ['name', "=", $name]
  30. ])->find();
  31. }
  32. }