Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
wcadena authored and StyleCIBot committed Jul 12, 2018
1 parent 1c60dde commit 6d4c37f
Show file tree
Hide file tree
Showing 249 changed files with 3,739 additions and 3,690 deletions.
5 changes: 2 additions & 3 deletions app/Areas.php
Expand Up @@ -8,16 +8,16 @@

class Areas extends Model
{

protected static function boot()
{
parent::boot();

static::addGlobalScope(new EmpresaTScope());
}

protected $fillable = ['area','empresa'];
protected $fillable = ['area', 'empresa'];
public $transformer = AreasTransformer::class;

public function checklistxc()
{
return $this->hasMany('App\CheckList', 'area_id');
Expand All @@ -33,5 +33,4 @@ public function empresaxc()
{
return $this->hasOne('App\Empresa', 'empresa', 'empresa');
}

}
15 changes: 9 additions & 6 deletions app/Bitacora.php
Expand Up @@ -10,28 +10,31 @@ class Bitacora extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = ['id_equipos','titulo','custodio_id','user_id','problema','solucion','estado','fecha_ingreso'];
protected $fillable = ['id_equipos', 'titulo', 'custodio_id', 'user_id', 'problema', 'solucion', 'estado', 'fecha_ingreso'];

public static function getENUM($tabla)
{
$type = DB::select( DB::raw("SHOW COLUMNS FROM bitacoras WHERE Field = '".$tabla."'") )[0]->Type;
$type = DB::select(DB::raw("SHOW COLUMNS FROM bitacoras WHERE Field = '".$tabla."'"))[0]->Type;
preg_match('/^enum\((.*)\)$/', $type, $matches);
$enum = array();
foreach( explode(',', $matches[1]) as $value )
{
$v = trim( $value, "'" );
$enum = [];
foreach (explode(',', $matches[1]) as $value) {
$v = trim($value, "'");
$enum = array_add($enum, $v, $v);
}

return $enum;
}

public function custodioxc()
{
return $this->hasOne('App\Custodios', 'id', 'custodio_id');
}

public function userxc()
{
return $this->hasOne('App\User', 'id', 'user_id');
}

public function equiposxc()
{
return $this->hasMany('App\Equipos', 'id_equipos', 'id');
Expand Down
4 changes: 1 addition & 3 deletions app/Busqueda.php
Expand Up @@ -16,7 +16,5 @@ class Busqueda extends Model
public $transformer = BusquedaTransformer::class;

protected $dates = ['deleted_at'];
protected $fillable = ['user_id',"palabra_q","instancia","instancia_id","dato"];


protected $fillable = ['user_id', 'palabra_q', 'instancia', 'instancia_id', 'dato'];
}
11 changes: 7 additions & 4 deletions app/CheckList.php
Expand Up @@ -13,22 +13,25 @@ class CheckList extends Model
public $transformer = ChecklistTransformer::class;

protected $dates = ['deleted_at'];
protected $fillable = ['area_id','user_id','id_check_lists','unik_check_lists'];
protected $fillable = ['area_id', 'user_id', 'id_check_lists', 'unik_check_lists'];

public function areaxc()
{
return $this->hasOne('App\Areas', 'id', 'area_id');
}

public function userxc()
{
return $this->hasOne('App\User', 'id', 'user_id');
}

public function equiposxm()
{
return $this->belongsTo('App\Equipos', 'id','check_list_id');
return $this->belongsTo('App\Equipos', 'id', 'check_list_id');
}

public function checklistxm()
{
return $this->belongsTo('App\CheckList_OpcionesCheckList', 'id','check_list_id');
return $this->belongsTo('App\CheckList_OpcionesCheckList', 'id', 'check_list_id');
}

}
21 changes: 12 additions & 9 deletions app/CheckList_OpcionesCheckList.php
Expand Up @@ -10,30 +10,34 @@ class CheckList_OpcionesCheckList extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = ['check_list_id','opciones_check_list_id','tipo','atributo','valor1','valor2','valor3','valor4','valor5','valor6','valor7','valor8','valor9','valor10'];
protected $fillable = ['check_list_id', 'opciones_check_list_id', 'tipo', 'atributo', 'valor1', 'valor2', 'valor3', 'valor4', 'valor5', 'valor6', 'valor7', 'valor8', 'valor9', 'valor10'];

public $transformer = CheckList_OpcionesCheckListTransformer::class;
public function estados() {

public function estados()
{
return $this->hasMany('ACTIVO', 'INACTIVO');
}

public static function getENUM($tabla)
{
$type = DB::select( DB::raw("SHOW COLUMNS FROM opciones_check_lists WHERE Field = '".$tabla."'") )[0]->Type;
$type = DB::select(DB::raw("SHOW COLUMNS FROM opciones_check_lists WHERE Field = '".$tabla."'"))[0]->Type;
preg_match('/^enum\((.*)\)$/', $type, $matches);
$enum = array();
foreach( explode(',', $matches[1]) as $value )
{
$v = trim( $value, "'" );
$enum = [];
foreach (explode(',', $matches[1]) as $value) {
$v = trim($value, "'");
$enum = array_add($enum, $v, $v);
}

return $enum;
}

/**
* Scope a query to only include users of a given type.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $type
* @param mixed $type
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeOpcionesCheckLists($query, $opciones_check_list_id, $check_list_id)
Expand All @@ -42,5 +46,4 @@ public function scopeOpcionesCheckLists($query, $opciones_check_list_id, $check_
->where('check_list_id', $check_list_id)
->where('opciones_check_list_id', $opciones_check_list_id);
}

}
15 changes: 8 additions & 7 deletions app/Configuracion.php
Expand Up @@ -9,9 +9,9 @@

class Configuracion extends Model
{
use SoftDeletes;
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = ['atributo','tipo','valores_fuente',"fijo",'valor','empresa'];
protected $fillable = ['atributo', 'tipo', 'valores_fuente', 'fijo', 'valor', 'empresa'];

protected static function boot()
{
Expand All @@ -22,16 +22,17 @@ protected static function boot()

public static function getENUM($tabla)
{
$type = DB::select( DB::raw("SHOW COLUMNS FROM configuracions WHERE Field = '".$tabla."'") )[0]->Type;
$type = DB::select(DB::raw("SHOW COLUMNS FROM configuracions WHERE Field = '".$tabla."'"))[0]->Type;
preg_match('/^enum\((.*)\)$/', $type, $matches);
$enum = array();
foreach( explode(',', $matches[1]) as $value )
{
$v = trim( $value, "'" );
$enum = [];
foreach (explode(',', $matches[1]) as $value) {
$v = trim($value, "'");
$enum = array_add($enum, $v, $v);
}

return $enum;
}

public function empresaxc()
{
return $this->hasOne('App\Empresa', 'empresa', 'empresa');
Expand Down
20 changes: 9 additions & 11 deletions app/Console/Commands/DisponePuestos.php
Expand Up @@ -44,27 +44,25 @@ public function handle()
$arguments = $this->arguments();

$puestos = PuestoCustodios::all();
$encerados=0;
foreach ($puestos as $puesto){
$encerados = 0;
foreach ($puestos as $puesto) {
$ahorita = Carbon::now();
//dd($ahorita);

$tiempoPuesto =new Carbon($puesto->fecha_inicio);
$tiempoPuesto = new Carbon($puesto->fecha_inicio);

$dato=$ahorita->diffInHours($tiempoPuesto);
$encerados=0;
if($dato>=$puesto->horas_trabajadas){
$p = Puesto::where('id','=',$puesto->puesto_id)->firstOrFail();
$p->estado='LIBRE';
$dato = $ahorita->diffInHours($tiempoPuesto);
$encerados = 0;
if ($dato >= $puesto->horas_trabajadas) {
$p = Puesto::where('id', '=', $puesto->puesto_id)->firstOrFail();
$p->estado = 'LIBRE';
$p->save();
$puesto->delete();
$encerados++;
}
//1->addHours($puesto->horas_trabajadas);
//1->addHours($puesto->horas_trabajadas);
//dd($tiempoPuesto);1
}
$this->info('Todos los puestos han sido puestos en libertad si ya paso el tiempo, se enceraron ('.$encerados.')');


}
}
5 changes: 3 additions & 2 deletions app/Console/Kernel.php
Expand Up @@ -14,13 +14,14 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
//
Commands\DisponePuestos::class
Commands\DisponePuestos::class,
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
32 changes: 18 additions & 14 deletions app/Custodios.php
Expand Up @@ -31,29 +31,33 @@ protected static function boot()
const CUSTODIO_NO_NOTIFICADO = '0';

protected $dates = ['deleted_at'];
protected $fillable = ['nombre_responsable','ciudad','direccion','area_piso','documentoIdentificacion','cargo','compania','telefono','estado','notificado','email',
' verification_token','token','direccion_preferida','longitud_1','latitud_1','longitud_2','latitud_2','whatsapp','telefono_celular_notificacion','slack_id','pais',
'celular','ext','image'];
protected $fillable = ['nombre_responsable', 'ciudad', 'direccion', 'area_piso', 'documentoIdentificacion', 'cargo', 'compania', 'telefono', 'estado', 'notificado', 'email',
' verification_token', 'token', 'direccion_preferida', 'longitud_1', 'latitud_1', 'longitud_2', 'latitud_2', 'whatsapp', 'telefono_celular_notificacion', 'slack_id', 'pais',
'celular', 'ext', 'image', ];

public function estados() {
public function estados()
{
return $this->hasMany('ACTIVO', 'INACTIVO');
}

public function equiposhm()
{
return $this->hasMany('App\Equipos', 'custodio_id', 'id');
}

public function reponovedadeshm()
{
return $this->hasMany('App\RepoNovedades', 'custodio_id', 'id');
}

public function puestoCustodios()
{
return $this->hasMany('App\PuestoCustodios','custodio_id');
return $this->hasMany('App\PuestoCustodios', 'custodio_id');
}

public function mandarNotificacion()
{
return $this->notificado == Custodios::CUSTODIO_NOTIFICADO;
return $this->notificado == self::CUSTODIO_NOTIFICADO;
}

public function scopeNotificar($query)
Expand All @@ -63,29 +67,29 @@ public function scopeNotificar($query)

public static function getENUM($tabla)
{
$type = DB::select( DB::raw("SHOW COLUMNS FROM custodios WHERE Field = '".$tabla."'") )[0]->Type;
$type = DB::select(DB::raw("SHOW COLUMNS FROM custodios WHERE Field = '".$tabla."'"))[0]->Type;
preg_match('/^enum\((.*)\)$/', $type, $matches);
$enum = array();
foreach( explode(',', $matches[1]) as $value )
{
$v = trim( $value, "'" );
$enum = [];
foreach (explode(',', $matches[1]) as $value) {
$v = trim($value, "'");
$enum = array_add($enum, $v, $v);
}

return $enum;
}

public static function generarVerificationToken()
{
return str_random(36);
}

public static function generarToken()
{
return str_random(6);
}

public function sendPasswordResetNotification(Custodios $custodios)
public function sendPasswordResetNotification(self $custodios)
{

$this->notify(new CustodioDarClave($custodios));
}

}
2 changes: 1 addition & 1 deletion app/Empresa.php
Expand Up @@ -16,5 +16,5 @@ class Empresa extends Model
protected $primaryKey = 'empresa';
public $incrementing = false;

protected $fillable = ['empresa','formula_codigo'];
protected $fillable = ['empresa', 'formula_codigo'];
}

0 comments on commit 6d4c37f

Please sign in to comment.