Carga inicial
This commit is contained in:
87
app/Models/ServicioEnc.php
Normal file
87
app/Models/ServicioEnc.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ServicioEnc extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'servicios_enc';
|
||||
|
||||
/**
|
||||
* The table primary key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [];
|
||||
|
||||
/**
|
||||
* Indicates if the primary key is autoincrement.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = true;
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = true;
|
||||
|
||||
/**
|
||||
* The attributes that should be filleable for arrays.
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* $guarded = [] or $filleable = []
|
||||
*/
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'forma_pago_id', 'fecha_agenda', 'usuario_agenda_id', 'cliente_id', 'cliente_domicilio_id', 'sucursal_id', 'origen_id'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
//
|
||||
];
|
||||
|
||||
public function scopeJoinDetalleServicioEnc($query)
|
||||
{
|
||||
return $query->join('cat_formas_pagos', 'cat_formas_pagos.id', '=', 'servicios_enc.forma_pago_id')
|
||||
->join('users', 'users.id', '=', 'servicios_enc.usuario_agenda_id')
|
||||
->join('clientes', 'clientes.id', '=', 'servicios_enc.cliente_id')
|
||||
->join('clientes_domicilios', 'clientes_domicilios.id', '=', 'servicios_enc.cliente_domicilio_id');
|
||||
}
|
||||
|
||||
public function servicios()
|
||||
{
|
||||
return $this->hasMany('App\Models\ServicioDet', 'servicio_enc_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user