Guest User

Untitled

a guest
Jul 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. @{$c->stash->{users}} = $c -> model('VpnDB::Users')->search({user => { like => "$params->{user}%"}},{join => 'packets' <- ???? })->all;
  2.  
  3.  
  4. Users.pm
  5.  
  6. use strict;
  7. use warnings;
  8.  
  9. use base 'DBIx::Class';
  10.  
  11. __PACKAGE__->load_components("InflateColumn::DateTime", "Core");
  12. __PACKAGE__->table("users");
  13. __PACKAGE__->add_columns(
  14. "user",
  15. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 64 },
  16. "password",
  17. { data_type => "VARCHAR", default_value => "*", is_nullable => 0, size => 254 },
  18. "crypt_method",
  19. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  20. "uid",
  21. { data_type => "BIGINT", default_value => undef, is_nullable => 0, size => 15 },
  22. "gid",
  23. { data_type => "BIGINT", default_value => 1, is_nullable => 0, size => 15 },
  24. "company",
  25.  
  26. "modul",
  27. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 3 },
  28. );
  29. __PACKAGE__->set_primary_key("uid");
  30.  
  31. __PACKAGE__->has_one( 'packet' => 'Billing::Schema::VpnDB::Result::Packets', 'uid');
  32.  
  33.  
  34.  
  35.  
  36. Packets.pm
  37.  
  38. use strict;
  39. use warnings;
  40.  
  41. use base 'DBIx::Class';
  42.  
  43. __PACKAGE__->load_components("InflateColumn::DateTime", "Core");
  44. __PACKAGE__->table("packets");
  45. __PACKAGE__->add_columns(
  46. "num",
  47. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  48. "packet",
  49. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 128 },
  50. "prefix",
  51. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 4 },
  52. "gid",
  53. { data_type => "BIGINT", default_value => undef, is_nullable => 0, size => 15 },
  54. "deposit",
  55. {
  56. data_type => "DOUBLE",
  57. default_value => "0.000000",
  58. is_nullable => 0,
  59. size => 64,
  60. },
  61. "credit",
  62. {
  63. data_type => "DOUBLE",
  64. default_value => "0.000000",
  65. is_nullable => 0,
  66. size => 64,
  67. },
  68. "tos",
  69. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  70. "do_with_tos",
  71. { data_type => "TINYINT", default_value => 1, is_nullable => 0, size => 1 },
  72. "direction",
  73. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  74. "fixed",
  75. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  76. "fixed_cost",
  77. {
  78. data_type => "DOUBLE",
  79. default_value => "0.000000",
  80. is_nullable => 0,
  81. size => 64,
  82. },
  83. "activated",
  84. { data_type => "TINYINT", default_value => 1, is_nullable => 0, size => 1 },
  85. "activation_time",
  86. { data_type => "INT", default_value => 2678400, is_nullable => 0, size => 10 },
  87. "blocked",
  88. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  89. "total_time_limit",
  90. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  91. "month_time_limit",
  92. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  93. "week_time_limit",
  94. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  95. "day_time_limit",
  96. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  97. "total_traffic_limit",
  98. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  99. "month_traffic_limit",
  100. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  101. "week_traffic_limit",
  102. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  103. "day_traffic_limit",
  104. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  105. "total_money_limit",
  106. {
  107. data_type => "DOUBLE",
  108. default_value => "0.000000",
  109. is_nullable => 0,
  110. size => 64,
  111. },
  112. "month_money_limit",
  113. {
  114. data_type => "DOUBLE",
  115. default_value => "0.000000",
  116. is_nullable => 0,
  117. size => 64,
  118. },
  119. "week_money_limit",
  120. {
  121. data_type => "DOUBLE",
  122. default_value => "0.000000",
  123. is_nullable => 0,
  124. size => 64,
  125. },
  126. "day_money_limit",
  127. {
  128. data_type => "DOUBLE",
  129. default_value => "0.000000",
  130. is_nullable => 0,
  131. size => 64,
  132. },
  133. "login_time",
  134. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 254 },
  135. "pool_phone",
  136. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 50 },
  137. "huntgroup_name",
  138. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 64 },
  139. "simultaneous_use",
  140. { data_type => "SMALLINT", default_value => 0, is_nullable => 0, size => 5 },
  141. "port_limit",
  142. { data_type => "SMALLINT", default_value => 0, is_nullable => 0, size => 5 },
  143. "session_timeout",
  144. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  145. "idle_timeout",
  146. { data_type => "BIGINT", default_value => 0, is_nullable => 0, size => 15 },
  147. "allowed_prefixes",
  148. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 64 },
  149. "framed_ip",
  150. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 16 },
  151. "framed_mask",
  152. { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 16 },
  153. "no_pass",
  154. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  155. "no_acct",
  156. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  157. "allow_callback",
  158. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 1 },
  159. "other_params",
  160. {
  161. data_type => "VARCHAR",
  162. default_value => "Acct-Interim-Interval = 60, Service-Type = Framed-User, Framed-Protocol = PPP, Framed-Compression = Van-Jacobson-TCP-IP",
  163. is_nullable => 0,
  164. size => 254,
  165. },
  166. "allowed_servers",
  167. {
  168. data_type => "VARCHAR",
  169. default_value => undef,
  170. is_nullable => 1,
  171. size => 254,
  172. },
  173. "uid",
  174. { data_type => "BIGINT", default_value => 0, is_nullable => 1, size => 15 },
  175. "create_system_user",
  176. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 4 },
  177. "modul",
  178. { data_type => "TINYINT", default_value => 0, is_nullable => 0, size => 3 },
  179. );
  180. __PACKAGE__->set_primary_key("gid");
  181. __PACKAGE__->add_unique_constraint("packet", ["packet"]);
  182.  
  183. __PACKAGE__->belongs_to( 'user' => 'Billing::Schema::VpnDB::Result::Users', 'uid');
Add Comment
Please, Sign In to add comment