Guest User

Untitled

a guest
Mar 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App;
  4.  
  5. use IlluminateDatabaseEloquentModel;
  6.  
  7. class Modelo_servicio extends Model
  8. {
  9. protected $table='servicios';
  10. protected $fillable=[
  11. 'descripcion_servicio',
  12. 'consumo_agua',
  13. 'pago_mantenimiento',
  14. 'pago_desague',
  15. ];
  16.  
  17.  
  18. public function modelocliente(){
  19. return $this->belongsToMany('AppModelo_cliente');
  20. }
  21. }
  22.  
  23. <?php
  24.  
  25. namespace App;
  26.  
  27. use IlluminateDatabaseEloquentModel;
  28.  
  29. class Modelo_cliente extends Model
  30. {
  31. protected $table = 'clientes';
  32.  
  33. protected $fillable = [
  34. 'nombre',
  35. 'apellido',
  36. 'dni',
  37. 'direccion',
  38. 'asentamientos_id',
  39. 'servicio',
  40. 'condicion',
  41. 'mz',
  42. 'lt',
  43. ];
  44.  
  45. public function Servicio()
  46. {
  47. return $this->belongsToMany('AppModelo_servicio');
  48. }
  49. public function asentamiento()
  50. {
  51. return $this->belongsto('AppModelo_asentamiento', 'asentamientos_id');
  52. }
  53. }
  54.  
  55. <?php
  56.  
  57. namespace App;
  58.  
  59. use IlluminateDatabaseEloquentModel;
  60.  
  61. class modelo_cliente_servicio extends Model
  62. {
  63. protected $table = 'cliete_servicio';
  64. protected $primarykey='id';
  65. protected $fillable = [
  66. 'clietes_id',
  67. 'servicios_id',
  68.  
  69. ];
  70. }
  71.  
  72. @foreach($cliente as $client)
  73. <tr>
  74. <td>
  75. {{ $client->nombre }}
  76. </td>
  77. <td>
  78. {{ $client->apellido }}
  79. </td>
  80. <td>
  81. <strong>
  82. {{ $client->dni }}
  83. </strong>
  84. </td>
  85. <td>
  86. <strong>
  87. {{ $client->direccion }}
  88. </strong>
  89. </td>
  90. <td>
  91. <strong>
  92. {{ $client->asentamiento->nombre }}
  93. </strong>
  94. </td>
  95. <td>
  96. <strong>
  97. {{ $client->Servicio->descripcion_servicio}}//aqui muestro
  98. </strong>
  99. </td>
  100. <td>
  101.  
  102. ];
Add Comment
Please, Sign In to add comment