Mcuhos cambios .w.

This commit is contained in:
2021-07-20 15:27:55 -04:00
parent 02871ab73b
commit 1d6082a590
35 changed files with 85 additions and 155 deletions

View File

@@ -1,19 +0,0 @@
<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Administrador extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'administradores';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
public function usuario() {
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -8,8 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class BodegaActual extends Model {
protected $table = 'bodega_actual';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function restaurante() {
return $this->belongsTo(Restaurante::class);

View File

@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class BodegaEgreso extends Model {
protected $table = 'bodega_egresos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function restaurante() {

View File

@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class BodegaIngreso extends Model {
protected $table = 'bodega_ingresos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function restaurante() {

View File

@@ -8,8 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class BodegaMovimiento extends Model {
protected $table = 'bodega_movimientos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function restaurante() {
return $this->belongsTo(Restaurante::class);

View File

@@ -11,7 +11,7 @@ class BoletaElectronica extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'boletas_electronicas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function venta() {
return $this->belongsTo(Venta::class);

View File

@@ -11,7 +11,7 @@ class BoletaExenta extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'boletas_exentas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function venta() {
return $this->belongsTo(Venta::class);

View File

@@ -11,7 +11,7 @@ class Caja extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'cajas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function restaurante() {
return $this->belongsTo(Restaurante::class);

View File

@@ -11,7 +11,7 @@ class CanalVenta extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'canales_venta';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre', 'restaurante_id', 'sector_id', 'tipo_canal_id'];
public static function findOrFail($id) {

View File

@@ -11,7 +11,7 @@ class Categoria extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'categorias';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre', 'restaurante_id'];
public static function findOrFail($id) {

View File

@@ -11,7 +11,7 @@ class Compra extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'compras';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = [
'id', 'fecha_compra', 'proveedor_id', 'en_arqueo', 'restaurante_id'
];

View File

@@ -11,7 +11,7 @@ class CompraIngrediente extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'compra_ingredientes';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'unidades', 'monto_unitario', 'compra_id', 'ingrediente_id'];
public function ingrediente() {

View File

@@ -11,7 +11,7 @@ class Efectivo extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'efectivos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function caja() {
return $this->belongsTo(Caja::class);

View File

@@ -11,5 +11,5 @@ class EstadoProduccion extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'estados_produccion';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
}

View File

@@ -11,7 +11,7 @@ class Factura extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'facturas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'numero', 'monto_bruto', 'compra_id'];
public static function findOrFail($id) {

View File

@@ -11,7 +11,7 @@ class Ingrediente extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'ingredientes';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre', 'medida', 'restaurante_id'];
public static function findOrFail($id) {

View File

@@ -11,5 +11,5 @@ class MedioPago extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'medios_pago';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
}

View File

@@ -1,19 +0,0 @@
<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Mesero extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'meseros';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
public function usuario() {
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -11,7 +11,7 @@ class Producto extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'productos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = [
'id', 'nombre', 'precio_venta', 'categoria_id',
'zona_produccion_id', 'restaurante_id'

View File

@@ -1,23 +0,0 @@
<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Productor extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'productores';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
public function usuario() {
return $this->belongsTo(Usuario::class);
}
public function zonaProduccion() {
return $this->belongsTo(ZonaProduccion::class);
}
}

View File

@@ -11,7 +11,7 @@ class Proveedor extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'proveedores';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = [
'id', 'rut', 'nombre', 'descripcion',
'direccion', 'telefono', 'restaurante_id'

View File

@@ -1,19 +0,0 @@
<?php
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Recaudador extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'recaudadores';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
public function usuario() {
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -10,7 +10,7 @@ class Receta extends Model {
use UuidPrimaryKey;
protected $table = 'recetas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['unidades', 'producto_id', 'ingrediente_id'];
public function ingrediente() {

View File

@@ -13,7 +13,7 @@ class Restaurante extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'restaurantes';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre'];
public static function findOrFail($id) {

View File

@@ -11,7 +11,7 @@ class Sector extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'sectores';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre', 'restaurante_id'];
public static function findOrFail($id) {

View File

@@ -11,5 +11,5 @@ class TipoCanal extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'tipos_canal';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
}

View File

@@ -16,7 +16,7 @@ class Usuario extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'usuarios';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'auth0_id', 'nombre'];
protected $appends = ['roles'];
@@ -53,21 +53,10 @@ class Usuario extends Model {
return $this->belongsToMany(Restaurante::class, 'usuarios_restaurantes', 'usuario_id', 'restaurante_id');
}
public function administrador() {
return $this->hasOne(Administrador::class);
public function zonasProduccion() {
return $this->belongsToMany(ZonaProduccion::class, 'productores', 'usuario_id', 'zona_produccion_id');
}
public function recaudador() {
return $this->hasOne(Recaudador::class);
}
public function mesero() {
return $this->hasOne(Mesero::class);
}
public function productor() {
return $this->hasOne(Productor::class);
}
public function getRolesAttribute() {
$auth0Service = app(Auth0Service::class);

View File

@@ -11,7 +11,7 @@ class Venta extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'ventas';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function mesero() {
return $this->belongsTo(Mesero::class);

View File

@@ -11,7 +11,7 @@ class VentaProducto extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'venta_productos';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
public function venta() {
return $this->belongsTo(Venta::class);

View File

@@ -11,7 +11,7 @@ class ZonaProduccion extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'zonas_produccion';
protected $hidden = ['created_at', 'updated_at', 'deleted_at'];
protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];
protected $fillable = ['id', 'nombre', 'restaurante_id'];
public static function findOrFail($id) {
@@ -23,4 +23,8 @@ class ZonaProduccion extends Model {
public function restaurante() {
return $this->belongsTo(Restaurante::class);
}
public function usuarios() {
return $this->belongsToMany(Usuario::class, 'productores', 'zona_produccion_id', 'usuario_id');
}
}