Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App;
- use IlluminateDatabaseEloquentModel;
- class Modelo_servicio extends Model
- {
- protected $table='servicios';
- protected $fillable=[
- 'descripcion_servicio',
- 'consumo_agua',
- 'pago_mantenimiento',
- 'pago_desague',
- ];
- public function modelocliente(){
- return $this->belongsToMany('AppModelo_cliente');
- }
- }
- <?php
- namespace App;
- use IlluminateDatabaseEloquentModel;
- class Modelo_cliente extends Model
- {
- protected $table = 'clientes';
- protected $fillable = [
- 'nombre',
- 'apellido',
- 'dni',
- 'direccion',
- 'asentamientos_id',
- 'servicio',
- 'condicion',
- 'mz',
- 'lt',
- ];
- public function Servicio()
- {
- return $this->belongsToMany('AppModelo_servicio');
- }
- public function asentamiento()
- {
- return $this->belongsto('AppModelo_asentamiento', 'asentamientos_id');
- }
- }
- <?php
- namespace App;
- use IlluminateDatabaseEloquentModel;
- class modelo_cliente_servicio extends Model
- {
- protected $table = 'cliete_servicio';
- protected $primarykey='id';
- protected $fillable = [
- 'clietes_id',
- 'servicios_id',
- ];
- }
- @foreach($cliente as $client)
- <tr>
- <td>
- {{ $client->nombre }}
- </td>
- <td>
- {{ $client->apellido }}
- </td>
- <td>
- <strong>
- {{ $client->dni }}
- </strong>
- </td>
- <td>
- <strong>
- {{ $client->direccion }}
- </strong>
- </td>
- <td>
- <strong>
- {{ $client->asentamiento->nombre }}
- </strong>
- </td>
- <td>
- <strong>
- {{ $client->Servicio->descripcion_servicio}}//aqui muestro
- </strong>
- </td>
- <td>
- ];
Add Comment
Please, Sign In to add comment