Mejoras generales .w. se me olvida que agrego
This commit is contained in:
@@ -22,14 +22,22 @@ class Restaurante extends Model {
|
||||
return $restaurante;
|
||||
}
|
||||
|
||||
public function usuarios() {
|
||||
return $this->belongsToMany(Usuario::class, 'usuarios_restaurantes', 'restaurante_id', 'usuario_id');
|
||||
}
|
||||
|
||||
public function canalesVenta() {
|
||||
return $this->hasMany(CanalVenta::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function categorias() {
|
||||
return $this->hasMany(Categoria::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function compras() {
|
||||
return $this->hasMany(Compra::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function usuarios() {
|
||||
return $this->belongsToMany(Usuario::class, 'usuarios_restaurantes', 'restaurante_id', 'usuario_id');
|
||||
}
|
||||
|
||||
public function sectores() {
|
||||
return $this->hasMany(Sector::class, 'restaurante_id');
|
||||
}
|
||||
@@ -38,10 +46,6 @@ class Restaurante extends Model {
|
||||
return $this->hasMany(ZonaProduccion::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function categorias() {
|
||||
return $this->hasMany(Categoria::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function proveedores() {
|
||||
return $this->hasMany(Proveedor::class, 'restaurante_id');
|
||||
}
|
||||
@@ -54,7 +58,19 @@ class Restaurante extends Model {
|
||||
return $this->hasMany(Producto::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function compras() {
|
||||
return $this->hasMany(Compra::class, 'restaurante_id');
|
||||
public function ventas() {
|
||||
return $this->hasMany(Venta::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function boletasElectronicas() {
|
||||
return $this->hasMany(BoletaElectronica::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function boletasExentas() {
|
||||
return $this->hasMany(BoletaExenta::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function cajas() {
|
||||
return $this->hasMany(Caja::class, 'restaurante_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,15 @@ class Usuario extends Model {
|
||||
}
|
||||
|
||||
public function isGlobalAdmin() {
|
||||
return in_array('global_admin', $this->roles);
|
||||
return $this->hasRole('global_admin');
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
return in_array('admin', $this->roles);
|
||||
return $this->hasRole('admin');
|
||||
}
|
||||
|
||||
public function hasRole($role) {
|
||||
return in_array($role, $this->roles);
|
||||
}
|
||||
|
||||
public function restaurantes() {
|
||||
|
||||
Reference in New Issue
Block a user