PaymentChannelModel.php 856 B

123456789101112131415161718192021222324252627282930313233343536373839
  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)->order("id", "desc")->select();
  15. }
  16. public function findById($id)
  17. {
  18. return $this->with('relation')->where([
  19. ['is_delete', '=', 0],
  20. ['id', "=", $id]
  21. ])->find();
  22. }
  23. public function findByName($name) {
  24. return $this->where([
  25. ['is_delete', '=', 0],
  26. ['name', "=", $name]
  27. ])->find();
  28. }
  29. }