diff --git a/app/Areas.php b/app/Areas.php index f7c8c9f2..4b066c57 100644 --- a/app/Areas.php +++ b/app/Areas.php @@ -8,7 +8,6 @@ class Areas extends Model { - protected static function boot() { parent::boot(); @@ -16,8 +15,9 @@ protected static function 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'); @@ -33,5 +33,4 @@ public function empresaxc() { return $this->hasOne('App\Empresa', 'empresa', 'empresa'); } - } diff --git a/app/Bitacora.php b/app/Bitacora.php index 4d84638a..3ff8a98f 100644 --- a/app/Bitacora.php +++ b/app/Bitacora.php @@ -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'); diff --git a/app/Busqueda.php b/app/Busqueda.php index 6c22d58a..f06f06ba 100644 --- a/app/Busqueda.php +++ b/app/Busqueda.php @@ -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']; } diff --git a/app/CheckList.php b/app/CheckList.php index 4c45fc74..3188f7ed 100644 --- a/app/CheckList.php +++ b/app/CheckList.php @@ -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'); } - } diff --git a/app/CheckList_OpcionesCheckList.php b/app/CheckList_OpcionesCheckList.php index cd407bb2..807cef68 100644 --- a/app/CheckList_OpcionesCheckList.php +++ b/app/CheckList_OpcionesCheckList.php @@ -10,22 +10,25 @@ 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; } @@ -33,7 +36,8 @@ public static function getENUM($tabla) * 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) @@ -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); } - } diff --git a/app/Configuracion.php b/app/Configuracion.php index a5c033ed..c5007566 100644 --- a/app/Configuracion.php +++ b/app/Configuracion.php @@ -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() { @@ -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'); diff --git a/app/Console/Commands/DisponePuestos.php b/app/Console/Commands/DisponePuestos.php index e976b478..7065b366 100644 --- a/app/Console/Commands/DisponePuestos.php +++ b/app/Console/Commands/DisponePuestos.php @@ -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.')'); - - } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 90c62637..81ad99a2 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -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) diff --git a/app/Custodios.php b/app/Custodios.php index b10295f4..cce6101b 100644 --- a/app/Custodios.php +++ b/app/Custodios.php @@ -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) @@ -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)); } - } diff --git a/app/Empresa.php b/app/Empresa.php index 95d6d08e..2b4d5744 100644 --- a/app/Empresa.php +++ b/app/Empresa.php @@ -16,5 +16,5 @@ class Empresa extends Model protected $primaryKey = 'empresa'; public $incrementing = false; - protected $fillable = ['empresa','formula_codigo']; + protected $fillable = ['empresa', 'formula_codigo']; } diff --git a/app/Equipos.php b/app/Equipos.php index 7df35be5..8052d9c0 100644 --- a/app/Equipos.php +++ b/app/Equipos.php @@ -21,71 +21,77 @@ protected static function boot() static::addGlobalScope(new EmpresaScope()); } - protected $fillable = ['id','modelo_equipo_id','orden_de_compra_id','custodio_id','estacione_id','area_id','check_list_id','num_cajas','sociedad','no_serie','codigo_barras','codigo_avianca','codigo_otro','descripcion','ip','estado','estatus','garantia','observaciones','imagen','codigo_contable','hp_warrantyLevel','hp_endDate','hp_displaySerialNumber','hp_modelNumber','hp_countryOfPurchase','hp_newProduct_seriesName','hp_newProduct_imageUrl','hp_warrantyResultRedirectUrl','empresa_procede1']; + protected $fillable = ['id', 'modelo_equipo_id', 'orden_de_compra_id', 'custodio_id', 'estacione_id', 'area_id', 'check_list_id', 'num_cajas', 'sociedad', 'no_serie', 'codigo_barras', 'codigo_avianca', 'codigo_otro', 'descripcion', 'ip', 'estado', 'estatus', 'garantia', 'observaciones', 'imagen', 'codigo_contable', 'hp_warrantyLevel', 'hp_endDate', 'hp_displaySerialNumber', 'hp_modelNumber', 'hp_countryOfPurchase', 'hp_newProduct_seriesName', 'hp_newProduct_imageUrl', 'hp_warrantyResultRedirectUrl', 'empresa_procede1']; /* * estado enum('BUENO', 'MALO', 'NUEVO') * estatus enum('VIGENTE', 'BODEGA', 'BAJA') * garantia enum('SI', 'NO') * */ - public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM equipos WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM equipos 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 getCustodio() { - $type = DB::select( DB::raw("select count(*) ,custodio_id from equipos_logs group by custodio_id '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("select count(*) ,custodio_id from equipos_logs group by custodio_id '".$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 modelo_equipoxc() { return $this->hasOne('App\ModeloEquipo', 'id', 'modelo_equipo_id'); } + public function orden_de_compraxc() { return $this->hasOne('App\OrdenDeCompra', 'id', 'orden_de_compra_id'); } + public function custodioxc() { return $this->hasOne('App\Custodios', 'id', 'custodio_id'); } + public function estacionxc() { return $this->hasOne('App\Estaciones', 'id', 'estacione_id'); } + public function areaxc() { return $this->hasOne('App\Areas', 'id', 'area_id'); } + public function check_listxc() { return $this->hasOne('App\CheckList', 'id', 'check_list_id'); } + public function equipos_logxc() { return $this->hasOne('App\Equipos_log', 'id', 'id_equipos'); } + public function equipos_reponovedadesdetalle() { return $this->hasOne('App\RepoNovedadesDetalle', 'id_equipos', 'id'); } - - } diff --git a/app/Equipos_log.php b/app/Equipos_log.php index ec3fc523..717c6820 100644 --- a/app/Equipos_log.php +++ b/app/Equipos_log.php @@ -9,6 +9,5 @@ class Equipos_log extends Model { use SoftDeletes; protected $dates = ['deleted_at']; - protected $fillable = ['id_equipos','acciondb','modelo_equipo_id','orden_de_compra_id','custodio_id','estacione_id','area_id','check_list_id','num_cajas','sociedad','no_serie','codigo_barras','codigo_avianca','codigo_otro','descripcion','ip','estado','estatus','garantia','observaciones','imagen','codigo_contable','hp_warrantyLevel','hp_endDate','hp_displaySerialNumber','hp_modelNumber','hp_countryOfPurchase','hp_newProduct_seriesName','hp_newProduct_imageUrl','hp_warrantyResultRedirectUrl','id_users','empresa_procede1']; - + protected $fillable = ['id_equipos', 'acciondb', 'modelo_equipo_id', 'orden_de_compra_id', 'custodio_id', 'estacione_id', 'area_id', 'check_list_id', 'num_cajas', 'sociedad', 'no_serie', 'codigo_barras', 'codigo_avianca', 'codigo_otro', 'descripcion', 'ip', 'estado', 'estatus', 'garantia', 'observaciones', 'imagen', 'codigo_contable', 'hp_warrantyLevel', 'hp_endDate', 'hp_displaySerialNumber', 'hp_modelNumber', 'hp_countryOfPurchase', 'hp_newProduct_seriesName', 'hp_newProduct_imageUrl', 'hp_warrantyResultRedirectUrl', 'id_users', 'empresa_procede1']; } diff --git a/app/Estaciones.php b/app/Estaciones.php index fe00fe60..52c23f28 100644 --- a/app/Estaciones.php +++ b/app/Estaciones.php @@ -9,7 +9,7 @@ class Estaciones extends Model { protected $dates = ['deleted_at']; - protected $fillable = ['estacion','empresa','nombre_largo','pais']; + protected $fillable = ['estacion', 'empresa', 'nombre_largo', 'pais']; protected static function boot() { @@ -25,16 +25,15 @@ public function empresaxc() public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM estaciones WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM estaciones WHERE Field = '".$tabla."'"))[0]->Type; preg_match('/^enum\((.*)\)$/', $type, $matches); - $enum = array(); - $enumerado = explode(',', $matches[1]); - foreach($enumerado as $value ) - { - $v = trim( $value, "'" ); + $enum = []; + $enumerado = explode(',', $matches[1]); + foreach ($enumerado as $value) { + $v = trim($value, "'"); $enum = array_add($enum, $v, $v); } + return $enum; } - } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 429e2a76..05c826f0 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,18 +1,21 @@ handleException($request, $exception); app(CorsService::class)->addActualRequestHeaders($response, $request); + return $response; } + public function handleException($request, Exception $exception) { - if (config('app.debug')&&!$request->is('api/*')) { + if (config('app.debug') && !$request->is('api/*')) { return parent::render($request, $exception); } if ($exception instanceof ValidationException) { @@ -65,6 +73,7 @@ public function handleException($request, Exception $exception) } if ($exception instanceof ModelNotFoundException) { $modelo = strtolower(class_basename($exception->getModel())); + return $this->errorResponse("No existe ninguna instancia de {$modelo} con el id especificado", 404); } if ($exception instanceof AuthenticationException) { @@ -96,15 +105,15 @@ public function handleException($request, Exception $exception) return parent::render($request, $exception); } - return $this->errorResponse('Falla inesperada. Intente luego', 500); } /** * Convert an authentication exception into an unauthenticated response. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) @@ -112,13 +121,16 @@ protected function unauthenticated($request, AuthenticationException $exception) if ($this->isFrontend($request)) { return redirect()->guest('login'); } - return $this->errorResponse('No autenticado.', 401); + + return $this->errorResponse('No autenticado.', 401); } + /** * Create a response object from the given validation exception. * - * @param \Illuminate\Validation\ValidationException $e - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Validation\ValidationException $e + * @param \Illuminate\Http\Request $request + * * @return \Symfony\Component\HttpFoundation\Response */ protected function convertValidationExceptionToResponse(ValidationException $e, $request) @@ -130,10 +142,12 @@ protected function convertValidationExceptionToResponse(ValidationException $e, ->withInput($request->input()) ->withErrors($errors); } + return $this->errorResponse($errors, 422); } + private function isFrontend($request) { return $request->acceptsHtml() && collect($request->route()->middleware())->contains('web'); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index c967e38d..ef5a58dc 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -3,22 +3,22 @@ namespace App\Http\Controllers; use App\Traits\ApiResponser; -use Illuminate\Http\Request; -use Illuminate\Support\Facades\Gate; use Illuminate\Auth\Access\AuthorizationException; +use Illuminate\Support\Facades\Gate; class ApiController extends Controller { use ApiResponser; + public function __construct() { - $this->middleware('auth:api'); + $this->middleware('auth:api'); } + protected function allowedAdminAction() { - if (Gate::denies('admin-action')) { + if (Gate::denies('admin-action')) { throw new AuthorizationException('Esta acción no te es permitida'); - } + } } - } diff --git a/app/Http/Controllers/ArbolController.php b/app/Http/Controllers/ArbolController.php index b0d1e15e..6ec068bd 100644 --- a/app/Http/Controllers/ArbolController.php +++ b/app/Http/Controllers/ArbolController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Arbol; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class ArbolController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:system'); } + /** * Display a listing of the resource. * @@ -46,8 +43,8 @@ public function create() */ public function store(Request $request) { - // dd($request->all()); - + // dd($request->all()); + Arbol::create($request->all()); Session::flash('flash_message', 'Arbol added!'); @@ -58,7 +55,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -72,7 +69,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -86,13 +83,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $arbol = Arbol::findOrFail($id); $arbol->update($request->all()); @@ -104,7 +100,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -116,5 +112,4 @@ public function destroy($id) return redirect('arbol'); } - } diff --git a/app/Http/Controllers/AreasController.php b/app/Http/Controllers/AreasController.php index 6d103d0f..9db66330 100644 --- a/app/Http/Controllers/AreasController.php +++ b/app/Http/Controllers/AreasController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Areas; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class AreasController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -59,7 +56,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -73,7 +70,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -87,7 +84,7 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -107,7 +104,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -119,5 +116,4 @@ public function destroy($id) return redirect('areas'); } - } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 59f01651..a8c8c96e 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -26,7 +26,8 @@ class ForgotPasswordController extends Controller /** * Send a reset link to the given user. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\RedirectResponse */ public function sendResetLinkEmail(Request $request) @@ -48,16 +49,18 @@ public function sendResetLinkEmail(Request $request) /** * Get the response for a successful password reset link. * - * @param string $response + * @param string $response + * * @return mixed */ protected function sendResetLinkResponse(Request $request, $response) { if ($request->expectsJson()) { return response()->json([ - 'status' => trans($response) + 'status' => trans($response), ]); } + return back()->with('status', trans($response)); } @@ -66,13 +69,15 @@ protected function sendResetLinkResponse(Request $request, $response) * * @param Request $request * @param $response + * * @return mixed */ protected function sendResetLinkFailedResponse(Request $request, $response) { if ($request->expectsJson()) { - return new JsonResponse(['email' => trans($response) ], 422); + return new JsonResponse(['email' => trans($response)], 422); } + return back()->withErrors( ['email' => trans($response)] ); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index e5905bbc..3cb90b2c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -57,21 +57,25 @@ public function __construct() */ public function username() { - return config('auth.providers.users.field','email'); + return config('auth.providers.users.field', 'email'); } /** * Attempt to log the user into the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return bool */ protected function attemptLogin(Request $request) { - if ($this->username() === 'email') return $this->attemptLoginAtAuthenticatesUsers($request); - if ( ! $this->attemptLoginAtAuthenticatesUsers($request)) { + if ($this->username() === 'email') { + return $this->attemptLoginAtAuthenticatesUsers($request); + } + if (!$this->attemptLoginAtAuthenticatesUsers($request)) { return $this->attempLoginUsingUsernameAsAnEmail($request); } + return false; } @@ -79,6 +83,7 @@ protected function attemptLogin(Request $request) * Attempt to log the user into application using username as an email. * * @param \Illuminate\Http\Request $request + * * @return bool */ protected function attempLoginUsingUsernameAsAnEmail(Request $request) @@ -87,6 +92,4 @@ protected function attempLoginUsingUsernameAsAnEmail(Request $request) ['email' => $request->input('username'), 'password' => $request->input('password')], $request->has('remember')); } - - } diff --git a/app/Http/Controllers/Auth/Oauth2Controller.php b/app/Http/Controllers/Auth/Oauth2Controller.php index 4bd44d41..d3977f89 100644 --- a/app/Http/Controllers/Auth/Oauth2Controller.php +++ b/app/Http/Controllers/Auth/Oauth2Controller.php @@ -2,30 +2,28 @@ namespace App\Http\Controllers\Auth; +use App\Http\Controllers\Controller; use App\OAuthApp; use GuzzleHttp\Client; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Session; class Oauth2Controller extends Controller { public function __construct() { - } - - - public function redirect(Request $request){ + public function redirect(Request $request) + { //session()->flash('redirect_oauth2', 'redirect'); $request->validate([ - 'client_id' => 'required', - 'token_secret' => 'required', + 'client_id' => 'required', + 'token_secret' => 'required', 'client_secret' => 'required', ]); - $oauth=$request->all(); + $oauth = $request->all(); $oauth['id'] = session('_token'); $oauth['activo'] = OAuthApp::AUTH_ACTIVO; @@ -33,27 +31,28 @@ public function redirect(Request $request){ //dd(session()->all()); $query = http_build_query([ - 'client_id' => $request->input('client_id'), - 'redirect_uri' => env('APP_URL').'/callback', + 'client_id' => $request->input('client_id'), + 'redirect_uri' => env('APP_URL').'/callback', 'response_type' => 'code', - 'scope' => 'place-orders', + 'scope' => 'place-orders', ]); - $redireccTOAut2=env('APP_URL').'/oauth/authorize?'.$query; - return redirect($redireccTOAut2); + $redireccTOAut2 = env('APP_URL').'/oauth/authorize?'.$query; + return redirect($redireccTOAut2); } - public function callback(Request $request){ - $token_oauth = OAuthApp::where('id','=',session('_token'))->first(); + public function callback(Request $request) + { + $token_oauth = OAuthApp::where('id', '=', session('_token'))->first(); $http = new Client(); $response = $http->post(env('APP_URL').'/oauth/token', [ 'form_params' => [ - 'grant_type' => 'authorization_code', - 'client_id' => $token_oauth->client_id, + 'grant_type' => 'authorization_code', + 'client_id' => $token_oauth->client_id, 'client_secret' => $token_oauth->client_secret, - 'redirect_uri' => env('APP_URL').'/callback', - 'code' => $request->code, + 'redirect_uri' => env('APP_URL').'/callback', + 'code' => $request->code, ], ]); $token_oauth->activo = OAuthApp::AUTH_INACTIVO; diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 2b55bceb..eb935792 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,14 +2,13 @@ namespace App\Http\Controllers\Auth; -use App\User; -use Validator; use App\Http\Controllers\Controller; +use App\User; use Illuminate\Foundation\Auth\RegistersUsers; +use Validator; /** - * Class RegisterController - * @package %%NAMESPACE%%\Http\Controllers\Auth + * Class RegisterController. */ class RegisterController extends Controller { @@ -56,45 +55,48 @@ public function __construct() /** * Get a validator for an incoming registration request. * - * @param array $data + * @param array $data + * * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ - 'name' => 'required|max:255', - 'username' => 'sometimes|required|max:255|unique:users', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:6|confirmed', + 'name' => 'required|max:255', + 'username' => 'sometimes|required|max:255|unique:users', + 'email' => 'required|email|max:255|unique:users', + 'password' => 'required|min:6|confirmed', 'first_name' => 'required|max:255', - 'last_name' => 'required|max:255', - 'terms' => 'required', + 'last_name' => 'required|max:255', + 'terms' => 'required', ]); } /** * Create a new user instance after a valid registration. * - * @param array $data + * @param array $data + * * @return User */ protected function create(array $data) { $fields = [ - 'name' => $data['name'], - 'email' => $data['email'], - 'first_name' => $data['first_name'], - 'last_name' => $data['last_name'], - 'username' => $data['username'], - 'rol' =>'registrado', - 'empresa' =>'Avianca EC', - 'token' =>User::generarVerificationToken(), + 'name' => $data['name'], + 'email' => $data['email'], + 'first_name' => $data['first_name'], + 'last_name' => $data['last_name'], + 'username' => $data['username'], + 'rol' => 'registrado', + 'empresa' => 'Avianca EC', + 'token' => User::generarVerificationToken(), 'verification_token' => User::generarVerificationToken(), - 'password' => bcrypt($data['password']), + 'password' => bcrypt($data['password']), ]; - if (config('auth.providers.users.field','email') === 'username' && isset($data['username'])) { + if (config('auth.providers.users.field', 'email') === 'username' && isset($data['username'])) { $fields['username'] = $data['username']; } + return User::create($fields); } } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index c73882a8..269e6719 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -4,9 +4,9 @@ use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ResetsPasswords; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Password; -use Illuminate\Http\JsonResponse; class ResetPasswordController extends Controller { @@ -26,7 +26,8 @@ class ResetPasswordController extends Controller /** * Reset the given user's password. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\RedirectResponse */ public function reset(Request $request) @@ -38,8 +39,8 @@ public function reset(Request $request) // database. Otherwise we will parse the error and return the response. $response = $this->broker()->reset( $this->credentials($request), function ($user, $password) { - $this->resetPassword($user, $password); - } + $this->resetPassword($user, $password); + } ); // If the password was successfully reset, we will redirect the user back to @@ -54,16 +55,18 @@ public function reset(Request $request) * Get the response for a successful password reset. * * @param \Illuminate\Http\Request - * @param string $response + * @param string $response + * * @return \Illuminate\Http\RedirectResponse */ - protected function sendResetResponse(Request $request,$response) + protected function sendResetResponse(Request $request, $response) { if ($request->expectsJson()) { return response()->json([ - 'status' => trans($response) + 'status' => trans($response), ]); } + return redirect($this->redirectPath()) ->with('status', trans($response)); } @@ -72,14 +75,16 @@ protected function sendResetResponse(Request $request,$response) * Get the response for a failed password reset. * * @param \Illuminate\Http\Request - * @param string $response + * @param string $response + * * @return mixed */ protected function sendResetFailedResponse(Request $request, $response) { if ($request->expectsJson()) { - return new JsonResponse(['email' => trans($response) ], 422); + return new JsonResponse(['email' => trans($response)], 422); } + return redirect()->back() ->withInput($request->only('email')) ->withErrors(['email' => trans($response)]); @@ -90,8 +95,9 @@ protected function sendResetFailedResponse(Request $request, $response) * * If no token is present, display the link request form. * - * @param \Illuminate\Http\Request $request - * @param string|null $token + * @param \Illuminate\Http\Request $request + * @param string|null $token + * * @return \Illuminate\Http\Response */ public function showResetForm(Request $request, $token = null) diff --git a/app/Http/Controllers/AuthenticateController.php b/app/Http/Controllers/AuthenticateController.php index f679dd1b..be6755e0 100644 --- a/app/Http/Controllers/AuthenticateController.php +++ b/app/Http/Controllers/AuthenticateController.php @@ -3,10 +3,6 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use IlluminateHttpRequest; - -use AppHttpRequests; -use AppHttpControllersController; use JWTAuth; use Tymon\JWTAuthExceptions\JWTException; @@ -23,7 +19,7 @@ public function authenticate(Request $request) try { // verify the credentials and create a token for the user - if (! $token = JWTAuth::attempt($credentials)) { + if (!$token = JWTAuth::attempt($credentials)) { return response()->json(['error' => 'invalid_credentials'], 401); } } catch (JWTException $e) { diff --git a/app/Http/Controllers/BitacoraController.php b/app/Http/Controllers/BitacoraController.php index 519b4651..9dc81187 100644 --- a/app/Http/Controllers/BitacoraController.php +++ b/app/Http/Controllers/BitacoraController.php @@ -2,29 +2,25 @@ namespace App\Http\Controllers; +use App\Bitacora; use App\CheckList_OpcionesCheckList; use App\Custodios; use App\Equipos; -use App\Http\Requests; -use App\Http\Controllers\Controller; - -use App\Bitacora; use App\User; -use Illuminate\Http\Request; use Carbon\Carbon; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; use Session; class BitacoraController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); - } + /** * Display a listing of the resource. * @@ -46,20 +42,21 @@ public function create() { $equipo_id = Session::get('equipo_id'); - if($equipo_id==null){ + if ($equipo_id == null) { return redirect('equipos'); } $equipo = Equipos::findOrFail($equipo_id); - $custodio_id=$equipo->custodio_id; + $custodio_id = $equipo->custodio_id; $user_id = Auth::id(); - $custodio = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $usuario = User::orderBy('name','asc')->pluck('name','id'); - // dd($equipo); - $dtos=array( - 'custodio'=>$custodio, - 'usuario'=>$usuario, - ); - return view('directory.bitacora.create', compact('dtos', 'equipo_id','custodio_id','user_id')); + $custodio = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $usuario = User::orderBy('name', 'asc')->pluck('name', 'id'); + // dd($equipo); + $dtos = [ + 'custodio'=> $custodio, + 'usuario' => $usuario, + ]; + + return view('directory.bitacora.create', compact('dtos', 'equipo_id', 'custodio_id', 'user_id')); } /** @@ -69,7 +66,6 @@ public function create() */ public function store(Request $request) { - $request->input('fecha_ingreso', Carbon::createFromFormat('Y-m-d', $request->get('fecha_ingreso'))); $BI = Bitacora::create($request->all()); @@ -78,26 +74,26 @@ public function store(Request $request) $equipo_id = Session::get('equipo_id'); - if($equipo_id==null){ + if ($equipo_id == null) { return redirect('equipos'); } $equipo = Equipos::findOrFail($equipo_id); $checklist_opcionescheck = CheckList_OpcionesCheckList::where('check_list_id', $equipo->check_list_id)->paginate(200); - $bitacora = Bitacora::where('id_equipos','=',$equipo_id)->paginate(15); + $bitacora = Bitacora::where('id_equipos', '=', $equipo_id)->paginate(15); Session::put('equipo_id', $equipo_id); //return view('directory.equipos.show', compact('equipo','checklist_opcionescheck','bitacora')); //return redirect('bitacora'); - return Redirect::action('EquiposController@show', array($equipo_id)); + return Redirect::action('EquiposController@show', [$equipo_id]); } /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -111,34 +107,33 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { - $custodio = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $usuario = User::orderBy('name','asc')->pluck('name','id'); + $custodio = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $usuario = User::orderBy('name', 'asc')->pluck('name', 'id'); // dd($equipo); - $dtos=array( - 'custodio'=>$custodio, - 'usuario'=>$usuario, - ); + $dtos = [ + 'custodio'=> $custodio, + 'usuario' => $usuario, + ]; $bitacora = Bitacora::findOrFail($id); - return view('directory.bitacora.edit', compact('bitacora','dtos')); + return view('directory.bitacora.edit', compact('bitacora', 'dtos')); } /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $bitacora = Bitacora::findOrFail($id); $request->input('fecha_ingreso', Carbon::createFromFormat('Y-m-d', $request->get('fecha_ingreso'))); @@ -147,13 +142,13 @@ public function update($id, Request $request) Session::flash('flash_message', 'Bitacora updated!'); //return redirect('bitacora'); - return Redirect::action('EquiposController@show', array($bitacora->id_equipos)); + return Redirect::action('EquiposController@show', [$bitacora->id_equipos]); } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -166,7 +161,6 @@ public function destroy($id) //return redirect('bitacora'); - return Redirect::action('EquiposController@show', array($bitacora->id_equipos)); + return Redirect::action('EquiposController@show', [$bitacora->id_equipos]); } - } diff --git a/app/Http/Controllers/BusquedaController.php b/app/Http/Controllers/BusquedaController.php index 6ba6d269..4a82b3b0 100644 --- a/app/Http/Controllers/BusquedaController.php +++ b/app/Http/Controllers/BusquedaController.php @@ -16,6 +16,7 @@ public function __construct() $this->middleware('auth'); //$this->middleware('authEmp:administrador'); } + /** * Display a listing of the resource. * @@ -26,8 +27,8 @@ public function index() // } - public function busqueda(Request $request){ - + public function busqueda(Request $request) + { $reglas = [ 'q' => 'required', ]; @@ -35,35 +36,35 @@ public function busqueda(Request $request){ /* * custodio */ - Busqueda::where('id', 'like' ,'%%')->delete(); + Busqueda::where('id', 'like', '%%')->delete(); $term = strtoupper($request->q) ?: ''; - $term = str_replace(" ", "%", "$term"); - $term_mat = strtok($term, "%"); - $tags= Custodios::where('nombre_responsable', 'like', '%'.$term.'%')-> + $term = str_replace(' ', '%', "$term"); + $term_mat = strtok($term, '%'); + $tags = Custodios::where('nombre_responsable', 'like', '%'.$term.'%')-> orwhere('cargo', 'like', '%'.$term.'%')-> orwhere('area_piso', 'like', '%'.$term.'%')->get(); foreach ($tags as $tag) { - $b=new Busqueda(); - $b->user_id = Auth::id(); - $b->palabra_q = $term; - $b->instancia = "Custodios"; - $b->instancia_id = $tag->id; - - $datoaux2=""; - $aux2=strtoupper($tag->nombre_responsable); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->nombre_responsable; + $b = new Busqueda(); + $b->user_id = Auth::id(); + $b->palabra_q = $term; + $b->instancia = 'Custodios'; + $b->instancia_id = $tag->id; + + $datoaux2 = ''; + $aux2 = strtoupper($tag->nombre_responsable); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->nombre_responsable; } - $aux2=strtoupper($tag->cargo); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->cargo; + $aux2 = strtoupper($tag->cargo); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->cargo; } - $aux2=strtoupper($tag->area_piso); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->area_piso; + $aux2 = strtoupper($tag->area_piso); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->area_piso; } - $b->dato=$tag->nombre_responsable." - ".$datoaux2; + $b->dato = $tag->nombre_responsable.' - '.$datoaux2; $b->save(); } /* @@ -72,44 +73,45 @@ public function busqueda(Request $request){ /* * equipo */ - $tags= Equipos::where('no_serie', 'like', '%'.$term.'%')-> + $tags = Equipos::where('no_serie', 'like', '%'.$term.'%')-> orwhere('codigo_barras', 'like', '%'.$term.'%')-> orwhere('codigo_otro', 'like', '%'.$term.'%')-> orwhere('descripcion', 'like', '%'.$term.'%')-> orwhere('ip', 'like', '%'.$term.'%')-> orwhere('codigo_avianca', 'like', '%'.$term.'%')->get(); foreach ($tags as $tag) { - $b=new Busqueda(); - $b->user_id = Auth::id(); - $b->palabra_q = $term; - $b->instancia = "ModeloEquipo"; - $b->instancia_id = $tag->id; - $datoaux2=""; - $aux2=strtoupper($tag->no_serie); - - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->no_serie; + $b = new Busqueda(); + $b->user_id = Auth::id(); + $b->palabra_q = $term; + $b->instancia = 'ModeloEquipo'; + $b->instancia_id = $tag->id; + $datoaux2 = ''; + $aux2 = strtoupper($tag->no_serie); + + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->no_serie; } - $aux2=strtoupper($tag->codigo_barras); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->codigo_barras; + $aux2 = strtoupper($tag->codigo_barras); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->codigo_barras; } - $aux2=strtoupper($tag->descripcion); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->descripcion; + $aux2 = strtoupper($tag->descripcion); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->descripcion; } - $aux2=strtoupper($tag->observaciones); - if(str_contains($aux2, $term_mat)){ - $datoaux2=$datoaux2.$tag->observaciones; + $aux2 = strtoupper($tag->observaciones); + if (str_contains($aux2, $term_mat)) { + $datoaux2 = $datoaux2.$tag->observaciones; } - $b->dato=$tag->no_serie." - ".$tag->codigo_avianca . " - ".$datoaux2; + $b->dato = $tag->no_serie.' - '.$tag->codigo_avianca.' - '.$datoaux2; $b->save(); } /* * fin equipo */ - $busqueda= Busqueda::paginate(15); + $busqueda = Busqueda::paginate(15); + return view('directory.buscar.index', compact('busqueda')); } @@ -126,7 +128,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Busqueda $busqueda) @@ -137,7 +140,8 @@ public function store(Busqueda $busqueda) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show($id) @@ -148,7 +152,8 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -159,8 +164,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -171,7 +177,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/CheckListController.php b/app/Http/Controllers/CheckListController.php index 5a022dde..de9098fd 100644 --- a/app/Http/Controllers/CheckListController.php +++ b/app/Http/Controllers/CheckListController.php @@ -3,17 +3,12 @@ namespace App\Http\Controllers; use App\Areas; -use App\CheckList_OpcionesCheckList; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\CheckList; +use App\CheckList_OpcionesCheckList; use App\OpcionesCheckList; use App\User; use Illuminate\Http\Request; -use Carbon\Carbon; use Illuminate\Support\Facades\DB; -use phpDocumentor\Reflection\Types\Object_; use Session; class CheckListController extends Controller @@ -23,6 +18,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -44,12 +40,12 @@ public function index() */ public function create() { - $dts=array(); - $areas = Areas::pluck('area','id'); - $user = User::pluck('name','id'); - $dts=array($areas,$user); + $dts = []; + $areas = Areas::pluck('area', 'id'); + $user = User::pluck('name', 'id'); + $dts = [$areas, $user]; - return view('directory.checklist.create',compact('dts')); + return view('directory.checklist.create', compact('dts')); } /** @@ -59,7 +55,6 @@ public function create() */ public function store(Request $request) { - CheckList::create($request->all()); Session::flash('flash_message', 'CheckList added!'); @@ -70,7 +65,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -81,24 +76,24 @@ public function show($id) Session::flash('Crear_checklist', 'Crear_checklist'); - return view('directory.checklist.show', compact('checklist','checklist_opcionescheck')); + return view('directory.checklist.show', compact('checklist', 'checklist_opcionescheck')); } /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { - $areas = Areas::pluck('area','id'); - $user = User::pluck('name','id'); + $areas = Areas::pluck('area', 'id'); + $user = User::pluck('name', 'id'); $checklist = CheckList::findOrFail($id); - $checklist->extras2=$areas; - $checklist->extras3=$user; + $checklist->extras2 = $areas; + $checklist->extras3 = $user; return view('directory.checklist.edit', compact('checklist')); } @@ -106,13 +101,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $checklist = CheckList::findOrFail($id); $checklist->update($request->all()); @@ -124,7 +118,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -136,85 +130,81 @@ public function destroy($id) return redirect('checklist'); } - public function crearChecklist($area_id,$checklist){ + + public function crearChecklist($area_id, $checklist) + { $value = Session::get('Crear_checklist'); - if($value=='Crear_checklist'){ + if ($value == 'Crear_checklist') { DB::table('check_list__opciones_check_lists')->where('check_list_id', '=', $checklist)->delete(); - $op= OpcionesCheckList::where('area_id', 3)->get(); + $op = OpcionesCheckList::where('area_id', 3)->get(); foreach ($op as $o) { - $ck= new CheckList_OpcionesCheckList(); - $ck->check_list_id=$checklist; - $ck->opciones_check_list_id=$o->id; - $ck->tipo=$o->tipo; - $ck->atributo=$o->atributo; + $ck = new CheckList_OpcionesCheckList(); + $ck->check_list_id = $checklist; + $ck->opciones_check_list_id = $o->id; + $ck->tipo = $o->tipo; + $ck->atributo = $o->atributo; //dd($ck); $ck->save(); } - $op2= OpcionesCheckList::where('area_id', $area_id)->get(); + $op2 = OpcionesCheckList::where('area_id', $area_id)->get(); foreach ($op2 as $o) { - $ck= new CheckList_OpcionesCheckList(); - $ck->check_list_id=$checklist; - $ck->opciones_check_list_id=$o->id; - $ck->tipo=$o->tipo; - $ck->atributo=$o->atributo; + $ck = new CheckList_OpcionesCheckList(); + $ck->check_list_id = $checklist; + $ck->opciones_check_list_id = $o->id; + $ck->tipo = $o->tipo; + $ck->atributo = $o->atributo; //dd($ck); $ck->save(); } - } $checklist_opcionescheck = CheckList_OpcionesCheckList::where('check_list_id', $checklist)->paginate(15); //dd($checklist_opcionescheck); //$checklist_opcionescheck = CheckList_OpcionesCheckList::paginate(15); return view('directory.checklist_opcionescheck.index_dat', compact('checklist_opcionescheck')); - } - public function editarChecklist($area_id,$checklist){ + public function editarChecklist($area_id, $checklist) + { $checklist_opcionescheck = CheckList_OpcionesCheckList::where('check_list_id', $checklist)->paginate(15); //dd($checklist_opcionescheck); //$checklist_opcionescheck = CheckList_OpcionesCheckList::paginate(15); return view('directory.checklist_opcionescheck.index_dat', compact('checklist_opcionescheck')); - } - public function crearChecklist_mini($area_id,$checklist){ + public function crearChecklist_mini($area_id, $checklist) + { $value = Session::get('Crear_checklist'); - if($value=='Crear_checklist'){ + if ($value == 'Crear_checklist') { DB::table('check_list__opciones_check_lists')->where('check_list_id', '=', $checklist)->delete(); - $op= OpcionesCheckList::where('area_id', 3)->get(); + $op = OpcionesCheckList::where('area_id', 3)->get(); foreach ($op as $o) { - $ck= new CheckList_OpcionesCheckList(); - $ck->check_list_id=$checklist; - $ck->opciones_check_list_id=$o->id; - $ck->tipo=$o->tipo; - $ck->atributo=$o->atributo; + $ck = new CheckList_OpcionesCheckList(); + $ck->check_list_id = $checklist; + $ck->opciones_check_list_id = $o->id; + $ck->tipo = $o->tipo; + $ck->atributo = $o->atributo; //dd($ck); $ck->save(); } - $op2= OpcionesCheckList::where('area_id', $area_id)->get(); + $op2 = OpcionesCheckList::where('area_id', $area_id)->get(); foreach ($op2 as $o) { - $ck= new CheckList_OpcionesCheckList(); - $ck->check_list_id=$checklist; - $ck->opciones_check_list_id=$o->id; - $ck->tipo=$o->tipo; - $ck->atributo=$o->atributo; + $ck = new CheckList_OpcionesCheckList(); + $ck->check_list_id = $checklist; + $ck->opciones_check_list_id = $o->id; + $ck->tipo = $o->tipo; + $ck->atributo = $o->atributo; //dd($ck); $ck->save(); } - } $checklist_opcionescheck = CheckList_OpcionesCheckList::where('check_list_id', $checklist)->paginate(5); //dd($checklist_opcionescheck); //$checklist_opcionescheck = CheckList_OpcionesCheckList::paginate(15); return view('directory.checklist_opcionescheck.index_dat_mini', compact('checklist_opcionescheck')); - - } - - } diff --git a/app/Http/Controllers/CheckList_OpcionesCheckListController.php b/app/Http/Controllers/CheckList_OpcionesCheckListController.php index 9bf5f2f3..d05f0c59 100644 --- a/app/Http/Controllers/CheckList_OpcionesCheckListController.php +++ b/app/Http/Controllers/CheckList_OpcionesCheckListController.php @@ -2,25 +2,20 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\CheckList_OpcionesCheckList; use Illuminate\Http\Request; -use Carbon\Carbon; +use Illuminate\Http\Response; use Illuminate\Support\Facades\Input; use Session; -use Illuminate\Http\Response; class CheckList_OpcionesCheckListController extends Controller { - - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -50,7 +45,6 @@ public function create() */ public function store(Request $request) { - CheckList_OpcionesCheckList::create($request->all()); Session::flash('flash_message', 'CheckList_OpcionesCheckList added!'); @@ -61,7 +55,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -75,7 +69,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -89,45 +83,43 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $checklist_opcionescheck = CheckList_OpcionesCheckList::findOrFail($id); -/* - // return "Hola!!!!"; - //return redirect('checklist_opcionescheck'); - - $rules = array( - 'valor1' => 'required', - //'nerd_level' => 'required|numeric' - ); - $validator = \Validator::make(Input::all(), $rules); - - // process the login - if ($validator->fails()) { - return "Dato incompleto, o no hay "; - } else { - $checklist_opcionescheck->update($request->all()); - - Session::flash('flash_message', 'CheckList_OpcionesCheckList updated!'); - return "Actualizado !!!"; - }*/ + /* + // return "Hola!!!!"; + //return redirect('checklist_opcionescheck'); + + $rules = array( + 'valor1' => 'required', + //'nerd_level' => 'required|numeric' + ); + $validator = \Validator::make(Input::all(), $rules); + + // process the login + if ($validator->fails()) { + return "Dato incompleto, o no hay "; + } else { + $checklist_opcionescheck->update($request->all()); + + Session::flash('flash_message', 'CheckList_OpcionesCheckList updated!'); + return "Actualizado !!!"; + }*/ $checklist_opcionescheck->update($request->all()); Session::flash('flash_message', 'CheckList_OpcionesCheckList updated!'); - return "Actualizado !!!"; - + return 'Actualizado !!!'; } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -138,27 +130,32 @@ public function destroy($id) Session::flash('flash_message', 'CheckList_OpcionesCheckList deleted!'); //return redirect('checklist_opcionescheck'); - return "Se borro exitosamente !!!"; + return 'Se borro exitosamente !!!'; } - public function crearChecklist_option_storage(Request $request){ - CheckList_OpcionesCheckList::create(array( + + public function crearChecklist_option_storage(Request $request) + { + CheckList_OpcionesCheckList::create([ 'check_list_id' => Input::get('check_list_id'), - 'atributo' => Input::get('atributo'), - 'tipo' => Input::get('tipo') - )); + 'atributo' => Input::get('atributo'), + 'tipo' => Input::get('tipo'), + ]); - return response()->json(array('success' => true)); + return response()->json(['success' => true]); } + public function crearChecklist_option_create($id) { - $dato=array('id' => $id); - return view('directory.checklist_opcionescheck.create_mini',$dato); + $dato = ['id' => $id]; + + return view('directory.checklist_opcionescheck.create_mini', $dato); } + public function crearChecklist_option_delete($id) { $checklist_opcionescheck = CheckList_OpcionesCheckList::findOrFail($id); $checklist_opcionescheck->delete(); - return response()->json(array('success' => true)); - } + return response()->json(['success' => true]); + } } diff --git a/app/Http/Controllers/ConfiguracionController.php b/app/Http/Controllers/ConfiguracionController.php index 74d5c4b9..229b0ee3 100644 --- a/app/Http/Controllers/ConfiguracionController.php +++ b/app/Http/Controllers/ConfiguracionController.php @@ -2,22 +2,18 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Configuracion; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class ConfiguracionController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:administrador;system'); } + /** * Display a listing of the resource. * @@ -47,7 +43,6 @@ public function create() */ public function store(Request $request) { - Configuracion::create($request->all()); Session::flash('flash_message', 'Configuracion added!'); @@ -58,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -72,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -86,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $config = Configuracion::findOrFail($id); $config->update($request->all()); @@ -104,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -116,5 +110,4 @@ public function destroy($id) return redirect('config'); } - } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a23..a0a2a8a3 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { diff --git a/app/Http/Controllers/CustodiosController.php b/app/Http/Controllers/CustodiosController.php index c20c6936..f8ee5291 100644 --- a/app/Http/Controllers/CustodiosController.php +++ b/app/Http/Controllers/CustodiosController.php @@ -3,12 +3,8 @@ namespace App\Http\Controllers; use App\Areas; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Custodios; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class CustodiosController extends Controller @@ -18,6 +14,7 @@ public function __construct() $this->middleware('auth')->except(['verify', 'resend']); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas')->except(['verify', 'resend']); } + /** * Display a listing of the resource. * @@ -44,8 +41,9 @@ public function indexnotificaciones() */ public function create() { - $areas = Areas::orderBy('area','asc')->pluck('area','area'); - return view('directory.custodio.create',compact('areas')); + $areas = Areas::orderBy('area', 'asc')->pluck('area', 'area'); + + return view('directory.custodio.create', compact('areas')); } /** @@ -56,19 +54,19 @@ public function create() public function store(Request $request) { $reglas = [ - 'ciudad' => 'required', - 'direccion' => 'required', + 'ciudad' => 'required', + 'direccion' => 'required', 'documentoIdentificacion' => 'required', - 'cargo' => 'required', - 'compania' => 'required', - 'telefono' => 'required', - 'nombre_responsable' => 'required', - 'area_piso' => 'required', - 'email' => 'required', + 'cargo' => 'required', + 'compania' => 'required', + 'telefono' => 'required', + 'nombre_responsable' => 'required', + 'area_piso' => 'required', + 'email' => 'required', ]; $this->validate($request, $reglas); - + Custodios::create($request->all()); Session::flash('flash_message', 'Custodios added!'); @@ -79,28 +77,29 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function show($id) { - $custodio = Custodios::find($id); - if ($custodio == null){ + if ($custodio == null) { Session::flash('flash_message', 'Custodio no encontrado!'); + return redirect('custodio'); } return view('directory.custodio.show', compact('custodio')); } + public function show_custom($id) { $custodio = Custodios::findOrFail($id); - $custodios = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); + $custodios = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); - return view('directory.custodio.show_custom', compact('custodio','custodios')); + return view('directory.custodio.show_custom', compact('custodio', 'custodios')); } public function show_custom_post(Request $request) @@ -114,16 +113,16 @@ public function show_custom_post(Request $request) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { - $custodio = Custodios::find($id); - if ($custodio == null){ + if ($custodio == null) { Session::flash('flash_message', 'Custodio no encontrado!'); + return redirect('custodio'); } @@ -133,27 +132,27 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { $reglas = [ - 'pais' => 'required', - 'ciudad' => 'required', - 'direccion' => 'required', + 'pais' => 'required', + 'ciudad' => 'required', + 'direccion' => 'required', 'documentoIdentificacion' => 'required', - 'cargo' => 'required', - 'compania' => 'required', - 'telefono' => 'required', - 'nombre_responsable' => 'required', - 'area_piso' => 'required', - 'email' => 'required', + 'cargo' => 'required', + 'compania' => 'required', + 'telefono' => 'required', + 'nombre_responsable' => 'required', + 'area_piso' => 'required', + 'email' => 'required', ]; $this->validate($request, $reglas); - + $custodio = Custodios::findOrFail($id); $custodio->update($request->all()); @@ -165,7 +164,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -180,18 +179,18 @@ public function destroy($id) public function showACustom($documentoIdentificacion) { - - $custodio = Custodios::where('documentoIdentificacion','=',$documentoIdentificacion); - if ($custodio == null){ + $custodio = Custodios::where('documentoIdentificacion', '=', $documentoIdentificacion); + if ($custodio == null) { Session::flash('flash_message_home', 'Custodio no encontrado!'); + return redirect('home'); } return view('directory.custodio.showACustom', compact('custodio')); } + public function verify($token) { - $custodios = Custodios::where('verification_token', $token)->firstOrFail(); $custodios->token = Custodios::generarToken(); $custodios->verification_token = null; @@ -199,24 +198,26 @@ public function verify($token) //dd($token); $custodios->save(); Session::flash('flash_message', 'MEnsaje enviadoCon clave.'); + return redirect('login'); } + public function resend(Custodios $custodios) { //dd($custodios); - retry(5, function() use ($custodios) { - if($custodios->token==null){ - $custodios->token=Custodios::generarToken(); + retry(5, function () use ($custodios) { + if ($custodios->token == null) { + $custodios->token = Custodios::generarToken(); } - if($custodios->verification_token==null){ - $custodios->verification_token=Custodios::generarVerificationToken(); + if ($custodios->verification_token == null) { + $custodios->verification_token = Custodios::generarVerificationToken(); } $custodios->save(); $custodios->sendPasswordResetNotification($custodios); }, 100); Session::flash('flash_message', 'El correo de verificación se ha reenviado a: '.$custodios->email); + return redirect('login'); } - } diff --git a/app/Http/Controllers/DenunciasController.php b/app/Http/Controllers/DenunciasController.php index 1ac27483..80d64062 100644 --- a/app/Http/Controllers/DenunciasController.php +++ b/app/Http/Controllers/DenunciasController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Denuncias; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class DenunciasController extends Controller @@ -47,7 +43,6 @@ public function create() */ public function store(Request $request) { - Denuncias::create($request->all()); Session::flash('flash_message', 'Denuncias added!'); @@ -58,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -72,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -86,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $denuncia = Denuncias::findOrFail($id); $denuncia->update($request->all()); @@ -104,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -116,5 +110,4 @@ public function destroy($id) return redirect('denuncias'); } - } diff --git a/app/Http/Controllers/EmpresaController.php b/app/Http/Controllers/EmpresaController.php index ce28dc15..4240730b 100644 --- a/app/Http/Controllers/EmpresaController.php +++ b/app/Http/Controllers/EmpresaController.php @@ -4,17 +4,16 @@ use App\Empresa; use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Session; class EmpresaController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system'); } + /** * Display a listing of the resource. * @@ -50,21 +49,21 @@ public function create() public function store(Request $request) { $this->validate($request, [ - 'empresa' => 'required|max:255', + 'empresa' => 'required|max:255', 'formula_codigo' => 'required', ]); - $rol = Empresa::create($request->all()); - $rol->save(); - ////////////////////////////////////////////// - Session::flash('flash_message', 'Empresa added!'); - return redirect('empresa'); + $rol = Empresa::create($request->all()); + $rol->save(); + ////////////////////////////////////////////// + Session::flash('flash_message', 'Empresa added!'); + return redirect('empresa'); } /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -78,7 +77,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -86,44 +85,39 @@ public function edit($id) { $empresa = Empresa::where('empresa', '=', $id)->firstOrFail(); - return view('directory.empresa.edit', compact('empresa')); } /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - - $this->validate($request, [ - 'empresa' => 'required|max:255', + 'empresa' => 'required|max:255', 'formula_codigo' => 'required', ]); $empresa = Empresa::where('empresa', '=', $id)->firstOrFail(); $empresa->update($request->all()); ///////////////////////////////////////// Session::flash('flash_message', 'Permisos Rol updated!'); - return redirect('empresa'); - + return redirect('empresa'); } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ public function destroy($id) { - Empresa::destroy($id); Session::flash('flash_message', '¡Empresa Borrado!'); diff --git a/app/Http/Controllers/EquiposController.php b/app/Http/Controllers/EquiposController.php index 11ea77ff..bba28bd0 100644 --- a/app/Http/Controllers/EquiposController.php +++ b/app/Http/Controllers/EquiposController.php @@ -9,29 +9,24 @@ use App\Configuracion; use App\Custodios; use App\Empresa; +use App\Equipos; use App\Equipos_log; use App\Estaciones; use App\Http\Requests; -use App\Http\Controllers\Controller; - -use App\Equipos; -use App\Jobs\SendActualizacionCustodioeEmail; use App\ModeloEquipo; use App\OrdenDeCompra; use App\User; +use Carbon\Carbon; use GuzzleHttp\Client; use Illuminate\Http\Request; -use Carbon\Carbon; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; - +use Intervention\Image\ImageManagerStatic as Image; use League\Flysystem\Exception; use Session; use Webpatser\Uuid\Uuid; -use Intervention\Image\ImageManagerStatic as Image; class EquiposController extends Controller { @@ -39,8 +34,8 @@ public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); - } + /** * Display a listing of the resource. * @@ -60,50 +55,47 @@ public function index() */ public function create() { - $modelos = ModeloEquipo::orderBy('modelo','asc')->pluck('modelo','id'); - $orden = OrdenDeCompra::orderBy('ordenCompra','asc')->pluck('ordenCompra','id'); - $custodio = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $estaciones = Estaciones::pluck('estacion','id'); - $areas = Areas::orderBy('area','asc')->pluck('area','id'); - $empresa = Empresa::orderBy('empresa','asc')->pluck('empresa','empresa'); + $modelos = ModeloEquipo::orderBy('modelo', 'asc')->pluck('modelo', 'id'); + $orden = OrdenDeCompra::orderBy('ordenCompra', 'asc')->pluck('ordenCompra', 'id'); + $custodio = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $estaciones = Estaciones::pluck('estacion', 'id'); + $areas = Areas::orderBy('area', 'asc')->pluck('area', 'id'); + $empresa = Empresa::orderBy('empresa', 'asc')->pluck('empresa', 'empresa'); //////////////////////////////////////////////////////////////////////////// $util = Equipos::pluck('check_list_id'); - $config_custodio_prin= Configuracion::where('atributo','=','CUSTODIO_BODEGA')->first(); + $config_custodio_prin = Configuracion::where('atributo', '=', 'CUSTODIO_BODEGA')->first(); //-------------------------------------------------------------------------- $check_lists = CheckList::whereNotIn('id', $util ) - ->pluck('id_check_lists','id'); + ->pluck('id_check_lists', 'id'); //dd($check_lists); ///////////////////////////////////////////////////////////////////////////// //$check_lists = CheckList::pluck('id_check_lists','id'); Session::flash('Crear_checklist', 'Crear_checklist'); - $areas_defualt=''; + $areas_defualt = ''; if (session('areas_default')) { - $areas_defualt=session('areas_default'); - // dd($areas_defualt); + $areas_defualt = session('areas_default'); + // dd($areas_defualt); } + $dtos = [ + 'modelos' => $modelos, + 'orden' => $orden, + 'custodio' => $custodio, + 'custodio_defecto'=> $config_custodio_prin->valor, + 'estaciones' => $estaciones, + 'areas' => $areas, + 'areas_defualt' => $areas_defualt, + 'check_lists' => $check_lists, + 'empresa' => $empresa, - $dtos=array( - 'modelos'=>$modelos, - 'orden'=>$orden, - 'custodio'=>$custodio, - 'custodio_defecto'=>$config_custodio_prin->valor, - 'estaciones'=>$estaciones, - 'areas'=>$areas, - 'areas_defualt'=>$areas_defualt, - 'check_lists'=>$check_lists, - 'empresa'=>$empresa, + ]; - ); - - - - return view('directory.equipos.create', compact('dtos','equipo')); + return view('directory.equipos.create', compact('dtos', 'equipo')); } /** @@ -114,49 +106,48 @@ public function create() public function store(Requests\EquiposRequest $request) { - /** - * si encuentra uno con serie identica - */ + /** + * si encuentra uno con serie identica. + */ + $equipo_exist = Equipos::where('no_serie', '=', Input::get('no_serie'))->get(); - $equipo_exist = Equipos::where('no_serie','=',Input::get('no_serie'))->get(); + if ($equipo_exist->count() > 1) { + Session::flash('flash_message', 'Equipos con un numero de serie ya existente: '.Input::get('no_serie').', Se ha abierto el equipo existente, verificar datos.'); - if($equipo_exist->count()>1){ - Session::flash('flash_message', 'Equipos con un numero de serie ya existente: '.Input::get('no_serie').", Se ha abierto el equipo existente, verificar datos."); - return redirect('equipos/'.$equipo_exist->first()->id."/edit"); - } + return redirect('equipos/'.$equipo_exist->first()->id.'/edit'); + } session(['areas_default' => Input::get('area_id')]); $nerd = new CheckList(); - $nerd->area_id = Input::get('area_id'); - $nerd->user_id = Auth::id(); + $nerd->area_id = Input::get('area_id'); + $nerd->user_id = Auth::id(); $nerd->id_check_lists = uniqid('CHK-'); - $nerd->unik_check_lists= Uuid::generate(); + $nerd->unik_check_lists = Uuid::generate(); $nerd->save(); - $dathui009= new CheckListController(); - $utill77563=$dathui009->crearChecklist(Input::get('area_id'),$nerd->id); - $custorm=$request->all(); - $custorm['check_list_id']=$nerd->id; + $dathui009 = new CheckListController(); + $utill77563 = $dathui009->crearChecklist(Input::get('area_id'), $nerd->id); + $custorm = $request->all(); + $custorm['check_list_id'] = $nerd->id; - $file = Input::file('imagen');//la imagen se lee aca - - if(Input::hasFile('imagen')) { + $file = Input::file('imagen'); //la imagen se lee aca + if (Input::hasFile('imagen')) { $img = Image::make($file)->resize(600, 400); Response::make($img->encode('jpeg')); $custorm['imagen'] = $img; } - $equip3=Equipos::create($custorm); + $equip3 = Equipos::create($custorm); $custodio_n = Custodios::find(Input::get('custodio_id')); - $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n->save(); - $custorm['id_equipos']=$equip3->id; - $custorm['acciondb']='crear'; - $custorm['id_users']=Auth::user()->id; + $custorm['id_equipos'] = $equip3->id; + $custorm['acciondb'] = 'crear'; + $custorm['id_users'] = Auth::user()->id; Equipos_log::create($custorm); Session::flash('flash_message', 'Equipos added!'); - \Illuminate\Support\Facades\Session::put('x_notificar_time',\Carbon\Carbon::now()->addMinutes(0)); + \Illuminate\Support\Facades\Session::put('x_notificar_time', \Carbon\Carbon::now()->addMinutes(0)); return redirect('equipos'); //echo @@ -165,108 +156,104 @@ public function store(Requests\EquiposRequest $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function show($id) { - $equipo = \Illuminate\Support\Facades\Session::put('equipo_id',$id); + $equipo = \Illuminate\Support\Facades\Session::put('equipo_id', $id); $equipo = Equipos::findOrFail($id); - - - if($equipo->modelo_equipoxc->fabricante=='HP'&& - $equipo->hp_warrantyLevel==null){ - $http = new Client; + if ($equipo->modelo_equipoxc->fabricante == 'HP' && + $equipo->hp_warrantyLevel == null) { + $http = new Client(); $res = $http->request('GET', 'https://support.hp.com/hp-pps-services/os/getWarrantyInfo?serialnum='.$equipo->no_serie.'&counpurchase=es&cc=es&lc=es&redirectPage=WarrantyResult' ); - $respuesta =json_decode((string) $res->getBody(), true); + $respuesta = json_decode((string) $res->getBody(), true); //dd($respuesta["newProduct"]["imageUrl"]); - $equipo->hp_warrantyLevel = $respuesta["warrantyLevel"]; - $equipo->hp_endDate = $respuesta["endDate"]; - $equipo->hp_displaySerialNumber = $respuesta["displaySerialNumber"]; - $equipo->hp_modelNumber = $respuesta["modelNumber"]; - $equipo->hp_countryOfPurchase = $respuesta["countryOfPurchase"]; - $equipo->hp_newProduct_seriesName = $respuesta["newProduct"]["seriesName"]; - $equipo->hp_newProduct_imageUrl = $respuesta["newProduct"]["imageUrl"]; - $equipo->hp_warrantyResultRedirectUrl = $respuesta["warrantyResultRedirectUrl"]; - $equipo->empresa_procede1 = $respuesta["empresa_procede1"]; + $equipo->hp_warrantyLevel = $respuesta['warrantyLevel']; + $equipo->hp_endDate = $respuesta['endDate']; + $equipo->hp_displaySerialNumber = $respuesta['displaySerialNumber']; + $equipo->hp_modelNumber = $respuesta['modelNumber']; + $equipo->hp_countryOfPurchase = $respuesta['countryOfPurchase']; + $equipo->hp_newProduct_seriesName = $respuesta['newProduct']['seriesName']; + $equipo->hp_newProduct_imageUrl = $respuesta['newProduct']['imageUrl']; + $equipo->hp_warrantyResultRedirectUrl = $respuesta['warrantyResultRedirectUrl']; + $equipo->empresa_procede1 = $respuesta['empresa_procede1']; } - if(!$equipo->hp_endDate==null){ + if (!$equipo->hp_endDate == null) { $fecha_caduca = Carbon::createFromFormat('Y-m-d', $equipo->hp_endDate); $diferenciaanios = Carbon::now()->diffInDays($fecha_caduca, false); - if($diferenciaanios<0){ - $equipo->garantia = "NO"; + if ($diferenciaanios < 0) { + $equipo->garantia = 'NO'; $equipo->save(); Session::flash('flash_message_show1error', trans('form.nogarantia').$fecha_caduca); - }else{ - $equipo->garantia = "SI"; + } else { + $equipo->garantia = 'SI'; $equipo->save(); - Session::flash('flash_message_show1',trans('form.garantia_s') .$fecha_caduca); + Session::flash('flash_message_show1', trans('form.garantia_s').$fecha_caduca); } } - - - $checklist_opcionescheck = CheckList_OpcionesCheckList::where('check_list_id', $equipo->check_list_id)->paginate(200); - $bitacora = Bitacora::where('id_equipos','=',$id)->paginate(15); + $bitacora = Bitacora::where('id_equipos', '=', $id)->paginate(15); Session::put('equipo_id', $id); - return view('directory.equipos.show', compact('equipo','checklist_opcionescheck','bitacora')); + return view('directory.equipos.show', compact('equipo', 'checklist_opcionescheck', 'bitacora')); } /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { //dd($id); - try{ + try { $equipo = Equipos::find($id); - if ($equipo == null){ - Session::flash('flash_message', 'Equipo No encontrado!'); - return redirect('equipos'); - } + if ($equipo == null) { + Session::flash('flash_message', 'Equipo No encontrado!'); - $modelos = ModeloEquipo::pluck('modelo','id'); - $orden = OrdenDeCompra::pluck('ordenCompra','id'); - $custodio = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $estaciones = Estaciones::pluck('estacion','id'); - $areas = Areas::pluck('area','id'); - $util = Equipos::whereNotIn('id',[$id])->pluck('check_list_id'); - $empresa = Empresa::orderBy('empresa','asc')->pluck('empresa','empresa'); - //-------------------------------------------------------------------------- - $check_lists = CheckList::whereNotIn('id', + return redirect('equipos'); + } + + $modelos = ModeloEquipo::pluck('modelo', 'id'); + $orden = OrdenDeCompra::pluck('ordenCompra', 'id'); + $custodio = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $estaciones = Estaciones::pluck('estacion', 'id'); + $areas = Areas::pluck('area', 'id'); + $util = Equipos::whereNotIn('id', [$id])->pluck('check_list_id'); + $empresa = Empresa::orderBy('empresa', 'asc')->pluck('empresa', 'empresa'); + //-------------------------------------------------------------------------- + $check_lists = CheckList::whereNotIn('id', $util ) - ->pluck('id_check_lists','id'); - //$check_lists["1"]="Seleccione"; - - $dtos=array( - 'modelos'=>$modelos, - 'orden'=>$orden, - 'custodio'=>$custodio, - 'estaciones'=>$estaciones, - 'areas'=>$areas, - 'check_lists'=>$check_lists, - 'empresa'=>$empresa - ); - - - $equipo->extras2=$dtos; - - return view('directory.equipos.edit', compact('equipo')); - }catch (Exception $e){ + ->pluck('id_check_lists', 'id'); + //$check_lists["1"]="Seleccione"; + + $dtos = [ + 'modelos' => $modelos, + 'orden' => $orden, + 'custodio' => $custodio, + 'estaciones' => $estaciones, + 'areas' => $areas, + 'check_lists'=> $check_lists, + 'empresa' => $empresa, + ]; + + $equipo->extras2 = $dtos; + + return view('directory.equipos.edit', compact('equipo')); + } catch (Exception $e) { Session::flash('flash_message', 'Equipo No encontrado!'); + return redirect('equipos'); } } @@ -283,54 +270,50 @@ public function showPicture($id) return $response; } - - /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Requests\EquiposRequest $request) { - - if($request->check_list_id==''){ + if ($request->check_list_id == '') { Input::flashOnly('check_list_id'); } $equipo = Equipos::findOrFail($id); - $file = Input::file('imagen');//la imagen se lee aca + $file = Input::file('imagen'); //la imagen se lee aca - $custorm0=$request->all(); - if(Input::hasFile('imagen')) { + $custorm0 = $request->all(); + if (Input::hasFile('imagen')) { $img = Image::make($file)->resize(600, 400); Response::make($img->encode('jpeg')); $custorm0['imagen'] = $img; } $custodio_n = Custodios::find($equipo->custodio_id); - $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n->save(); $equipo->update($custorm0); //dd($equipo); $custodio_n2 = Custodios::find(Input::get('custodio_id')); - $custodio_n2->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n2->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n2->save(); - - $custorm=$equipo->jsonSerialize(); - $custorm['id_equipos']=$id; - $custorm['acciondb']='actualizar'; - $custorm['id_users']=Auth::user()->id; + $custorm = $equipo->jsonSerialize(); + $custorm['id_equipos'] = $id; + $custorm['acciondb'] = 'actualizar'; + $custorm['id_users'] = Auth::user()->id; //dd($f); Equipos_log::create($custorm); Session::flash('flash_message', 'Equipos updated!'); - \Illuminate\Support\Facades\Session::put('x_notificar_time',\Carbon\Carbon::now()->addMinutes(0)); + \Illuminate\Support\Facades\Session::put('x_notificar_time', \Carbon\Carbon::now()->addMinutes(0)); return redirect('equipos'); } @@ -338,86 +321,88 @@ public function update($id, Requests\EquiposRequest $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ public function destroy($id) { - $equip3=Equipos::findOrFail($id); + $equip3 = Equipos::findOrFail($id); Equipos::destroy($id); - $custorm=$equip3->jsonSerialize(); - $custorm['id_equipos']=$equip3->id; - $custorm['acciondb']='borrar'; + $custorm = $equip3->jsonSerialize(); + $custorm['id_equipos'] = $equip3->id; + $custorm['acciondb'] = 'borrar'; $custodio_n = Custodios::find($equip3->custodio_id); - $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n->save(); - $custorm['id_users']=Auth::user()->id; + $custorm['id_users'] = Auth::user()->id; Equipos_log::create($custorm); Session::flash('flash_message', 'Equipos deleted!'); - \Illuminate\Support\Facades\Session::put('x_notificar_time',\Carbon\Carbon::now()->addMinutes(0)); - + \Illuminate\Support\Facades\Session::put('x_notificar_time', \Carbon\Carbon::now()->addMinutes(0)); return redirect('equipos'); } + public function reasignarindex($custodio_id) { //return ('hola'); - $equipos = Equipos::where('custodio_id',$custodio_id)->paginate(42); + $equipos = Equipos::where('custodio_id', $custodio_id)->paginate(42); $obj_custodio = Custodios::findOrFail($custodio_id); $nombre_responsable2 = $obj_custodio->nombre_responsable; //dd($nombre_responsable2); - return view('directory.equipos.index_reasignar', compact('equipos','custodio_id','nombre_responsable2')); + return view('directory.equipos.index_reasignar', compact('equipos', 'custodio_id', 'nombre_responsable2')); } + public function reasignarindexecho(Request $request) { $request->validate([ 'equipoidfull' => 'required', - 'custodio_id' => 'required', + 'custodio_id' => 'required', ]); $equipos = $request->input('equipoidfull'); $nuevo_custodio = $request->input('custodio_id'); $obj_custodio = Custodios::findOrFail($nuevo_custodio); $nombre_responsable2 = $obj_custodio->nombre_responsable; $CUSTODIO_BODEGA = Configuracion::Config('CUSTODIO_BODEGA'); - try{ + + try { DB::beginTransaction(); - foreach ($equipos as $valor ){ + foreach ($equipos as $valor) { //echo $valor; $equipo = Equipos::findOrFail($valor); $custodio_n = Custodios::find($equipo->custodio_id); - $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n->save(); $custodio_n2 = Custodios::find($nuevo_custodio); - $custodio_n2->notificado = Custodios::CUSTODIO_NOTIFICADO; + $custodio_n2->notificado = Custodios::CUSTODIO_NOTIFICADO; $custodio_n2->save(); - $equipo->observaciones=$equipo->observaciones."[Se pasa de ".Custodios::findOrFail($equipo->custodio_id)->nombre_responsable." a ".$obj_custodio->nombre_responsable."]"; - $equipo->custodio_id =$CUSTODIO_BODEGA; - $equipo->estatus='BODEGA'; + $equipo->observaciones = $equipo->observaciones.'[Se pasa de '.Custodios::findOrFail($equipo->custodio_id)->nombre_responsable.' a '.$obj_custodio->nombre_responsable.']'; + $equipo->custodio_id = $CUSTODIO_BODEGA; + $equipo->estatus = 'BODEGA'; $equipo->save(); - $custorm=$equipo->jsonSerialize(); - $custorm['id_equipos']=$valor; - $custorm['acciondb']='editar'; - $custorm['id_users']=Auth::user()->id; + $custorm = $equipo->jsonSerialize(); + $custorm['id_equipos'] = $valor; + $custorm['acciondb'] = 'editar'; + $custorm['id_users'] = Auth::user()->id; Equipos_log::create($custorm); - $equipo->custodio_id =$nuevo_custodio; - $equipo->estatus='VIGENTE'; + $equipo->custodio_id = $nuevo_custodio; + $equipo->estatus = 'VIGENTE'; $equipo->save(); - $custorm=$equipo->jsonSerialize(); - $custorm['id_equipos']=$valor; - $custorm['acciondb']='editar'; - $custorm['id_users']=Auth::user()->id; + $custorm = $equipo->jsonSerialize(); + $custorm['id_equipos'] = $valor; + $custorm['acciondb'] = 'editar'; + $custorm['id_users'] = Auth::user()->id; Equipos_log::create($custorm); } - }catch (Exception $e){ + } catch (Exception $e) { DB::rollback(); } DB::commit(); @@ -425,26 +410,28 @@ public function reasignarindexecho(Request $request) //return ('hola'); - \Illuminate\Support\Facades\Session::put('x_notificar_time',\Carbon\Carbon::now()->addMinutes(0)); - $equipos = Equipos::where('custodio_id',$nuevo_custodio)->paginate(15); - $custodio_id=$nuevo_custodio; - return view('directory.equipos.index_reasignar', compact('equipos','custodio_id','nombre_responsable2')); + \Illuminate\Support\Facades\Session::put('x_notificar_time', \Carbon\Carbon::now()->addMinutes(0)); + $equipos = Equipos::where('custodio_id', $nuevo_custodio)->paginate(15); + $custodio_id = $nuevo_custodio; + + return view('directory.equipos.index_reasignar', compact('equipos', 'custodio_id', 'nombre_responsable2')); } + public function home() { - $posts = Equipos::paginate(15); return view('directory.equipos.index_serch', compact('posts')); } - public function buscaDato($dato,$valor) + + public function buscaDato($dato, $valor) { return $equipos = Equipos::where($dato, $valor)->get(); } public function garantiasHP() { - $equipos = Equipos::where('hp_displaySerialNumber','=',null)->paginate(50); + $equipos = Equipos::where('hp_displaySerialNumber', '=', null)->paginate(50); return view('directory.equipos.index_garantiaHP', compact('equipos')); } diff --git a/app/Http/Controllers/EstacionesController.php b/app/Http/Controllers/EstacionesController.php index bf3a575b..d9fe7c69 100644 --- a/app/Http/Controllers/EstacionesController.php +++ b/app/Http/Controllers/EstacionesController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Estaciones; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class EstacionesController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -48,10 +45,10 @@ public function store(Request $request) { $request->validate([ 'nombre_largo' => 'required', - 'pais' => 'required', - 'estacion' => 'required', - 'estacion' => 'required', - 'empresa' => 'required', + 'pais' => 'required', + 'estacion' => 'required', + 'estacion' => 'required', + 'empresa' => 'required', ]); Estaciones::create($request->all()); @@ -63,7 +60,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -77,7 +74,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -91,7 +88,7 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -99,10 +96,10 @@ public function update($id, Request $request) { $request->validate([ 'nombre_largo' => 'required', - 'pais' => 'required', - 'estacion' => 'required', - 'estacion' => 'required', - 'empresa' => 'required', + 'pais' => 'required', + 'estacion' => 'required', + 'estacion' => 'required', + 'empresa' => 'required', ]); $estacione = Estaciones::findOrFail($id); $estacione->update($request->all()); @@ -115,7 +112,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -127,5 +124,4 @@ public function destroy($id) return redirect('estaciones'); } - } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index ba7a648e..0066ec44 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -10,10 +10,8 @@ use App\Configuracion; use App\Custodios; use App\Equipos; -use App\Http\Requests; use App\OAuthApp; use App\User; -use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; @@ -21,8 +19,7 @@ use Illuminate\Support\Facades\URL; /** - * Class HomeController - * @package App\Http\Controllers + * Class HomeController. */ class HomeController extends Controller { @@ -33,8 +30,6 @@ class HomeController extends Controller */ public function __construct() { - - $this->middleware('auth')->only(['index']); } @@ -45,23 +40,23 @@ public function __construct() */ public function index() { + if (URL::previous() == env('APP_URL').'/login') { + $token_oauth = OAuthApp::where('id', '=', session('_token'))->first(); - if(URL::previous() == env('APP_URL').'/login'){ - $token_oauth = OAuthApp::where('id','=',session('_token'))->first(); - - if($token_oauth != null && $token_oauth->esActivo() ){ + if ($token_oauth != null && $token_oauth->esActivo()) { $query = http_build_query([ - 'client_id' => $token_oauth->client_id, - 'redirect_uri' => env('APP_URL').'/callback', + 'client_id' => $token_oauth->client_id, + 'redirect_uri' => env('APP_URL').'/callback', 'response_type' => 'code', - 'scope' => 'place-orders', + 'scope' => 'place-orders', ]); - $redireccTOAut2=env('APP_URL').'/oauth/authorize?'.$query; + $redireccTOAut2 = env('APP_URL').'/oauth/authorize?'.$query; + return redirect($redireccTOAut2); } } - $minutos = 1;//30 minutos refresca la base + $minutos = 1; //30 minutos refresca la base $maquinas = Cache::remember('maquinas'.Auth::user()->getEmpresa(), $minutos, function () { return Equipos::count(); }); @@ -70,13 +65,15 @@ public function index() }); $equipos_asignados = Cache::remember('equipos_asignados'.Auth::user()->getEmpresa(), $minutos, function () { - $encargado = Configuracion::where('atributo','CUSTODIO_BODEGA')->get()->first()->valor; - return Equipos::where('custodio_id','<>',$encargado) + $encargado = Configuracion::where('atributo', 'CUSTODIO_BODEGA')->get()->first()->valor; + + return Equipos::where('custodio_id', '<>', $encargado) ->count(); }); $custodios = Cache::remember('custodios'.Auth::user()->getEmpresa(), $minutos, function () { - $encargado = Configuracion::where('atributo','CUSTODIO_BODEGA')->get()->first()->valor; + $encargado = Configuracion::where('atributo', 'CUSTODIO_BODEGA')->get()->first()->valor; + return Custodios::count(); }); @@ -95,6 +92,6 @@ public function index() */ }); - return view('adminlte::home', compact('maquinas','usuarios','equipos_asignados','custodios','pie_estaciones')); + return view('adminlte::home', compact('maquinas', 'usuarios', 'equipos_asignados', 'custodios', 'pie_estaciones')); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/InformeMantenimientoPreventivoController.php b/app/Http/Controllers/InformeMantenimientoPreventivoController.php index 57e2fd9c..8562c1d5 100644 --- a/app/Http/Controllers/InformeMantenimientoPreventivoController.php +++ b/app/Http/Controllers/InformeMantenimientoPreventivoController.php @@ -4,14 +4,10 @@ use App\Areas; use App\Custodios; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\InformeMantenimientoPreventivo; use App\InformeMantenimientoPreventivoCategoria; use App\InformeMantenimientoPreventivoTecnico; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class InformeMantenimientoPreventivoController extends Controller @@ -41,10 +37,11 @@ public function index() */ public function create() { - $custodios = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $areas = Areas::orderBy('area','asc')->pluck('area','id'); - $categoria_mant = InformeMantenimientoPreventivoCategoria::orderBy('categoria','asc')->pluck('categoria','id'); - return view('directory.informes.create',compact('dtos','custodios','areas','categoria_mant')); + $custodios = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $areas = Areas::orderBy('area', 'asc')->pluck('area', 'id'); + $categoria_mant = InformeMantenimientoPreventivoCategoria::orderBy('categoria', 'asc')->pluck('categoria', 'id'); + + return view('directory.informes.create', compact('dtos', 'custodios', 'areas', 'categoria_mant')); } /** @@ -55,12 +52,12 @@ public function create() public function store(Request $request) { $reglas = [ - 'no_orden' => 'required', + 'no_orden' => 'required', 'fecha_ejecucion' => 'required', - 'requerimiento' => 'required' - ]; + 'requerimiento' => 'required', + ]; $this->validate($request, $reglas); - + InformeMantenimientoPreventivo::create($request->all()); Session::flash('flash_message', 'InformeMantenimientoPreventivo added!'); @@ -71,7 +68,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -85,36 +82,35 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { - $custodios = Custodios::orderBy('nombre_responsable','asc')->pluck('nombre_responsable','id'); - $areas = Areas::orderBy('area','asc')->pluck('area','id'); - $categoria_mant = InformeMantenimientoPreventivoCategoria::orderBy('categoria','asc')->pluck('categoria','id'); + $custodios = Custodios::orderBy('nombre_responsable', 'asc')->pluck('nombre_responsable', 'id'); + $areas = Areas::orderBy('area', 'asc')->pluck('area', 'id'); + $categoria_mant = InformeMantenimientoPreventivoCategoria::orderBy('categoria', 'asc')->pluck('categoria', 'id'); $informe = InformeMantenimientoPreventivo::findOrFail($id); Session::put('informe_manto_prev_id', $informe->id); //$equipo_id = Session::get('informe_manto_prev_id');//para ver - $tecnico = InformeMantenimientoPreventivoTecnico::where('informe_manto_prev_id','=',$informe->id); + $tecnico = InformeMantenimientoPreventivoTecnico::where('informe_manto_prev_id', '=', $informe->id); - return view('directory.informes.edit', compact('informe','custodios','areas','categoria_mant','tecnico')); + return view('directory.informes.edit', compact('informe', 'custodios', 'areas', 'categoria_mant', 'tecnico')); } /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $informe = InformeMantenimientoPreventivo::findOrFail($id); $informe->update($request->all()); @@ -126,7 +122,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -138,5 +134,4 @@ public function destroy($id) return redirect('informes'); } - } diff --git a/app/Http/Controllers/InformeMantenimientoPreventivoTecnicoController.php b/app/Http/Controllers/InformeMantenimientoPreventivoTecnicoController.php index ffc4b8b9..654bc766 100644 --- a/app/Http/Controllers/InformeMantenimientoPreventivoTecnicoController.php +++ b/app/Http/Controllers/InformeMantenimientoPreventivoTecnicoController.php @@ -2,23 +2,19 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\InformeMantenimientoPreventivoTecnico; use App\User; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class InformeMantenimientoPreventivoTecnicoController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -38,9 +34,9 @@ public function index() */ public function create() { - $tecnico = User::orderBy('name','asc')->pluck('name','id'); - return view('directory.tecnico.create', compact('tecnico')); + $tecnico = User::orderBy('name', 'asc')->pluck('name', 'id'); + return view('directory.tecnico.create', compact('tecnico')); } /** @@ -52,15 +48,15 @@ public function store(Request $request) { $equipo_id = Session::get('equipo_id'); - if($equipo_id==null){ + if ($equipo_id == null) { return redirect('equipos'); } $this->validate($request, [ - 'user_id' => 'required', + 'user_id' => 'required', 'informe_manto_prev_id' => 'required', ]); - + InformeMantenimientoPreventivoTecnico::create($request->all()); Session::flash('flash_message', 'InformeMantenimientoPreventivoTecnico added!'); @@ -71,7 +67,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -85,7 +81,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -99,13 +95,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $tecnico = InformeMantenimientoPreventivoTecnico::findOrFail($id); $tecnico->update($request->all()); @@ -117,7 +112,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -129,5 +124,4 @@ public function destroy($id) return redirect('tecnico'); } - } diff --git a/app/Http/Controllers/ModeloEquipoController.php b/app/Http/Controllers/ModeloEquipoController.php index 2cc5fde9..3641a108 100644 --- a/app/Http/Controllers/ModeloEquipoController.php +++ b/app/Http/Controllers/ModeloEquipoController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\ModeloEquipo; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class ModeloEquipoController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -47,14 +44,14 @@ public function create() public function store(Request $request) { $reglas = [ - 'modelo' => 'required', - 'fabricante' => 'required', + 'modelo' => 'required', + 'fabricante' => 'required', 'garantia_anios' => 'required', - 'tipo_equipo' => 'required', + 'tipo_equipo' => 'required', ]; $this->validate($request, $reglas); - + ModeloEquipo::create($request->all()); Session::flash('flash_message', 'ModeloEquipo added!'); @@ -65,7 +62,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -79,7 +76,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -93,21 +90,21 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { $reglas = [ - 'modelo' => 'required', - 'fabricante' => 'required', + 'modelo' => 'required', + 'fabricante' => 'required', 'garantia_anios' => 'required', - 'tipo_equipo' => 'required', + 'tipo_equipo' => 'required', ]; $this->validate($request, $reglas); - + $modelo = ModeloEquipo::findOrFail($id); $modelo->update($request->all()); @@ -119,7 +116,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -131,5 +128,4 @@ public function destroy($id) return redirect('modelo'); } - } diff --git a/app/Http/Controllers/ModuloController.php b/app/Http/Controllers/ModuloController.php index 02ed3ec0..816f7698 100644 --- a/app/Http/Controllers/ModuloController.php +++ b/app/Http/Controllers/ModuloController.php @@ -2,21 +2,18 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Modulo; use Illuminate\Http\Request; use Session; class ModuloController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system'); } + /** * Display a listing of the resource. * @@ -46,7 +43,6 @@ public function create() */ public function store(Request $request) { - Modulo::create($request->all()); Session::flash('flash_message', '¡Modulo añadido!'); @@ -57,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -71,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -85,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $modulo = Modulo::findOrFail($id); $modulo->update($request->all()); @@ -103,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ diff --git a/app/Http/Controllers/MotivosDenunciasController.php b/app/Http/Controllers/MotivosDenunciasController.php index 6e95811e..5c94ba89 100644 --- a/app/Http/Controllers/MotivosDenunciasController.php +++ b/app/Http/Controllers/MotivosDenunciasController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Motivos_Denuncias; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class MotivosDenunciasController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:;;system'); } + /** * Display a listing of the resource. * @@ -46,7 +43,6 @@ public function create() */ public function store(Request $request) { - Motivos_Denuncias::create($request->all()); Session::flash('flash_message', 'Motivos_Denuncias added!'); @@ -57,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -71,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -85,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $motivo_denuncia = Motivos_Denuncias::findOrFail($id); $motivo_denuncia->update($request->all()); @@ -103,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -115,5 +110,4 @@ public function destroy($id) return redirect('motivo_denuncias'); } - } diff --git a/app/Http/Controllers/OpcionesCheckListController.php b/app/Http/Controllers/OpcionesCheckListController.php index 8f107dd5..6e39fa26 100644 --- a/app/Http/Controllers/OpcionesCheckListController.php +++ b/app/Http/Controllers/OpcionesCheckListController.php @@ -3,12 +3,8 @@ namespace App\Http\Controllers; use App\Areas; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\OpcionesCheckList; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class OpcionesCheckListController extends Controller @@ -18,6 +14,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -37,8 +34,9 @@ public function index() */ public function create() { - $areas = Areas::pluck('area','id'); - return view('directory.opciones_check.create',compact('areas')); + $areas = Areas::pluck('area', 'id'); + + return view('directory.opciones_check.create', compact('areas')); } /** @@ -62,7 +60,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -76,15 +74,15 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ public function edit($id) { - $areas = Areas::pluck('area','id'); + $areas = Areas::pluck('area', 'id'); $opciones_check = OpcionesCheckList::findOrFail($id); - $opciones_check->extras2=$areas; + $opciones_check->extras2 = $areas; return view('directory.opciones_check.edit', compact('opciones_check')); } @@ -92,13 +90,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $opciones_check = OpcionesCheckList::findOrFail($id); $opciones_check->update($request->all()); @@ -110,7 +107,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -122,5 +119,4 @@ public function destroy($id) return redirect('opciones_check'); } - } diff --git a/app/Http/Controllers/OrdenDeCompraController.php b/app/Http/Controllers/OrdenDeCompraController.php index 731456ef..3401fa2d 100644 --- a/app/Http/Controllers/OrdenDeCompraController.php +++ b/app/Http/Controllers/OrdenDeCompraController.php @@ -2,12 +2,8 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\OrdenDeCompra; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class OrdenDeCompraController extends Controller @@ -17,6 +13,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -59,7 +56,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -73,7 +70,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -87,13 +84,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $orden = OrdenDeCompra::findOrFail($id); $orden->update($request->all()); @@ -105,7 +101,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -117,5 +113,4 @@ public function destroy($id) return redirect('orden'); } - } diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php index aaa6d22d..ad012bbc 100644 --- a/app/Http/Controllers/PdfController.php +++ b/app/Http/Controllers/PdfController.php @@ -5,10 +5,6 @@ use App\Custodios; use App\RepoNovedades; use Barryvdh\DomPDF\PDF; -use Illuminate\Http\Request; - -use App\Http\Requests; -use Illuminate\Support\Facades\Log; class PdfController extends Controller { @@ -16,67 +12,69 @@ public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); - } + public function invoice($custodio_id) { - $custodio = Custodios::where('documentoIdentificacion','=',$custodio_id)->firstOrFail(); + $custodio = Custodios::where('documentoIdentificacion', '=', $custodio_id)->firstOrFail(); $data = $this->getData(); $date = date('Y-m-d'); - $invoice = "2222"; - $view = \View::make('pdf.invoice', compact('custodio','data', 'date', 'invoice'))->render(); + $invoice = '2222'; + $view = \View::make('pdf.invoice', compact('custodio', 'data', 'date', 'invoice'))->render(); $pdf = \App::make('dompdf.wrapper'); - $impresion=$view; - try{ + $impresion = $view; + try { $pdf->loadHTML($view); //para la impresion de muchos //$impresion = $pdf->stream('invoice'); - } catch (Exception $e) { report($e); } - return $impresion ; + return $impresion; } public function getData() { - $data = [ - 'quantity' => '1' , + $data = [ + 'quantity' => '1', 'description' => 'some ramdom text', - 'price' => '500', - 'total' => '500' + 'price' => '500', + 'total' => '500', ]; + return $data; } public function invoiceCustom($token_unico) { - $repono = RepoNovedades::where('token_unico','=',$token_unico)->first(); + $repono = RepoNovedades::where('token_unico', '=', $token_unico)->first(); //return \View::make('pdf.custom.invoice', compact('repono')); - $view = \View::make('pdf.custom.invoice', compact('repono'))->render(); + $view = \View::make('pdf.custom.invoice', compact('repono'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($view); $impresion = $view; $impresion = $pdf->stream('invoice'); + return $impresion; } public function beta($custodio_id) { - $view = \View::make('pdf.beta', compact('repono'))->render(); + $view = \View::make('pdf.beta', compact('repono'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($view); //return $pdf->stream('invoice'); - return $view ; + return $view; } public function beta2($custodio_id) { - $view = \View::make('pdf.hojadeentrega', compact('repono'))->render(); + $view = \View::make('pdf.hojadeentrega', compact('repono'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($view); + return $pdf->stream(); //return $view ; } diff --git a/app/Http/Controllers/PermisoController.php b/app/Http/Controllers/PermisoController.php index 4d8f3337..273cc580 100644 --- a/app/Http/Controllers/PermisoController.php +++ b/app/Http/Controllers/PermisoController.php @@ -2,21 +2,18 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Permiso; use Illuminate\Http\Request; use Session; class PermisoController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system'); } + /** * Display a listing of the resource. * @@ -46,7 +43,6 @@ public function create() */ public function store(Request $request) { - Permiso::create($request->all()); Session::flash('flash_message', '¡Permiso añadido!'); @@ -57,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -71,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -85,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $permiso = Permiso::findOrFail($id); $permiso->update($request->all()); @@ -103,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ diff --git a/app/Http/Controllers/PermisorolController.php b/app/Http/Controllers/PermisorolController.php index 3e54e165..cec52992 100644 --- a/app/Http/Controllers/PermisorolController.php +++ b/app/Http/Controllers/PermisorolController.php @@ -29,7 +29,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -40,7 +41,8 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show($id) @@ -51,7 +53,8 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -62,8 +65,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -74,7 +78,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/PuestosController.php b/app/Http/Controllers/PuestosController.php index 4946d83a..56807f7d 100644 --- a/app/Http/Controllers/PuestosController.php +++ b/app/Http/Controllers/PuestosController.php @@ -2,23 +2,18 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Puesto; -use App\Ubicacion; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class PuestosController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system;planta_fisica'); } + /** * Display a listing of the resource. * @@ -48,7 +43,6 @@ public function create() */ public function store(Request $request) { - Puesto::create($request->all()); Session::flash('flash_message', 'Puesto added!'); @@ -59,7 +53,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -73,7 +67,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -87,13 +81,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $puesto = Puesto::findOrFail($id); $puesto->update($request->all()); @@ -105,7 +98,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -117,7 +110,4 @@ public function destroy($id) return redirect('puesto'); } - - - } diff --git a/app/Http/Controllers/RepoNovedadesController.php b/app/Http/Controllers/RepoNovedadesController.php index c9225b92..15b359e1 100644 --- a/app/Http/Controllers/RepoNovedadesController.php +++ b/app/Http/Controllers/RepoNovedadesController.php @@ -3,13 +3,9 @@ namespace App\Http\Controllers; use App\Equipos; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\RepoNovedades; use App\RepoNovedadesDetalle; use Illuminate\Http\Request; -use Carbon\Carbon; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Input; use League\Flysystem\Exception; @@ -17,13 +13,12 @@ class RepoNovedadesController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); - } + /** * Display a listing of the resource. * @@ -34,14 +29,10 @@ public function index() $equipo_id = Session::get('custodio_id'); $repo_novedades = RepoNovedades::paginate(15); - if($equipo_id!=null){ - - $repo_novedades = RepoNovedades::where('custodio_id','=',$equipo_id)->paginate(15); + if ($equipo_id != null) { + $repo_novedades = RepoNovedades::where('custodio_id', '=', $equipo_id)->paginate(15); } - - - return view('directory.repo_novedades.index', compact('repo_novedades')); } @@ -63,12 +54,13 @@ public function create() public function store(Request $request) { $this->validate($request, [ - 'correo' => 'required|email|max:255', - 'observaciones' => 'required|max:255', - 'equipos' => 'required', + 'correo' => 'required|email|max:255', + 'observaciones' => 'required|max:255', + 'equipos' => 'required', 'fecha_novedades' => 'required|date', ]); - try{ + + try { DB::beginTransaction(); //dd($request); $rep = RepoNovedades::create($request->all()); @@ -76,13 +68,12 @@ public function store(Request $request) $rep->save(); ////////////////////////////////////////////// $equipos = Input::get('equipos'); - if(is_array($equipos)) - { - foreach ($equipos as $equipo){ + if (is_array($equipos)) { + foreach ($equipos as $equipo) { $equipo = Equipos::findOrFail($equipo)->toArray(); //dd($equipo); - $equipo['id_equipos']=$equipo['id']; - $equipo['repo_novedades_id']=$rep->id; + $equipo['id_equipos'] = $equipo['id']; + $equipo['repo_novedades_id'] = $rep->id; //dd($equipo); unset($equipo['id']); @@ -90,7 +81,7 @@ public function store(Request $request) } // do stuff with checked friends Session::flash('flash_message', 'RepoNovedades added!'); - }else{ + } else { Session::flash('flash_message', 'Error RepoNovedades added!'); DB::rollback(); } @@ -98,13 +89,12 @@ public function store(Request $request) //$custorm['id_equipos']=$equip3->id; //RepoNovedadesDetalle::create($custorm); ////////////////////////////////////////////// - Session::put('custodio_id',$request->input('custodio_id')); - + Session::put('custodio_id', $request->input('custodio_id')); DB::commit(); - return redirect('custodio_custom/'.$request->input('custodio_id')); - }catch (Exception $e){ + return redirect('custodio_custom/'.$request->input('custodio_id')); + } catch (Exception $e) { DB::rollback(); } } @@ -112,7 +102,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -126,7 +116,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -140,13 +130,12 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $repo_novedade = RepoNovedades::findOrFail($id); $repo_novedade->update($request->all()); @@ -158,16 +147,16 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ public function destroy($id) { $repo_novedade = RepoNovedades::findOrFail($id); - $id_custodio= $repo_novedade->custodio_id; + $id_custodio = $repo_novedade->custodio_id; - foreach ($repo_novedade->reponovedadedetalleshm as $repo){ + foreach ($repo_novedade->reponovedadedetalleshm as $repo) { //dd($repo); $repo->delete(); } @@ -178,5 +167,4 @@ public function destroy($id) return redirect('custodio_custom/'.$id_custodio); } - } diff --git a/app/Http/Controllers/ReporteController.php b/app/Http/Controllers/ReporteController.php index 1bfcb4b2..e1efa45b 100644 --- a/app/Http/Controllers/ReporteController.php +++ b/app/Http/Controllers/ReporteController.php @@ -4,10 +4,7 @@ use App\Equipos; use Illuminate\Http\Request; - -use App\Http\Requests; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\Input; use Maatwebsite\Excel\Facades\Excel; use Session; @@ -18,6 +15,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:usuario;administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -25,53 +23,49 @@ public function __construct() */ public function index() { - $equipos = Equipos::get(); - return view('directory.reporte.repo1', compact('equipos')); + return view('directory.reporte.repo1', compact('equipos')); } public function estaciones($estacione_id) { - - $estaciones = Equipos::select('estaciones.estacion', DB::raw('Count(estacione_id) as Contador') , + $estaciones = Equipos::select('estaciones.estacion', DB::raw('Count(estacione_id) as Contador'), DB::raw('MAX(estacione_id) as estacione_id')) ->join('estaciones', 'estaciones.id', '=', 'equipos.estacione_id') ->groupBy('estacione_id') ->get(); - $equipos = Equipos::where('estacione_id',$estacione_id) + $equipos = Equipos::where('estacione_id', $estacione_id) ->get(); //dd($estaciones->first()->estacione_id); - return view('directory.reporte.reporte_estaciones', compact('equipos','estaciones','estacione_id')); - + return view('directory.reporte.reporte_estaciones', compact('equipos', 'estaciones', 'estacione_id')); } - public function excelEstaciones($estacione_id){ + + public function excelEstaciones($estacione_id) + { //return view('directory.reporte.repo1excel', compact('equipos')); Session::flash('flash_estacione_id', $estacione_id); - Excel::create('Reporte_por_estaciones', function($excel) { - - $excel->sheet('Maquinas', function($sheet) { + Excel::create('Reporte_por_estaciones', function ($excel) { + $excel->sheet('Maquinas', function ($sheet) { $equipos = Equipos::where('estacione_id', Session::get('flash_estacione_id'))->get(); $sheet->loadView('directory.reporte.repo1excel', compact('equipos')); }); - })->download('xls');; - + })->download('xls'); } - public function excel(){ + public function excel() + { //return view('directory.reporte.repo1excel', compact('equipos')); - Excel::create('Reporte_Total', function($excel) { - - $excel->sheet('Maquinas', function($sheet) { + Excel::create('Reporte_Total', function ($excel) { + $excel->sheet('Maquinas', function ($sheet) { $equipos = Equipos::get(); $sheet->loadView('directory.reporte.repo1excel', compact('equipos')); }); - })->download('xls');; - + })->download('xls'); } /** @@ -87,19 +81,21 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) { // - echo('dato'); + echo 'dato'; } /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show($id) @@ -110,19 +106,21 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) { - dd("Excel"+$id); + dd('Excel' + $id); } /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -133,7 +131,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/RolController.php b/app/Http/Controllers/RolController.php index 69e1c678..38287712 100644 --- a/app/Http/Controllers/RolController.php +++ b/app/Http/Controllers/RolController.php @@ -2,29 +2,23 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Modulo; use App\Permiso; use App\Permisorol; -use App\Permisorols; use App\Rol; -use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Input; -use PhpParser\Node\Stmt\Foreach_; use Session; class RolController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system'); } + /** * Display a listing of the resource. * @@ -45,9 +39,9 @@ public function index() public function create() { $modulo = Modulo::all(); - /* foreach($modulo AS $item){ - dd($item->permisos); - }*/ + /* foreach($modulo AS $item){ + dd($item->permisos); + }*/ return view('directory.rol.create', compact('modulo')); } @@ -60,37 +54,37 @@ public function create() public function store(Request $request) { $this->validate($request, [ - 'rol' => 'required|max:255', + 'rol' => 'required|max:255', 'descripcion' => 'required|max:255', - 'permisos_r' => 'required', + 'permisos_r' => 'required', ]); - try{ + + try { DB::beginTransaction(); //dd($request); $rol = Rol::create($request->all()); $rol->save(); ////////////////////////////////////////////// $equipos = Input::get('permisos_r'); - if(is_array($equipos)) - { - foreach ($equipos as $equipo){ + if (is_array($equipos)) { + foreach ($equipos as $equipo) { $permiso = Permiso::findOrFail($equipo)->toArray(); //dd($equipo); - $permi_rol['permiso_id']=$permiso['id']; - $permi_rol['rol_id']=$rol->id; + $permi_rol['permiso_id'] = $permiso['id']; + $permi_rol['rol_id'] = $rol->id; Permisorol::create($permi_rol); } // do stuff with checked friends Session::flash('flash_message', 'Permisos Rol added!'); - }else{ + } else { Session::flash('flash_message', 'Error Permisos Rol added!'); DB::rollback(); } DB::commit(); - return redirect('roles'); - }catch (Exception $e){ + return redirect('roles'); + } catch (Exception $e) { DB::rollback(); } } @@ -98,7 +92,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -112,7 +106,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -121,69 +115,68 @@ public function edit($id) $rol = Rol::findOrFail($id); $modulo = Modulo::all(); - return view('directory.rol.edit', compact('rol','modulo')); + return view('directory.rol.edit', compact('rol', 'modulo')); } /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - - $this->validate($request, [ - 'rol' => 'required|max:255', + 'rol' => 'required|max:255', 'descripcion' => 'required|max:255', - 'permisos_r' => 'required', + 'permisos_r' => 'required', ]); - try{ + + try { DB::beginTransaction(); //dd($request); $rol = Rol::findOrFail($id); $rol->update($request->all()); ////////////////////////////////////////////// - $perdel= Permisorol::where('rol_id','=',$rol->id)->get(); - foreach ($perdel as $borraras2){ + $perdel = Permisorol::where('rol_id', '=', $rol->id)->get(); + foreach ($perdel as $borraras2) { // da error aca, no se puede borrar tabla pivote de manera que se de softdelete, es mas, por favor llenar deleta_at y //observar que no cambia nada, se deberia borrar hard y usar $rol->permiso->pivot->delete(), consulatar en documentacion. $borraras2->delete(); } //dd($perdel); $equipos = Input::get('permisos_r'); - if(is_array($equipos)) - { - foreach ($equipos as $equipo){ + if (is_array($equipos)) { + foreach ($equipos as $equipo) { $permiso = Permiso::findOrFail($equipo)->toArray(); //dd($equipo); - $permi_rol['permiso_id']=$permiso['id']; - $permi_rol['rol_id']=$rol->id; + $permi_rol['permiso_id'] = $permiso['id']; + $permi_rol['rol_id'] = $rol->id; //Permisorol::create($permi_rol); } // do stuff with checked friends Session::flash('flash_message', 'Permisos Rol updated!'); - }else{ + } else { Session::flash('flash_message', 'Error Permisos Rol updated!'); DB::rollback(); } DB::commit(); - return redirect('roles'); - }catch (Exception $e){ + return redirect('roles'); + } catch (Exception $e) { DB::rollback(); } + return redirect('roles'); } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -195,4 +188,4 @@ public function destroy($id) return redirect('roles'); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/UbicacionController.php b/app/Http/Controllers/UbicacionController.php index 58be6502..db74be77 100644 --- a/app/Http/Controllers/UbicacionController.php +++ b/app/Http/Controllers/UbicacionController.php @@ -2,22 +2,18 @@ namespace App\Http\Controllers; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\Ubicacion; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class UbicacionController extends Controller { - public function __construct() { $this->middleware('auth'); $this->middleware('authEmp:system;planta_fisica'); } + /** * Display a listing of the resource. * @@ -49,14 +45,13 @@ public function store(Request $request) { $request->validate([ 'edificio' => 'required', - 'piso' => 'required', - 'imagen' => 'required', + 'piso' => 'required', + 'imagen' => 'required', ]); $ubica = $request->all(); $ubica['imagen'] = $request->imagen->store(''); - Ubicacion::create($ubica); Session::flash('flash_message', 'Ubicacion added!'); @@ -67,7 +62,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -81,7 +76,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -95,7 +90,7 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -103,22 +98,19 @@ public function update($id, Request $request) { $request->validate([ 'edificio' => 'required', - 'piso' => 'required', + 'piso' => 'required', ]); - - $ubicacion = Ubicacion::findOrFail($id); - + $ubicacion = Ubicacion::findOrFail($id); $ubica = $request->all(); - if( $request->imagen != null){ + if ($request->imagen != null) { $ubica['imagen'] = $request->imagen->store(''); - }else{ - $ubica['imagen'] = $ubicacion->imagen; + } else { + $ubica['imagen'] = $ubicacion->imagen; } - $ubicacion->update($ubica); Session::flash('flash_message', 'Ubicacion updated!'); @@ -129,7 +121,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -142,13 +134,13 @@ public function destroy($id) return redirect('ubicacion'); } - public function daImagen(Request $request){ - + public function daImagen(Request $request) + { $request->validate([ 'id' => 'required', ]); $puesto = Ubicacion::findOrFail($request->id); + return $puesto->imagen; } - } diff --git a/app/Http/Controllers/UserApiController.php b/app/Http/Controllers/UserApiController.php index f0e6d5a5..218f0a6a 100644 --- a/app/Http/Controllers/UserApiController.php +++ b/app/Http/Controllers/UserApiController.php @@ -3,34 +3,39 @@ namespace App\Http\Controllers; use App\Mail\UserCreated; -use Illuminate\Support\Facades\Mail; -use Session; +use App\User; use Illuminate\Http\Request; -use App\Http\Requests; - +use Illuminate\Support\Facades\Mail; use JWTAuth; -use App\User; use JWTAuthException; +use Session; + class UserApiController extends Controller { private $user; - public function __construct(User $user){ + + public function __construct(User $user) + { $this->middleware('auth')->except(['verify', 'resend']); $this->user = $user; } - public function register(Request $request){ + public function register(Request $request) + { $user = $this->user->create([ - 'name' => $request->get('name'), - 'email' => $request->get('email'), - 'password' => bcrypt($request->get('password')) + 'name' => $request->get('name'), + 'email' => $request->get('email'), + 'password' => bcrypt($request->get('password')), ]); - return response()->json(['status'=>true,'message'=>'User created successfully','data'=>$user]); + + return response()->json(['status'=>true, 'message'=>'User created successfully', 'data'=>$user]); } - public function login(Request $request){ + public function login(Request $request) + { $credentials = $request->only('email', 'password'); $token = null; + try { if (!$token = JWTAuth::attempt($credentials)) { return response()->json(['invalid_email_or_password'], 422); @@ -38,36 +43,44 @@ public function login(Request $request){ } catch (JWTAuthException $e) { return response()->json(['failed_to_create_token'], 500); } + return response()->json(compact('token')); } - public function getAuthUser(Request $request){ + + public function getAuthUser(Request $request) + { $user = JWTAuth::toUser($request->token); + return response()->json(['result' => $user]); } + public function verify($token) { - $user = User::where('verification_token', $token)->firstOrFail(); $user->verified = User::USUARIO_VERIFICADO; $user->verification_token = null; //dd($token); $user->save(); Session::flash('flash_message', 'Este usuario se ha sido verificado.'); + return redirect('login'); } + public function resend(User $user) { if ($user->esVerificado()) { //return $this->errorResponse('Este usuario ya ha sido verificado.', 409); Session::flash('flash_message', 'Este usuario ya ha sido verificado.'); + return redirect('login'); } - retry(5, function() use ($user) { + retry(5, function () use ($user) { $user->verification_token = User::generarVerificationToken(); $user->save(); Mail::to($user)->send(new UserCreated($user)); }, 100); Session::flash('flash_message', 'El correo de verificación se ha reenviado a: '.$user->email); + return redirect('login'); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/UsuarioLogController.php b/app/Http/Controllers/UsuarioLogController.php index c1204186..f78c9638 100644 --- a/app/Http/Controllers/UsuarioLogController.php +++ b/app/Http/Controllers/UsuarioLogController.php @@ -3,12 +3,8 @@ namespace App\Http\Controllers; use App\Empresa; -use App\Http\Requests; -use App\Http\Controllers\Controller; - use App\User; use Illuminate\Http\Request; -use Carbon\Carbon; use Session; class UsuarioLogController extends Controller @@ -18,6 +14,7 @@ public function __construct() $this->middleware('auth'); $this->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); } + /** * Display a listing of the resource. * @@ -37,10 +34,9 @@ public function index() */ public function create() { + $empresa = Empresa::orderBy('empresa', 'asc')->pluck('empresa', 'empresa'); - $empresa = Empresa::orderBy('empresa','asc')->pluck('empresa','empresa'); - - return view('directory.usuario.create',compact('empresa')); + return view('directory.usuario.create', compact('empresa')); } /** @@ -65,7 +61,7 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -79,7 +75,7 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * * @return Response */ @@ -87,31 +83,31 @@ public function edit($id) { $usuario = User::find($id); - if ($usuario == null){ + if ($usuario == null) { Session::flash('flash_message', 'Usuario No encontrado!'); + return redirect('usuario'); } - $empresa = Empresa::orderBy('empresa','asc')->pluck('empresa','empresa'); + $empresa = Empresa::orderBy('empresa', 'asc')->pluck('empresa', 'empresa'); - return view('directory.usuario.edit', compact('empresa','usuario')); + return view('directory.usuario.edit', compact('empresa', 'usuario')); } /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * * @return Response */ public function update($id, Request $request) { - $usuario = User::findOrFail($id); - if($request['password'] != null ){ + if ($request['password'] != null) { $req = $request->all(); $req['password'] = bcrypt($req['password']); - }else{ + } else { $req = $request->except('password'); } $req['verified'] = User::USUARIO_VERIFICADO; @@ -126,7 +122,7 @@ public function update($id, Request $request) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * * @return Response */ @@ -138,5 +134,4 @@ public function destroy($id) return redirect('usuario'); } - } diff --git a/app/Http/Controllers/UsuariorolController.php b/app/Http/Controllers/UsuariorolController.php index 7d925142..6852fd48 100644 --- a/app/Http/Controllers/UsuariorolController.php +++ b/app/Http/Controllers/UsuariorolController.php @@ -29,7 +29,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -40,7 +41,8 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show($id) @@ -51,7 +53,8 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -62,8 +65,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -74,7 +78,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/AreasController.php b/app/Http/Controllers/api/AreasController.php index 29d334a2..7af085ef 100644 --- a/app/Http/Controllers/api/AreasController.php +++ b/app/Http/Controllers/api/AreasController.php @@ -5,7 +5,6 @@ use App\Areas; use App\Http\Controllers\ApiController; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; class AreasController extends ApiController { @@ -13,14 +12,15 @@ public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ } + /** * Display a listing of the resource. * @@ -29,6 +29,7 @@ public function __construct() public function index() { $areas = Areas::all(); + return $this->showAll($areas); } @@ -45,7 +46,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -56,19 +58,20 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(Areas $areas) { return $this->showOne($areas); - } /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -79,8 +82,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -91,7 +95,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/CheckList_OpcionesCheckListController.php b/app/Http/Controllers/api/CheckList_OpcionesCheckListController.php index ce8c8a5b..1e698da9 100644 --- a/app/Http/Controllers/api/CheckList_OpcionesCheckListController.php +++ b/app/Http/Controllers/api/CheckList_OpcionesCheckListController.php @@ -2,7 +2,6 @@ namespace App\Http\Controllers\api; -use App\CheckList; use App\CheckList_OpcionesCheckList; use App\Http\Controllers\ApiController; use App\OpcionesCheckList; @@ -14,15 +13,15 @@ public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ - } + /** * Display a listing of the resource. * @@ -48,24 +47,25 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate([ - 'check_list_id' => 'required|exists:check_lists,id', + 'check_list_id' => 'required|exists:check_lists,id', 'opciones_check_list_id' => 'required|exists:opciones_check_lists,id', - 'valor1' => 'required|max:255', - 'valor2' => 'max:255', - 'valor3' => 'max:255', - 'valor4' => 'max:255', - 'valor5' => 'max:255', - 'valor6' => 'max:255', - 'valor7' => 'max:255', - 'valor8' => 'max:255', - 'valor9' => 'max:255', - 'valor10' => 'max:255', + 'valor1' => 'required|max:255', + 'valor2' => 'max:255', + 'valor3' => 'max:255', + 'valor4' => 'max:255', + 'valor5' => 'max:255', + 'valor6' => 'max:255', + 'valor7' => 'max:255', + 'valor8' => 'max:255', + 'valor9' => 'max:255', + 'valor10' => 'max:255', ]); $campos = $request->all(); @@ -74,13 +74,15 @@ public function store(Request $request) $campos['atributo'] = $opcion->atributo; $custodios = CheckList_OpcionesCheckList::create($campos); + return $this->showOne($custodios, 201); } /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(CheckList_OpcionesCheckList $checkList_OpcionesCheckList) @@ -89,11 +91,11 @@ public function show(CheckList_OpcionesCheckList $checkList_OpcionesCheckList) return $this->showOne($checkList_OpcionesCheckList); } - /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -104,8 +106,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -116,7 +119,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/ChecklistController.php b/app/Http/Controllers/api/ChecklistController.php index c9c29adc..5d495420 100644 --- a/app/Http/Controllers/api/ChecklistController.php +++ b/app/Http/Controllers/api/ChecklistController.php @@ -6,21 +6,21 @@ use App\Http\Controllers\ApiController; use Illuminate\Http\Request; -class CheckListController extends ApiController +class ChecklistController extends ApiController { public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ - } + /** * Display a listing of the resource. * @@ -46,7 +46,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -57,7 +58,8 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(CheckList $checkList) @@ -66,11 +68,11 @@ public function show(CheckList $checkList) return $this->showOne($checkList); } - /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -81,8 +83,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -93,7 +96,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/CustodioController.php b/app/Http/Controllers/api/CustodioController.php index 96da7b75..e5e531e4 100644 --- a/app/Http/Controllers/api/CustodioController.php +++ b/app/Http/Controllers/api/CustodioController.php @@ -8,14 +8,11 @@ use App\Http\Controllers\ApiController; use App\Mail\NotificaCustodioCambio; use App\User; -use Dotenv\Validator; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Storage; -use Illuminate\Validation\Rule; use Intervention\Image\Facades\Image; -use Intervention\Image\ImageManagerStatic; class CustodioController extends ApiController { @@ -23,23 +20,22 @@ public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend',]); - $this->middleware('auth:api')->except([ 'verify', 'resend','notificacion']); + $this->middleware('client.credentials')->only(['store', 'resend']); + $this->middleware('auth:api')->except(['verify', 'resend', 'notificacion']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ } + public function boot() { parent::boot(); Route::model('custodios', Custodios::class); - - - } + /** * Display a listing of the resource. * @@ -48,32 +44,31 @@ public function boot() public function index() { $custodios = Custodios::all(); + return $this->showAll($custodios); } - - - /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(Custodios $custodio) { - return $this->showOne($custodio); } /** - * api de busqueda por cedula + * api de busqueda por cedula. + * * @param Request $request + * * @return \Illuminate\Http\JsonResponse */ public function cedula(Request $request) { - $reglas = [ 'documentoIdentificacion' => 'required|max:15', ]; @@ -82,14 +77,16 @@ public function cedula(Request $request) //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //Auth::user()->empresa = $request->empresa; - $custodio = Custodios::where('documentoIdentificacion',"like", '%'.$request->documentoIdentificacion."%")->firstOrFail(); + $custodio = Custodios::where('documentoIdentificacion', 'like', '%'.$request->documentoIdentificacion.'%')->firstOrFail(); return $this->showOne($custodio); } /** - * api de envio de notificacion de custodios + * api de envio de notificacion de custodios. + * * @param Request $request + * * @return \Illuminate\Http\JsonResponse */ public function notificacion(Request $request) @@ -101,50 +98,51 @@ public function notificacion(Request $request) //dd($request); $this->validate($request, $reglas); - $custodio = Custodios::Notificar()->where('id',$request->id)->get(); + $custodio = Custodios::Notificar()->where('id', $request->id)->get(); //dd($custodio); - if($custodio->count()==1){ - $custodios=$custodio[0]; - if ($custodios->email== null||$custodios->email==''){ - return $this->showMessage("Este Custodio no tiene correo configurado",404); + if ($custodio->count() == 1) { + $custodios = $custodio[0]; + if ($custodios->email == null || $custodios->email == '') { + return $this->showMessage('Este Custodio no tiene correo configurado', 404); } Mail::to($custodios) //->queue(new NotificaCustodioCambio($custodios)); ->send(new NotificaCustodioCambio($custodios)); - $custodios->notificado = Custodios::CUSTODIO_NO_NOTIFICADO; + $custodios->notificado = Custodios::CUSTODIO_NO_NOTIFICADO; $custodios->save(); - return $this->showMessage("Se ha enviado la notificacion"); + + return $this->showMessage('Se ha enviado la notificacion'); //$this->showMessage("Se ha enviado la notificacion", 504); } - return $this->showMessage("Este Custodio ya no tiene notificaciones pendientes",404); + return $this->showMessage('Este Custodio ya no tiene notificaciones pendientes', 404); } public function store(Request $request) { $empresa = Empresa::all()->pluck('empresa'); - $emp=""; - foreach ($empresa as $var){ - $emp = $emp.$var.","; + $emp = ''; + foreach ($empresa as $var) { + $emp = $emp.$var.','; } $area = Areas::all()->pluck('area'); - $are=""; - foreach ($area as $var){ - $are = $are.$var.","; + $are = ''; + foreach ($area as $var) { + $are = $are.$var.','; } $request->validate([ - 'pais' => 'required|max:255', - 'ciudad' => 'required|max:255', - 'direccion' => 'required|max:255', + 'pais' => 'required|max:255', + 'ciudad' => 'required|max:255', + 'direccion' => 'required|max:255', 'documentoIdentificacion' => 'required|unique:custodios|max:255', - 'cargo' => 'required|max:255', - 'compania' => 'required|in:'.$emp, - 'telefono' => 'required|max:255', - 'nombre_responsable' => 'required|max:255', - 'area_piso' => 'required|in:'.$are, - 'email' => 'required|email|max:255', + 'cargo' => 'required|max:255', + 'compania' => 'required|in:'.$emp, + 'telefono' => 'required|max:255', + 'nombre_responsable' => 'required|max:255', + 'area_piso' => 'required|in:'.$are, + 'email' => 'required|email|max:255', ]); //return 'Hello World'; @@ -153,50 +151,49 @@ public function store(Request $request) $campos['image'] = $request->image->store(''); $custodios = Custodios::create($campos); - return $this->showOne($custodios, 201);/**/ + + return $this->showOne($custodios, 201); /**/ } public function storeImagen(Request $request) { $request->validate([ - 'id' => 'required', + 'id' => 'required', 'image' => 'required|imageable', ]); - $custodios = Custodios::findOrFail($request->id); + $custodios = Custodios::findOrFail($request->id); $photo = Image::make($request->image) - ->resize(1000, null, function ($constraint) { $constraint->aspectRatio(); } ) - ->encode('jpg',80); + ->resize(1000, null, function ($constraint) { + $constraint->aspectRatio(); + }) + ->encode('jpg', 80); $hash = md5($photo->__toString()); $path = "{$hash}.jpg"; - Storage::disk('images')->put( $path, $photo); + Storage::disk('images')->put($path, $photo); $custodios->image = $path; $custodios->save(); - return $this->showOne($custodios, 201);/**/ + return $this->showOne($custodios, 201); /**/ } public function persona(Request $request) { - $reglas = [ 'nombre_completo' => 'required|min:5', ]; $this->validate($request, $reglas); $term = strtoupper($request->nombre_completo) ?: ''; - $term = str_replace(" ", "%", "$term"); + $term = str_replace(' ', '%', "$term"); $custodio = Custodios::where('nombre_responsable', 'like', '%'.$term.'%')-> orwhere('cargo', 'like', '%'.$term.'%')-> orwhere('area_piso', 'like', '%'.$term.'%')->get(); - - return $this->showAll($custodio); } - } diff --git a/app/Http/Controllers/api/CustodioPuestoController.php b/app/Http/Controllers/api/CustodioPuestoController.php index 2fe7243d..3389fdb7 100644 --- a/app/Http/Controllers/api/CustodioPuestoController.php +++ b/app/Http/Controllers/api/CustodioPuestoController.php @@ -8,15 +8,12 @@ use App\PuestoCustodios; use Carbon\Carbon; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use Illuminate\Support\Facades\DB; class CustodioPuestoController extends ApiController { - public function __construct() { - } public function boot() @@ -33,25 +30,25 @@ public function boot() */ public function index($custodios) { - return $this->showAll(PuestoCustodios::where('custodio_id','=',$custodios)->get()); + return $this->showAll(PuestoCustodios::where('custodio_id', '=', $custodios)->get()); } - /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ - public function store(Puesto $puesto, Custodios $custodio,Request $request) + public function store(Puesto $puesto, Custodios $custodio, Request $request) { $rules = [ // 'fecha_inicio' => 'required|date|', 'horas_trabajadas' => 'required|integer|min:1', - 'estado' => 'required|in:OCUPADO,RESERVADO,LIBRE', + 'estado' => 'required|in:OCUPADO,RESERVADO,LIBRE', ]; $this->validate($request, $rules); - if (!$puesto->estado=="LIBRE") { + if (!$puesto->estado == 'LIBRE') { return $this->errorResponse('El puesto no está disponible', 409); } /********************************/ @@ -59,137 +56,143 @@ public function store(Puesto $puesto, Custodios $custodio,Request $request) $puesto->estado = $request->estado; $puesto->save(); $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), + 'fecha_inicio' => Carbon::now(), 'horas_trabajadas' => $request->horas_trabajadas, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); + return $this->showOne($transaction, 201); }); /********************************/ - } /** - * para asignar un puesto a un custodio + * para asignar un puesto a un custodio. + * * @param Request $request documentoIdentificacion,codigo,horas */ - public function asigna(Request $request){ + public function asigna(Request $request) + { $reglas = [ 'documentoIdentificacion' => 'required|max:15', - 'codigo' => 'required|max:250', - 'horas' => 'required|numeric|max:250', + 'codigo' => 'required|max:250', + 'horas' => 'required|numeric|max:250', ]; $this->validate($request, $reglas); return DB::transaction(function () use ($request) { + $custodio = Custodios::where('documentoIdentificacion', 'like', $request->documentoIdentificacion)->first(); + $puesto = Puesto::where('codigo', 'like', $request->codigo)->first(); - $custodio = Custodios::where("documentoIdentificacion","like",$request->documentoIdentificacion)->first(); - $puesto = Puesto::where("codigo","like",$request->codigo)->first(); - - $puestoconsole = PuestoCustodios::where('custodio_id','=',$custodio->id) + $puestoconsole = PuestoCustodios::where('custodio_id', '=', $custodio->id) // ->where('puesto_id','=',$puesto->id)//pone libre todos los otros puestos ->get(); - foreach ($puestoconsole as $pc){ - $p = Puesto::where('id','=',$pc->puesto_id)->firstOrFail(); - $p->estado='LIBRE'; + foreach ($puestoconsole as $pc) { + $p = Puesto::where('id', '=', $pc->puesto_id)->firstOrFail(); + $p->estado = 'LIBRE'; $p->save(); $pc->delete(); } $transaction = $puestoconsole; $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), + 'fecha_inicio' => Carbon::now(), 'horas_trabajadas' => $request->horas, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); - $puesto->estado='OCUPADO'; + $puesto->estado = 'OCUPADO'; $puesto->save(); + return $this->showOne($transaction, 201); }); - } /** - * liberar puesto + * liberar puesto. */ - public function liberar(Request $request){ + public function liberar(Request $request) + { $reglas = [ 'documentoIdentificacion' => 'required|max:15', - 'codigo' => 'required|max:250', + 'codigo' => 'required|max:250', ]; $this->validate($request, $reglas); return DB::transaction(function () use ($request) { + $custodio = Custodios::where('documentoIdentificacion', 'like', $request->documentoIdentificacion)->first(); + $puesto = Puesto::where('codigo', 'like', $request->codigo)->first(); - $custodio = Custodios::where("documentoIdentificacion","like",$request->documentoIdentificacion)->first(); - $puesto = Puesto::where("codigo","like",$request->codigo)->first(); - - $puestoconsole = PuestoCustodios::where('custodio_id','=',$custodio->id) + $puestoconsole = PuestoCustodios::where('custodio_id', '=', $custodio->id) // ->where('puesto_id','=',$puesto->id)//pone libre todos los otros puestos ->get(); - $poneSalida=0; - foreach ($puestoconsole as $pc){ - $p = Puesto::where('id','=',$pc->puesto_id)->firstOrFail(); - $p->estado='LIBRE'; + $poneSalida = 0; + foreach ($puestoconsole as $pc) { + $p = Puesto::where('id', '=', $pc->puesto_id)->firstOrFail(); + $p->estado = 'LIBRE'; $p->save(); - $pc->fecha_fin= Carbon::now(); + $pc->fecha_fin = Carbon::now(); $pc->save(); $pc->delete(); $poneSalida++; } $transaction = $puestoconsole; - if($poneSalida==0){ + if ($poneSalida == 0) { $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), - 'fecha_fin' =>Carbon::now(), + 'fecha_inicio' => Carbon::now(), + 'fecha_fin' => Carbon::now(), 'horas_trabajadas' => -1, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); $transaction->delete(); } - return $this->showMessage("Salida registrada :".Carbon::now(), 201); - }); + return $this->showMessage('Salida registrada :'.Carbon::now(), 201); + }); } /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ - public function show(Puesto $puesto, Custodios $custodios,$id) + public function show(Puesto $puesto, Custodios $custodios, $id) { - $pc =PuestoCustodios::where("puesto_id",'=',$puesto->id)->get(); + $pc = PuestoCustodios::where('puesto_id', '=', $puesto->id)->get(); + return $this->showAll($pc); - return "show"; + + return 'show'; } /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // - return "update"; + return 'update'; } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) { // - return "destroy"; + return 'destroy'; } } diff --git a/app/Http/Controllers/api/EmpresaController.php b/app/Http/Controllers/api/EmpresaController.php index ad8caf08..d9cc10bc 100644 --- a/app/Http/Controllers/api/EmpresaController.php +++ b/app/Http/Controllers/api/EmpresaController.php @@ -5,7 +5,6 @@ use App\Empresa; use App\Http\Controllers\ApiController; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; class EmpresaController extends ApiController { @@ -13,14 +12,15 @@ public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ } + /** * Display a listing of the resource. * @@ -46,7 +46,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -57,7 +58,8 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show($id) @@ -68,7 +70,8 @@ public function show($id) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -79,8 +82,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -91,7 +95,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/EquipoCheckListController.php b/app/Http/Controllers/api/EquipoCheckListController.php index 78a6777f..5d011a73 100644 --- a/app/Http/Controllers/api/EquipoCheckListController.php +++ b/app/Http/Controllers/api/EquipoCheckListController.php @@ -2,22 +2,18 @@ namespace App\Http\Controllers\api; -use App\CheckList; use App\CheckList_OpcionesCheckList; use App\Equipos; use App\Http\Controllers\ApiController; -use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class EquipoCheckListController extends ApiController { - public function __construct() { - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); $this->middleware('auth:api')->except(['store', 'verify', 'resend']); - } public function boot() @@ -34,31 +30,31 @@ public function boot() */ public function index(Equipos $equipos) { - return $this->showAll(CheckList_OpcionesCheckList::where('check_list_id','=',$equipos->check_list_id)->get()); + return $this->showAll(CheckList_OpcionesCheckList::where('check_list_id', '=', $equipos->check_list_id)->get()); } - /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ - public function store(Equipos $equipos,Request $request) + public function store(Equipos $equipos, Request $request) { $request->validate([ - 'check_list_id' => 'required|exists:check_lists,id', + 'check_list_id' => 'required|exists:check_lists,id', 'opciones_check_list_id' => 'required|exists:opciones_check_lists,id', - 'valor1' => 'required|max:255', - 'valor2' => 'max:255', - 'valor3' => 'max:255', - 'valor4' => 'max:255', - 'valor5' => 'max:255', - 'valor6' => 'max:255', - 'valor7' => 'max:255', - 'valor8' => 'max:255', - 'valor9' => 'max:255', - 'valor10' => 'max:255', + 'valor1' => 'required|max:255', + 'valor2' => 'max:255', + 'valor3' => 'max:255', + 'valor4' => 'max:255', + 'valor5' => 'max:255', + 'valor6' => 'max:255', + 'valor7' => 'max:255', + 'valor8' => 'max:255', + 'valor9' => 'max:255', + 'valor10' => 'max:255', ]); /********************************/ @@ -69,42 +65,44 @@ public function store(Equipos $equipos,Request $request) $campos['atributo'] = $opcion->atributo; $custodios = CheckList_OpcionesCheckList::create($campos); + return $this->showOne($custodios, 201); }); /********************************/ - } - /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // - return "update"; + return 'update'; } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) { // - return "destroy"; + return 'destroy'; } } diff --git a/app/Http/Controllers/api/EquiposController.php b/app/Http/Controllers/api/EquiposController.php index 4fa1f9e5..ba3fbeaf 100644 --- a/app/Http/Controllers/api/EquiposController.php +++ b/app/Http/Controllers/api/EquiposController.php @@ -6,7 +6,6 @@ use App\Http\Controllers\ApiController; use App\Transformers\EquiposTransformer; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; class EquiposController extends ApiController { @@ -14,15 +13,15 @@ public function __construct(EquiposTransformer $equiposTransformer) { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ - } + /** * Display a listing of the resource. * @@ -48,7 +47,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -59,23 +59,24 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(Equipos $equipos) { - //dd($equipos); + //dd($equipos); return $this->showOne($equipos); } - public function equipo_no_serie(Request $request){ + public function equipo_no_serie(Request $request) + { $reglas = [ 'no_serie' => 'required|max:255', ]; $this->validate($request, $reglas); - - $equipo = Equipos::where('no_serie',"like", '%'.$request->no_serie."%")->firstOrFail(); + $equipo = Equipos::where('no_serie', 'like', '%'.$request->no_serie.'%')->firstOrFail(); return $this->showOne($equipo); } @@ -83,7 +84,8 @@ public function equipo_no_serie(Request $request){ /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -94,8 +96,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -106,7 +109,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/InformeMantenimientoPreventivoController.php b/app/Http/Controllers/api/InformeMantenimientoPreventivoController.php index 5c6ef965..16e4c5a2 100644 --- a/app/Http/Controllers/api/InformeMantenimientoPreventivoController.php +++ b/app/Http/Controllers/api/InformeMantenimientoPreventivoController.php @@ -2,22 +2,18 @@ namespace App\Http\Controllers\api; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use App\Http\Controllers\ApiController; - use App\InformeMantenimientoPreventivo; -use App\InformeMantenimientoPreventivoCategoria; -use App\InformeMantenimientoPreventivoTecnico; -use Carbon\Carbon; +use Illuminate\Http\Request; class InformeMantenimientoPreventivoController extends ApiController { public function __construct() { - $this->middleware('client.credentials')->only(['store', 'resend']); - $this->middleware('auth:api')->only(['show'])->except(['store', 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend']); + $this->middleware('auth:api')->only(['show'])->except(['store', 'verify', 'resend']); } + /** * Display a listing of the resource. * @@ -26,6 +22,7 @@ public function __construct() public function index() { $usuarios = $informes = InformeMantenimientoPreventivo::all(); + return $this->showAll($usuarios); } @@ -42,7 +39,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -53,20 +51,20 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ - public function show(InformeMantenimientoPreventivo $info) { return $this->showOne($info); - } /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -77,8 +75,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -89,7 +88,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/PuestoController.php b/app/Http/Controllers/api/PuestoController.php index 553ed953..9ecc27b3 100644 --- a/app/Http/Controllers/api/PuestoController.php +++ b/app/Http/Controllers/api/PuestoController.php @@ -3,19 +3,19 @@ namespace App\Http\Controllers\api; use App\Custodios; +use App\Http\Controllers\ApiController; use App\Puesto; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; -use App\Http\Controllers\ApiController; class PuestoController extends ApiController { public function __construct() { $this->middleware('client.credentials')->only(['store', 'resend']); - $this->middleware('auth:api')->except(['store', 'verify', 'resend']); - $this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); - //$this->middleware('scope:manage-account')->only(['show', 'update']); + $this->middleware('auth:api')->except(['store', 'verify', 'resend']); + $this->middleware('transform.input:'.UserTransformer::class)->only(['store', 'update']); + //$this->middleware('scope:manage-account')->only(['show', 'update']); /*$this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ @@ -29,13 +29,15 @@ public function __construct() public function index() { $puestos = Puesto::all(); + return $this->showAll($puestos); } /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(Puesto $puesto) @@ -46,61 +48,71 @@ public function show(Puesto $puesto) public function puesto(Request $request) { $reglas = [ - 'codigo' => 'required' + 'codigo' => 'required', ]; $this->validate($request, $reglas); //dd($request); $user = Puesto::where('codigo', $request->codigo)->firstOrFail(); + return $this->showOne($user); } + /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, Puesto $puesto) { $reglas = [ - 'codigo' => 'required|unique:puesto|max:255,' . $puesto->id, + 'codigo' => 'required|unique:puesto|max:255,'.$puesto->id, 'estado' => 'in: OCUPADO,RESERVADO,LIBRE', ]; $this->validate($request, $reglas); - if (!$puesto->estado=='OCUPADO') { + if (!$puesto->estado == 'OCUPADO') { return $this->errorResponse('Se debe especificar al menos un valor diferente para actualizar', 422); } $puesto->save(); + return $this->showOne($puesto); } + /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy(Puesto $puesto) { $puesto->delete(); + return $this->showOne($puesto); } + public function verify($token) { $user = User::where('token', $token)->firstOrFail(); $user->rol = 'usuario'; $user->token = null; $user->save(); + return $this->showMessage('La cuenta ha sido verificada'); } public function usuario(Request $request) { $reglas = [ - 'email' => 'required|email' + 'email' => 'required|email', ]; $this->validate($request, $reglas); $user = User::where('email', $request->email)->firstOrFail(); + return $this->showOne($user); } @@ -108,6 +120,7 @@ public function puestoCustodio(Custodios $custodios) { $puestosDeCustodio = $custodios->puestos; dd($puestosDeCustodio); + return $this->showAll($puestosDeCustodio); } @@ -116,9 +129,10 @@ public function resend(User $user) if ($user->esVerificado()) { return $this->errorResponse('Este usuario ya ha sido verificado.', 409); } - retry(5, function() use ($user) { + retry(5, function () use ($user) { Mail::to($user)->send(new UserCreated($user)); }, 100); + return $this->showMessage('El correo de verificación se ha reenviado'); } } diff --git a/app/Http/Controllers/api/PuestoCustodioController.php b/app/Http/Controllers/api/PuestoCustodioController.php index 0aa54d63..15a944be 100644 --- a/app/Http/Controllers/api/PuestoCustodioController.php +++ b/app/Http/Controllers/api/PuestoCustodioController.php @@ -2,53 +2,49 @@ namespace App\Http\Controllers\api; - use App\Custodios; use App\Http\Controllers\ApiController; use App\Puesto; use App\PuestoCustodios; use Carbon\Carbon; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\DB; class PuestoCustodioController extends ApiController { - public function __construct() { - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); $this->middleware('auth:api')->except(['store', 'verify', 'resend']); - } - /** + /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($puesto) { - return $this->showAll(PuestoCustodios::where('puesto_id','=',$puesto)->get()); + return $this->showAll(PuestoCustodios::where('puesto_id', '=', $puesto)->get()); } - /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ - public function store(Puesto $puesto, Custodios $custodio,Request $request) + public function store(Puesto $puesto, Custodios $custodio, Request $request) { $rules = [ // 'fecha_inicio' => 'required|date|', 'horas_trabajadas' => 'required|integer|min:1', - 'estado' => 'required|in:OCUPADO,RESERVADO,LIBRE', + 'estado' => 'required|in:OCUPADO,RESERVADO,LIBRE', ]; $this->validate($request, $rules); - if (!$puesto->estado=="LIBRE") { + if (!$puesto->estado == 'LIBRE') { return $this->errorResponse('El puesto no está disponible', 409); } /********************************/ @@ -56,153 +52,160 @@ public function store(Puesto $puesto, Custodios $custodio,Request $request) $puesto->estado = $request->estado; $puesto->save(); $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), + 'fecha_inicio' => Carbon::now(), 'horas_trabajadas' => $request->horas_trabajadas, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); + return $this->showOne($transaction, 201); }); /********************************/ - } /** - * para asignar un puesto a un custodio + * para asignar un puesto a un custodio. + * * @param Request $request documentoIdentificacion,codigo,horas */ - public function asigna(Request $request){ + public function asigna(Request $request) + { $reglas = [ 'documentoIdentificacion' => 'required|max:15', - 'codigo' => 'required|max:250', - 'horas' => 'required|numeric|max:250', + 'codigo' => 'required|max:250', + 'horas' => 'required|numeric|max:250', ]; $this->validate($request, $reglas); Artisan::call('disponibilidad:ordena', []); return DB::transaction(function () use ($request) { + $custodio = Custodios::where('documentoIdentificacion', 'like', $request->documentoIdentificacion)->first(); - $custodio = Custodios::where("documentoIdentificacion","like",$request->documentoIdentificacion)->first(); + $puesto = Puesto::where('codigo', 'like', $request->codigo)->first(); - $puesto = Puesto::where("codigo","like",$request->codigo)->first(); + if (count($puesto->PuestoCustodios) > 0) { + $puesto_dato = $puesto->PuestoCustodios[0]; + $id_custodioenpuesto = $puesto_dato['custodio_id']; + if ($id_custodioenpuesto != $custodio->id) { + $custodioenpuesto = Custodios::findOrFail($id_custodioenpuesto); - if(count($puesto->PuestoCustodios)>0){ - $puesto_dato=$puesto->PuestoCustodios[0]; - $id_custodioenpuesto=$puesto_dato['custodio_id']; - if($id_custodioenpuesto != $custodio->id){ - $custodioenpuesto= Custodios::findOrFail($id_custodioenpuesto); - return $this->errorResponse("Puesto ya cogido por ".$custodioenpuesto->nombre_responsable. ', Cedula: '.$custodioenpuesto->documentoIdentificacion. ' a las :'.$puesto_dato->fecha_inicio - ." por (".$puesto_dato->horas_trabajadas.") horas", 418 ); - }else{ + return $this->errorResponse('Puesto ya cogido por '.$custodioenpuesto->nombre_responsable.', Cedula: '.$custodioenpuesto->documentoIdentificacion.' a las :'.$puesto_dato->fecha_inicio + .' por ('.$puesto_dato->horas_trabajadas.') horas', 418); + } else { return $this->showOne($puesto->PuestoCustodios[0], 201); } } - $puestoconsole = PuestoCustodios::where('custodio_id','=',$custodio->id) + $puestoconsole = PuestoCustodios::where('custodio_id', '=', $custodio->id) // ->where('puesto_id','=',$puesto->id)//pone libre todos los otros puestos ->get(); - foreach ($puestoconsole as $pc){ - $p = Puesto::where('id','=',$pc->puesto_id)->firstOrFail(); - $p->estado='LIBRE'; + foreach ($puestoconsole as $pc) { + $p = Puesto::where('id', '=', $pc->puesto_id)->firstOrFail(); + $p->estado = 'LIBRE'; $p->save(); $pc->delete(); } $transaction = $puestoconsole; $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), - 'fecha_fin' => Carbon::now()->addHour($request->horas), + 'fecha_inicio' => Carbon::now(), + 'fecha_fin' => Carbon::now()->addHour($request->horas), 'horas_trabajadas' => $request->horas, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); - $puesto->estado='OCUPADO'; + $puesto->estado = 'OCUPADO'; $puesto->save(); + return $this->showOne($transaction, 201); }); - } /** - * liberar puesto + * liberar puesto. */ - public function liberar(Request $request){ + public function liberar(Request $request) + { $reglas = [ 'documentoIdentificacion' => 'required|max:15', - 'codigo' => 'required|max:250', + 'codigo' => 'required|max:250', ]; Artisan::call('disponibilidad:ordena', []); $this->validate($request, $reglas); return DB::transaction(function () use ($request) { + $custodio = Custodios::where('documentoIdentificacion', 'like', $request->documentoIdentificacion)->first(); + $puesto = Puesto::where('codigo', 'like', $request->codigo)->first(); - $custodio = Custodios::where("documentoIdentificacion","like",$request->documentoIdentificacion)->first(); - $puesto = Puesto::where("codigo","like",$request->codigo)->first(); - - $puestoconsole = PuestoCustodios::where('custodio_id','=',$custodio->id) + $puestoconsole = PuestoCustodios::where('custodio_id', '=', $custodio->id) // ->where('puesto_id','=',$puesto->id)//pone libre todos los otros puestos ->get(); - $poneSalida=0; - foreach ($puestoconsole as $pc){ - $p = Puesto::where('id','=',$pc->puesto_id)->firstOrFail(); - $p->estado='LIBRE'; + $poneSalida = 0; + foreach ($puestoconsole as $pc) { + $p = Puesto::where('id', '=', $pc->puesto_id)->firstOrFail(); + $p->estado = 'LIBRE'; $p->save(); - $pc->fecha_fin= Carbon::now(); + $pc->fecha_fin = Carbon::now(); $pc->save(); $pc->delete(); $poneSalida++; } $transaction = $puestoconsole; - if($poneSalida==0){ + if ($poneSalida == 0) { $transaction = PuestoCustodios::create([ - 'fecha_inicio' =>Carbon::now(), - 'fecha_fin' =>Carbon::now(), + 'fecha_inicio' => Carbon::now(), + 'fecha_fin' => Carbon::now(), 'horas_trabajadas' => -1, - 'puesto_id' => $puesto->id, - 'custodio_id' => $custodio->id, + 'puesto_id' => $puesto->id, + 'custodio_id' => $custodio->id, ]); $transaction->delete(); } - return $this->showMessage("Salida registrada :".Carbon::now(), 201); - }); + return $this->showMessage('Salida registrada :'.Carbon::now(), 201); + }); } /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ - public function show(Puesto $puesto, Custodios $custodios,$id) + public function show(Puesto $puesto, Custodios $custodios, $id) { - $pc =PuestoCustodios::where("puesto_id",'=',$puesto->id)->get(); + $pc = PuestoCustodios::where('puesto_id', '=', $puesto->id)->get(); + return $this->showAll($pc); - return "show"; + + return 'show'; } /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // - return "update"; + return 'update'; } /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) { // - return "destroy"; + return 'destroy'; } } diff --git a/app/Http/Controllers/api/UbicacionController.php b/app/Http/Controllers/api/UbicacionController.php index 807534a3..05b125be 100644 --- a/app/Http/Controllers/api/UbicacionController.php +++ b/app/Http/Controllers/api/UbicacionController.php @@ -5,23 +5,22 @@ use App\Http\Controllers\ApiController; use App\Ubicacion; use Illuminate\Http\Request; -use App\Http\Controllers\Controller; class UbicacionController extends ApiController { - public function __construct() { //Auth::login(User::findOrFail(env('APP_PUESTOS_USER'))->firstOrFail()); //dd(Auth::user()); - $this->middleware('client.credentials')->only(['store', 'resend','notificacion']); - $this->middleware('auth:api')->except([ 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend', 'notificacion']); + $this->middleware('auth:api')->except(['verify', 'resend']); /*$this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); $this->middleware('can:update,user')->only('update'); $this->middleware('can:delete,user')->only('destroy');*/ } + /** * Display a listing of the resource. * @@ -30,6 +29,7 @@ public function __construct() public function index() { $ubicacion = Ubicacion::all(); + return $this->showAll($ubicacion); } @@ -46,7 +46,8 @@ public function create() /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -57,7 +58,8 @@ public function store(Request $request) /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(Ubicacion $ubicacion) @@ -68,7 +70,8 @@ public function show(Ubicacion $ubicacion) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function edit($id) @@ -79,8 +82,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, $id) @@ -91,7 +95,8 @@ public function update(Request $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy($id) diff --git a/app/Http/Controllers/api/UserController.php b/app/Http/Controllers/api/UserController.php index be1d2300..9645b6b8 100644 --- a/app/Http/Controllers/api/UserController.php +++ b/app/Http/Controllers/api/UserController.php @@ -2,20 +2,19 @@ namespace App\Http\Controllers\api; -use App\User; +use App\Http\Controllers\ApiController; use App\Mail\UserCreated; +use App\Transformers\UserTransformer; +use App\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; -use App\Transformers\UserTransformer; -use App\Http\Controllers\ApiController; class UserController extends ApiController { - public function __construct() { - $this->middleware('client.credentials')->only(['store', 'resend']); - /* $this->middleware('auth:api')->except(['store', 'verify', 'resend']); + $this->middleware('client.credentials')->only(['store', 'resend']); + /* $this->middleware('auth:api')->except(['store', 'verify', 'resend']); $this->middleware('transform.input:' . UserTransformer::class)->only(['store', 'update']); $this->middleware('scope:manage-account')->only(['show', 'update']); $this->middleware('can:view,user')->only('show'); @@ -23,73 +22,76 @@ public function __construct() $this->middleware('can:delete,user')->only('destroy');*/ } - /** + /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { - $usuarios = User::all(); + return $this->showAll($usuarios); } + /** * Store a newly created resource in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) { - $reglas = [ - 'name' => 'required', - 'email' => 'required|email|unique:users', - 'password' => 'required|min:6|confirmed' - ]; + 'name' => 'required', + 'email' => 'required|email|unique:users', + 'password' => 'required|min:6|confirmed', + ]; $this->validate($request, $reglas); //return 'Hello World'; $campos = $request->all(); - + $campos['first_name'] = ($request->name); $campos['last_name'] = ($request->name); $campos['empresa'] = ('Avianca EC'); $campos['username'] = ($request->email); - - + $campos['password'] = bcrypt($request->password); - - + $campos['token'] = User::generarVerificationToken(); $campos['rol'] = 'registrado'; $usuario = User::create($campos); - return $this->showOne($usuario, 201);/**/ + + return $this->showOne($usuario, 201); /**/ } + /** * Display the specified resource. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function show(User $user) { return $this->showOne($user); - } + /** * Update the specified resource in storage. * - * @param \Illuminate\Http\Request $request - * @param int $id + * @param \Illuminate\Http\Request $request + * @param int $id + * * @return \Illuminate\Http\Response */ public function update(Request $request, User $user) { $reglas = [ - 'email' => 'email|unique:users,email,' . $user->id, + 'email' => 'email|unique:users,email,'.$user->id, 'password' => 'min:6|confirmed', - 'rol' => 'in: usuario,administrador,system,planta_fisica,recursos_humanos,encargado_activos_fijos,sistemas', + 'rol' => 'in: usuario,administrador,system,planta_fisica,recursos_humanos,encargado_activos_fijos,sistemas', ]; $this->validate($request, $reglas); if ($request->has('name')) { @@ -105,7 +107,7 @@ public function update(Request $request, User $user) } /*if ($request->has('rol')) { $this->allowedAdminAction(); - + if (!$user->esVerificado()) { return $this->errorResponse('Unicamente los usuarios verificados pueden cambiar su valor de administrador', 409); } @@ -115,35 +117,42 @@ public function update(Request $request, User $user) return $this->errorResponse('Se debe especificar al menos un valor diferente para actualizar', 422); } $user->save(); + return $this->showOne($user); } + /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id + * * @return \Illuminate\Http\Response */ public function destroy(User $user) { $user->delete(); + return $this->showOne($user); } + public function verify($token) { $user = User::where('token', $token)->firstOrFail(); $user->rol = 'usuario'; $user->token = null; $user->save(); + return $this->showMessage('La cuenta ha sido verificada'); } public function usuario(Request $request) { $reglas = [ - 'email' => 'required|email' + 'email' => 'required|email', ]; $this->validate($request, $reglas); $user = User::where('email', $request->email)->firstOrFail(); + return $this->showOne($user); } @@ -152,9 +161,10 @@ public function resend(User $user) if ($user->esVerificado()) { return $this->errorResponse('Este usuario ya ha sido verificado.', 409); } - retry(5, function() use ($user) { + retry(5, function () use ($user) { Mail::to($user)->send(new UserCreated($user)); }, 100); + return $this->showMessage('El correo de verificación se ha reenviado'); } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 352a8c85..18381d2d 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -55,17 +55,17 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'cors' => \Barryvdh\Cors\HandleCors::class, + 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'cors' => \Barryvdh\Cors\HandleCors::class, 'client.credentials' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class, - 'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class, - 'signature' => \App\Http\Middleware\SignatureMiddleware::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class, + 'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class, + 'signature' => \App\Http\Middleware\SignatureMiddleware::class, //ini autentificacion intermedia 'authEmp' => \App\Http\Middleware\AuthEmpleado::class, //fin autentificacion intermedia diff --git a/app/Http/Middleware/AuthEmpleado.php b/app/Http/Middleware/AuthEmpleado.php index 210f5068..b741b1eb 100644 --- a/app/Http/Middleware/AuthEmpleado.php +++ b/app/Http/Middleware/AuthEmpleado.php @@ -1 +1,80 @@ -auth = $auth; } public function handle($request, Closure $next,$role) { $rol_emp = $this->auth->user()->rol; $verificado = $this->auth->user()->verified; if($verificado==0){ Session::flash('flash_message','El usuario no esta activado, verifique su correo ('.$this->auth->user()->email.'), o coloque este enlace para reenviar mensaje: "'.url('users/'.$this->auth->user()->id.'/resend').'" o Solicite a un administrador que actualice su perfil.'); //.(new UserApiController($this->auth->user()))->resend($this->auth->user())); return redirect()->action('HomeController@index') //->route('login') ->with('alert', trans('home.alert1',['name' => $rol_emp,'name2' => $role])); } /* * verifica el permiso con el rol */ if(!str_contains($role, $rol_emp)){ if($rol_emp=='registrado'){ Session::flash('flash_message','El Rol ("'.$rol_emp.'") no permite ver esta información, Solicitar activacion a un Administrador.'); }else if($rol_emp=='administrador'){ Session::flash('flash_message','El Rol ("'.$rol_emp.'") no permite ver esta información, Cambie perfil a:'.$role.'.'); }{ Session::flash('flash_message','El Rol ("'.$rol_emp.'") no permite ver esta información, Solicitar elevacion a un Administrador.'); } return redirect()->action('HomeController@index') //->route('login') ->with('alert', trans('home.alert1',['name' => $rol_emp,'name2' => $role])); } return $next($request); } } \ No newline at end of file +auth = $auth; + } + + + public function handle($request, Closure $next, $role) + { + $rol_emp = $this->auth->user()->rol; + $verificado = $this->auth->user()->verified; + if ($verificado == 0) { + Session::flash('flash_message', 'El usuario no esta activado, verifique su correo ('.$this->auth->user()->email.'), o coloque este enlace para reenviar mensaje: "'.url('users/'.$this->auth->user()->id.'/resend').'" o Solicite a un administrador que actualice su perfil.'); + //.(new UserApiController($this->auth->user()))->resend($this->auth->user())); + return redirect()->action('HomeController@index') //->route('login') ->with('alert', trans('home.alert1', ['name' => $rol_emp, 'name2' => $role])); + } + /* * verifica el permiso con el rol */ + if (!str_contains($role, $rol_emp)) { + if ($rol_emp == 'registrado') { + Session::flash('flash_message', 'El Rol ("'.$rol_emp.'") no permite ver esta información, Solicitar activacion a un Administrador.'); + } elseif ($rol_emp == 'administrador') { + Session::flash('flash_message', 'El Rol ("'.$rol_emp.'") no permite ver esta información, Cambie perfil a:'.$role.'.'); + } + { Session::flash('flash_message', 'El Rol ("'.$rol_emp.'") no permite ver esta información, Solicitar elevacion a un Administrador.'); } + + return redirect()->action('HomeController@index') //->route('login') ->with('alert', trans('home.alert1', ['name' => $rol_emp, 'name2' => $role])); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e4cec9c8..afe1c26c 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -10,9 +10,10 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * * @return mixed */ public function handle($request, Closure $next, $guard = null) diff --git a/app/Http/Middleware/SignatureMiddleware.php b/app/Http/Middleware/SignatureMiddleware.php index b41e3f10..55c0b420 100644 --- a/app/Http/Middleware/SignatureMiddleware.php +++ b/app/Http/Middleware/SignatureMiddleware.php @@ -1,19 +1,24 @@ headers->set($header, config('app.name')); + return $response; } -} \ No newline at end of file +} diff --git a/app/Http/Middleware/TransformInput.php b/app/Http/Middleware/TransformInput.php index e0ff2b9c..7afd4388 100644 --- a/app/Http/Middleware/TransformInput.php +++ b/app/Http/Middleware/TransformInput.php @@ -1,14 +1,18 @@ error = $transformedErrors; $response->setData($data); } + return $response; } -} \ No newline at end of file +} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 37dc5c28..353a6ec3 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -1,7 +1,10 @@ 'FORWARDED', - Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', - Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', - Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', + Request::HEADER_FORWARDED => 'FORWARDED', + Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', + Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', + Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', ]; -} \ No newline at end of file +} diff --git a/app/Http/Requests/EquiposRequest.php b/app/Http/Requests/EquiposRequest.php index fbe8f672..d4875059 100644 --- a/app/Http/Requests/EquiposRequest.php +++ b/app/Http/Requests/EquiposRequest.php @@ -25,29 +25,25 @@ public function authorize() * @return array */ public $empresa_procede1; + public function rules(Request $request) { - - if ($this->method() == 'PATCH') - { + if ($this->method() == 'PATCH') { // Update operation, exclude the record with id from the validation: $no_serie_rule = 'required|unique:equipos,no_serie,'.$request->segment(2); - - } - else - { + } else { // Create operation. There is no id yet. $no_serie_rule = 'required|unique:equipos,no_serie,|max:250'; } //dd($this->method()); return [ - 'area_id' => 'required', - 'observaciones' => 'required', - 'descripcion' => 'required', - 'no_serie' => 'required', - 'codigo_avianca' => 'required|unique:equipos,codigo_avianca|max:250'.$this->get('id'), - 'no_serie' => $no_serie_rule, + 'area_id' => 'required', + 'observaciones' => 'required', + 'descripcion' => 'required', + 'no_serie' => 'required', + 'codigo_avianca' => 'required|unique:equipos,codigo_avianca|max:250'.$this->get('id'), + 'no_serie' => $no_serie_rule, //'check_list_id' => 'required|unique:equipos,check_list_id|max:250', 'empresa_procede1' => [function ($attribute, $value, $fail) { if (strlen($value) < 1) { @@ -66,18 +62,13 @@ public function rules(Request $request) /*if ($value <= 10) { $fail(':attribute needs more cowbell!'); }*/ - $empresa = Empresa::where('empresa','=',Input::get("empresa_procede1"))->first(); - + $empresa = Empresa::where('empresa', '=', Input::get('empresa_procede1'))->first(); - if(!preg_match($empresa->formula_codigo,$value)) - { + if (!preg_match($empresa->formula_codigo, $value)) { $fail(':attribute NO cumple con estructura de codigo de empresa!('.$empresa->formula_codigo.')'); } - - }] + }], ]; - - } } diff --git a/app/InformeMantenimientoPreventivo.php b/app/InformeMantenimientoPreventivo.php index d43be6a3..374a6a20 100644 --- a/app/InformeMantenimientoPreventivo.php +++ b/app/InformeMantenimientoPreventivo.php @@ -11,9 +11,9 @@ class InformeMantenimientoPreventivo extends Model public $transformer = \App\Transformers\InformeMantenimientoPreventivoTransformer::class; protected $table = 'informe_manto_prevs'; protected $dates = ['deleted_at']; - protected $fillable = ['id','custodio_id','area_id', - 'no_orden','fecha_solicitud','fecha_ejecucion','hora_inicio', - 'hora_fin','informe_manto_prev_cate_id','requerimiento','solucion','resolucion']; + protected $fillable = ['id', 'custodio_id', 'area_id', + 'no_orden', 'fecha_solicitud', 'fecha_ejecucion', 'hora_inicio', + 'hora_fin', 'informe_manto_prev_cate_id', 'requerimiento', 'solucion', 'resolucion', ]; /* * estado enum('BUENO', 'MALO', 'NUEVO') * estatus enum('VIGENTE', 'BODEGA', 'BAJA') @@ -30,18 +30,14 @@ public function custodioxc() return $this->hasOne('App\Custodios', 'id', 'custodio_id'); } - public function informe_manto_prev_catexc() { return $this->hasOne('App\User', 'id', 'informe_manto_prev_cate_id'); } -//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// public function modelo_equipoxc() { return $this->hasOne('App\ModeloEquipo', 'id', 'modelo_equipo_id'); } - - - } diff --git a/app/InformeMantenimientoPreventivoCategoria.php b/app/InformeMantenimientoPreventivoCategoria.php index 7d0a99ed..1549be4a 100644 --- a/app/InformeMantenimientoPreventivoCategoria.php +++ b/app/InformeMantenimientoPreventivoCategoria.php @@ -7,10 +7,8 @@ class InformeMantenimientoPreventivoCategoria extends Model { - use SoftDeletes; protected $table = 'informe_manto_prev_cates'; protected $dates = ['deleted_at']; - protected $fillable = ['id','categoria']; - + protected $fillable = ['id', 'categoria']; } diff --git a/app/InformeMantenimientoPreventivoTecnico.php b/app/InformeMantenimientoPreventivoTecnico.php index dae58d37..7ab2d0a0 100644 --- a/app/InformeMantenimientoPreventivoTecnico.php +++ b/app/InformeMantenimientoPreventivoTecnico.php @@ -10,13 +10,13 @@ class InformeMantenimientoPreventivoTecnico extends Model use SoftDeletes; protected $table = 'informe_manto_prev_tecs'; protected $dates = ['deleted_at']; - protected $fillable = ['user_id','informe_manto_prev_id']; - + protected $fillable = ['user_id', 'informe_manto_prev_id']; public function userxc() { return $this->hasOne('App\User', 'id', 'user_id'); } + public function InformeMantenimientoPreventivoxc() { return $this->hasOne('App\InformeMantenimientoPreventivo', 'id', 'informe_manto_prev_id'); diff --git a/app/Jobs/SendActualizacionCustodioeEmail.php b/app/Jobs/SendActualizacionCustodioeEmail.php index 9638fdaf..26a53381 100644 --- a/app/Jobs/SendActualizacionCustodioeEmail.php +++ b/app/Jobs/SendActualizacionCustodioeEmail.php @@ -4,10 +4,10 @@ use App\Custodios; use Illuminate\Bus\Queueable; -use Illuminate\Queue\SerializesModels; -use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; class SendActualizacionCustodioeEmail implements ShouldQueue { diff --git a/app/Mail/NotificaCustodioCambio.php b/app/Mail/NotificaCustodioCambio.php index a53f333d..cb3be9e1 100644 --- a/app/Mail/NotificaCustodioCambio.php +++ b/app/Mail/NotificaCustodioCambio.php @@ -6,7 +6,6 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Support\Facades\Lang; class NotificaCustodioCambio extends Mailable @@ -32,8 +31,6 @@ public function __construct(Custodios $custodios) */ public function build() { - return $this->markdown('emails.NotificaCustodioEmail')->subject(Lang::get('message.notifica_correo')); - } } diff --git a/app/Mail/UserCreated.php b/app/Mail/UserCreated.php index a5ad56a1..125839ab 100644 --- a/app/Mail/UserCreated.php +++ b/app/Mail/UserCreated.php @@ -6,14 +6,12 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Support\Facades\Lang; class UserCreated extends Mailable { use Queueable, SerializesModels; - public $user; /** diff --git a/app/ModeloEquipo.php b/app/ModeloEquipo.php index c6417235..f224cda6 100644 --- a/app/ModeloEquipo.php +++ b/app/ModeloEquipo.php @@ -7,10 +7,13 @@ class ModeloEquipo extends Model { // - protected $fillable = ['modelo','fabricante','garantia_anios','tipo_equipo']; - public function tipos() { - return $this->hasMany('DESKTOP','LAPTOP','CPU','CLON','IMPRESORA LASER','IMPRESORA MATRICIAL'); + protected $fillable = ['modelo', 'fabricante', 'garantia_anios', 'tipo_equipo']; + + public function tipos() + { + return $this->hasMany('DESKTOP', 'LAPTOP', 'CPU', 'CLON', 'IMPRESORA LASER', 'IMPRESORA MATRICIAL'); } + public function equiposhm() { return $this->hasMany('App\Equipos', 'modelo_equipo_id', 'id'); diff --git a/app/Modulo.php b/app/Modulo.php index 79e45368..1217da69 100644 --- a/app/Modulo.php +++ b/app/Modulo.php @@ -3,7 +3,6 @@ namespace App; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; use Laravel\Passport\HasApiTokens; use Mpociot\Firebase\SyncsWithFirebase; diff --git a/app/Notifications/CustodioDarClave.php b/app/Notifications/CustodioDarClave.php index aae69e44..08ca1054 100644 --- a/app/Notifications/CustodioDarClave.php +++ b/app/Notifications/CustodioDarClave.php @@ -3,15 +3,15 @@ namespace App\Notifications; use Illuminate\Bus\Queueable; -use Illuminate\Notifications\Notification; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Notifications\Notification; class CustodioDarClave extends Notification { use Queueable; public $custodios; + /** * Create a new notification instance. * @@ -19,13 +19,14 @@ class CustodioDarClave extends Notification */ public function __construct($custodios) { - $this->custodios = $custodios; + $this->custodios = $custodios; } /** * Get the notification's delivery channels. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -36,22 +37,23 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - - return (new MailMessage) + return (new MailMessage()) ->line('La clave de acceso '.$this->custodios->nombre_responsable.' es.') - ->action('Clave de Acceso:'.$this->custodios->token , url('/home2/'.$this->custodios->token)) + ->action('Clave de Acceso:'.$this->custodios->token, url('/home2/'.$this->custodios->token)) ->line('Gracias por usar esta aplicación!'); } /** * Get the array representation of the notification. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return array */ public function toArray($notifiable) diff --git a/app/Notifications/MyOwnResetPassword.php b/app/Notifications/MyOwnResetPassword.php index cae76806..80dc143e 100644 --- a/app/Notifications/MyOwnResetPassword.php +++ b/app/Notifications/MyOwnResetPassword.php @@ -2,15 +2,12 @@ namespace App\Notifications; -use Illuminate\Bus\Queueable; -use Illuminate\Notifications\Notification; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Lang; class MyOwnResetPassword extends Notification { - /** * The password reset token. * @@ -21,7 +18,8 @@ class MyOwnResetPassword extends Notification /** * Create a notification instance. * - * @param string $token + * @param string $token + * * @return void */ public function __construct($token) @@ -32,7 +30,8 @@ public function __construct($token) /** * Get the notification's channels. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return array|string */ public function via($notifiable) @@ -43,12 +42,13 @@ public function via($notifiable) /** * Build the mail representation of the notification. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { - return (new MailMessage) + return (new MailMessage()) ->subject(Lang::get('adminlte_lang::message.notifiableaction')) ->line(Lang::get('adminlte_lang::message.notifiableline1')) ->action(Lang::get('adminlte_lang::message.notifiableaction'), url(config('app.url').route('password.reset', $this->token, false))) diff --git a/app/OAuthApp.php b/app/OAuthApp.php index 5cfcfaef..b6f8056e 100644 --- a/app/OAuthApp.php +++ b/app/OAuthApp.php @@ -23,7 +23,5 @@ public function esActivo() } protected $dates = ['deleted_at']; - protected $fillable = ['id','token_secret','client_id','activo','expires_in','access_token','refresh_token','client_secret']; - - + protected $fillable = ['id', 'token_secret', 'client_id', 'activo', 'expires_in', 'access_token', 'refresh_token', 'client_secret']; } diff --git a/app/OpcionesCheckList.php b/app/OpcionesCheckList.php index e208ba0c..6b0c6a4f 100644 --- a/app/OpcionesCheckList.php +++ b/app/OpcionesCheckList.php @@ -8,19 +8,21 @@ class OpcionesCheckList extends Model { // - protected $fillable = ['area_id','atributo','mandatorio','tipo']; + protected $fillable = ['area_id', 'atributo', 'mandatorio', 'tipo']; + 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; } + public function areaxc() { return $this->hasOne('App\Areas', 'id', 'area_id'); diff --git a/app/OrdenDeCompra.php b/app/OrdenDeCompra.php index 1155a965..991f0c5a 100644 --- a/app/OrdenDeCompra.php +++ b/app/OrdenDeCompra.php @@ -9,5 +9,5 @@ class OrdenDeCompra extends Model { // use SoftDeletes; - protected $fillable = ['ordenCompra','fecha_compra']; + protected $fillable = ['ordenCompra', 'fecha_compra']; } diff --git a/app/Permiso.php b/app/Permiso.php index 4c8f2ede..55e0bfa7 100644 --- a/app/Permiso.php +++ b/app/Permiso.php @@ -10,7 +10,6 @@ class Permiso extends Model { - use Notifiable, HasApiTokens, SoftDeletes; use SyncsWithFirebase; @@ -22,7 +21,6 @@ class Permiso extends Model public function modulos() { - return $this->belongsTo('App\Modulo', 'modulo_id', 'id'); } } diff --git a/app/Permisorol.php b/app/Permisorol.php index 4c40071e..792741ed 100644 --- a/app/Permisorol.php +++ b/app/Permisorol.php @@ -2,7 +2,6 @@ namespace App; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; @@ -13,18 +12,14 @@ class Permisorol extends Pivot { use Notifiable, HasApiTokens; use SyncsWithFirebase; - use SoftDeletes; protected $dates = ['deleted_at']; - protected $table = 'permisorols'; protected $fillable = [ 'permiso_id', 'rol_id', ]; - - } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 6c01f535..dc4e6c92 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,10 +7,8 @@ use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; -use Illuminate\Validation\Validator; use Intervention\Image\ImageManagerStatic; - class AppServiceProvider extends ServiceProvider { /** @@ -20,45 +18,43 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - Schema::defaultStringLength(191); + Schema::defaultStringLength(191); - /* - * para embio de correo cuando se realiza un ingreso. - */ - User::created(function($user) { - retry(5, function() use ($user) { + /* + * para embio de correo cuando se realiza un ingreso. + */ + User::created(function ($user) { + retry(5, function () use ($user) { Mail::to($user)->send(new UserCreated($user)); }, 100); }); - User::updated(function($user) { + User::updated(function ($user) { if ($user->isDirty('email')) { - $user->verified=0; + $user->verified = 0; $user->verification_token = User::generarVerificationToken(); $user->save(); - retry(5, function() use ($user) { + retry(5, function () use ($user) { Mail::to($user)->send(new UserCreated($user)); }, 100); } }); - \Illuminate\Support\Facades\Validator::extend('is_jpg',function($attribute, $value, $params, $validator) { + \Illuminate\Support\Facades\Validator::extend('is_jpg', function ($attribute, $value, $params, $validator) { $image = base64_decode($value); $f = finfo_open(); $result = finfo_buffer($f, $image, FILEINFO_MIME_TYPE); + return $result == 'image/jpg'; }); \Illuminate\Support\Facades\Validator::extend('imageable', function ($attribute, $value, $params, $validator) { try { ImageManagerStatic::make($value); + return true; } catch (\Exception $e) { return false; } }); - - - - } /** @@ -69,9 +65,8 @@ public function boot() public function register() { if ($this->app->environment('local', 'testing')) { - } - $this->app->bind('path.public', function() { + $this->app->bind('path.public', function () { return base_path().'/html'; }); } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 15d3652c..2903525e 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -3,9 +3,8 @@ namespace App\Providers; use Carbon\Carbon; -use Laravel\Passport\Passport; -use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; +use Laravel\Passport\Passport; class AuthServiceProvider extends ServiceProvider { @@ -36,7 +35,7 @@ public function boot() Passport::tokensCan([ 'place-orders' => 'Place orders', 'check-status' => 'Check order status', - 'dar-datos' => 'Entregar datos personales', + 'dar-datos' => 'Entregar datos personales', ]); Passport::enableImplicitGrant(); diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 352cce44..395c518b 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast; +use Illuminate\Support\ServiceProvider; class BroadcastServiceProvider extends ServiceProvider { diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index fca6152c..f106ba4d 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Event; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 5ea48d39..548e4be7 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { diff --git a/app/Puesto.php b/app/Puesto.php index 9027114f..50f75b80 100644 --- a/app/Puesto.php +++ b/app/Puesto.php @@ -18,22 +18,22 @@ class Puesto extends Model public $transformer = PuestoTransformer::class; protected $fillable = [ - 'ubicacion_id','codigo','detalle','x','y','estado' + 'ubicacion_id', 'codigo', 'detalle', 'x', 'y', 'estado', ]; - public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM puestos WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM puestos 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 generarCodigo() { return str_random(36); @@ -53,6 +53,4 @@ public function ubicacions() { return $this->hasOne('App\Ubicacion', 'id', 'ubicacion_id'); } - - } diff --git a/app/PuestoCustodios.php b/app/PuestoCustodios.php index 03f39e4e..105c8c21 100644 --- a/app/PuestoCustodios.php +++ b/app/PuestoCustodios.php @@ -18,19 +18,16 @@ class PuestoCustodios extends Model public $transformer = PuestoCustodiosTransformer::class; protected $fillable = [ - 'puesto_id','custodio_id','fecha_inicio','fecha_fin','horas_trabajadas' + 'puesto_id', 'custodio_id', 'fecha_inicio', 'fecha_fin', 'horas_trabajadas', ]; public function custodio() { - return $this->belongsTo(Custodios::class,'custodio_id'); + return $this->belongsTo(Custodios::class, 'custodio_id'); } public function puesto() { - return $this->belongsTo(Puesto::class,'puesto_id'); + return $this->belongsTo(Puesto::class, 'puesto_id'); } - - - } diff --git a/app/RepoNovedades.php b/app/RepoNovedades.php index c2902072..0ecc4b13 100644 --- a/app/RepoNovedades.php +++ b/app/RepoNovedades.php @@ -10,24 +10,23 @@ class RepoNovedades extends Model { use SoftDeletes; protected $dates = ['deleted_at']; - protected $fillable = ['custodio_id','correo','fecha_novedades','novedad','observaciones','antiguo_custodio_id','traslado_custodio_id','estado','token_unico']; + protected $fillable = ['custodio_id', 'correo', 'fecha_novedades', 'novedad', 'observaciones', 'antiguo_custodio_id', 'traslado_custodio_id', 'estado', 'token_unico']; /* * estado enum('BUENO', 'MALO', 'NUEVO') * estatus enum('VIGENTE', 'BODEGA', 'BAJA') * garantia enum('SI', 'NO') * */ - public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM repo_novedades WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM repo_novedades 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; } @@ -36,7 +35,6 @@ public static function generarUnico() return str_random(50); } - public function custodioxc() { return $this->hasOne('App\Custodios', 'id', 'custodio_id'); @@ -46,6 +44,7 @@ public function antiguo_custodioxc() { return $this->hasOne('App\Custodios', 'id', 'antiguo_custodio_id'); } + public function traslado_custodioxc() { return $this->hasOne('App\Custodios', 'id', 'traslado_custodio_id'); @@ -55,7 +54,4 @@ public function reponovedadedetalleshm() { return $this->hasMany('App\RepoNovedadesDetalle', 'repo_novedades_id', 'id'); } - - - } diff --git a/app/RepoNovedadesDetalle.php b/app/RepoNovedadesDetalle.php index 70f1023d..8fa7ee1d 100644 --- a/app/RepoNovedadesDetalle.php +++ b/app/RepoNovedadesDetalle.php @@ -9,7 +9,7 @@ class RepoNovedadesDetalle extends Model { use SoftDeletes; protected $dates = ['deleted_at']; - protected $fillable = ['repo_novedades_id','id_equipos','modelo_equipo_id','orden_de_compra_id','custodio_id','estacione_id','area_id','check_list_id','num_cajas','sociedad','no_serie','codigo_barras','codigo_avianca','codigo_otro','descripcion','ip','estado','estatus','garantia','observaciones']; + protected $fillable = ['repo_novedades_id', 'id_equipos', 'modelo_equipo_id', 'orden_de_compra_id', 'custodio_id', 'estacione_id', 'area_id', 'check_list_id', 'num_cajas', 'sociedad', 'no_serie', 'codigo_barras', 'codigo_avianca', 'codigo_otro', 'descripcion', 'ip', 'estado', 'estatus', 'garantia', 'observaciones']; public function RepoNovedadesDetallexc() { @@ -21,26 +21,32 @@ public function modelo_equipoxc() { return $this->hasOne('App\ModeloEquipo', 'id', 'modelo_equipo_id'); } + public function orden_de_compraxc() { return $this->hasOne('App\OrdenDeCompra', 'id', 'orden_de_compra_id'); } + public function custodioxc() { return $this->hasOne('App\Custodios', 'id', 'custodio_id'); } + public function estacionxc() { return $this->hasOne('App\Estaciones', 'id', 'estacione_id'); } + public function areaxc() { return $this->hasOne('App\Areas', 'id', 'area_id'); } + public function check_listxc() { return $this->hasOne('App\CheckList', 'id', 'check_list_id'); } + public function equipos_logxc() { return $this->hasOne('App\Equipos_log', 'id', 'id_equipos'); @@ -48,8 +54,6 @@ public function equipos_logxc() public function repo_novedades_master() {//no esta probado - return $this->belongsTo('App\RepoNovedades','repo_novedades_id','id'); + return $this->belongsTo('App\RepoNovedades', 'repo_novedades_id', 'id'); } - - } diff --git a/app/Rol.php b/app/Rol.php index 47c4f7c6..389fe031 100644 --- a/app/Rol.php +++ b/app/Rol.php @@ -20,13 +20,11 @@ class Rol extends Model public function users() { - - return $this->belongsToMany('App\User', 'usuariorols' )->using('App\Usuariorol'); + return $this->belongsToMany('App\User', 'usuariorols')->using('App\Usuariorol'); } public function permisos() { - - return $this->belongsToMany('App\Permiso', 'permisorols' )->using('App\Permisorol'); + return $this->belongsToMany('App\Permiso', 'permisorols')->using('App\Permisorol'); } } diff --git a/app/Scopes/CustodiosScope.php b/app/Scopes/CustodiosScope.php index 805296b1..269b0244 100644 --- a/app/Scopes/CustodiosScope.php +++ b/app/Scopes/CustodiosScope.php @@ -3,9 +3,9 @@ namespace App\Scopes; use App\User; -use Illuminate\Database\Eloquent\Scope; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Auth; class CustodiosScope implements Scope @@ -13,15 +13,15 @@ class CustodiosScope implements Scope /** * Apply the scope to a given Eloquent query builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @param \Illuminate\Database\Eloquent\Model $model + * @param \Illuminate\Database\Eloquent\Builder $builder + * @param \Illuminate\Database\Eloquent\Model $model + * * @return void */ public function apply(Builder $builder, Model $model) { - if(Auth::user()->rol != 'applicaciones'){ + if (Auth::user()->rol != 'applicaciones') { $builder->where('compania', '=', Auth::user()->empresa); } - } -} \ No newline at end of file +} diff --git a/app/Scopes/EmpresaScope.php b/app/Scopes/EmpresaScope.php index 6e4b7f8e..2d1a23b6 100644 --- a/app/Scopes/EmpresaScope.php +++ b/app/Scopes/EmpresaScope.php @@ -3,9 +3,9 @@ namespace App\Scopes; use App\User; -use Illuminate\Database\Eloquent\Scope; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Auth; class EmpresaScope implements Scope @@ -13,12 +13,13 @@ class EmpresaScope implements Scope /** * Apply the scope to a given Eloquent query builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @param \Illuminate\Database\Eloquent\Model $model + * @param \Illuminate\Database\Eloquent\Builder $builder + * @param \Illuminate\Database\Eloquent\Model $model + * * @return void */ public function apply(Builder $builder, Model $model) { $builder->where('sociedad', '=', Auth::user()->empresa); } -} \ No newline at end of file +} diff --git a/app/Scopes/EmpresaTScope.php b/app/Scopes/EmpresaTScope.php index 7c4323b1..79f9dcd4 100644 --- a/app/Scopes/EmpresaTScope.php +++ b/app/Scopes/EmpresaTScope.php @@ -3,9 +3,9 @@ namespace App\Scopes; use App\User; -use Illuminate\Database\Eloquent\Scope; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Auth; class EmpresaTScope implements Scope @@ -13,12 +13,13 @@ class EmpresaTScope implements Scope /** * Apply the scope to a given Eloquent query builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @param \Illuminate\Database\Eloquent\Model $model + * @param \Illuminate\Database\Eloquent\Builder $builder + * @param \Illuminate\Database\Eloquent\Model $model + * * @return void */ public function apply(Builder $builder, Model $model) { $builder->where('empresa', '=', Auth::user()->empresa); } -} \ No newline at end of file +} diff --git a/app/Traits/ApiResponser.php b/app/Traits/ApiResponser.php index 787caed4..79e61a69 100644 --- a/app/Traits/ApiResponser.php +++ b/app/Traits/ApiResponser.php @@ -1,94 +1,113 @@ json($data, $code); - } - protected function errorResponse($message, $code) - { - return response()->json(['error' => $message, 'code' => $code], $code); - } - protected function showAll(Collection $collection, $code = 200) - { - if ($collection->isEmpty()) { - return $this->successResponse(['data' => $collection], $code); - } - $transformer = $collection->first()->transformer; - $collection = $this->filterData($collection, $transformer); - $collection = $this->sortData($collection, $transformer); - $collection = $this->paginate($collection); - $collection = $this->transformData($collection, $transformer); - $collection = $this->cacheResponse($collection); - return $this->successResponse($collection, $code); - } - protected function showOne(Model $instance, $code = 200) - { - $transformer = $instance->transformer; - $instance = $this->transformData($instance, $transformer); - return $this->successResponse($instance, $code); - } - protected function showMessage($message, $code = 200) - { - return $this->successResponse(['data' => $message], $code); - } - protected function filterData(Collection $collection, $transformer) - { - foreach (request()->query() as $query => $value) { - $attribute = $transformer::originalAttribute($query); - if (isset($attribute, $value)) { - $collection = $collection->where($attribute, $value); - } - } - return $collection; - } - protected function sortData(Collection $collection, $transformer) - { - if (request()->has('sort_by')) { - $attribute = $transformer::originalAttribute(request()->sort_by); - $collection = $collection->sortBy->{$attribute}; - } - return $collection; - } - protected function paginate(Collection $collection) - { - $rules = [ - 'per_page' => 'integer|min:2|max:50' - ]; - Validator::validate(request()->all(), $rules); - $page = LengthAwarePaginator::resolveCurrentPage(); - $perPage = 15; - if (request()->has('per_page')) { - $perPage = (int) request()->per_page; - } - $results = $collection->slice(($page - 1) * $perPage, $perPage)->values(); - $paginated = new LengthAwarePaginator($results, $collection->count(), $perPage, $page, [ - 'path' => LengthAwarePaginator::resolveCurrentPath(), - ]); - $paginated->appends(request()->all()); - return $paginated; - } - protected function transformData($data, $transformer) - { - $transformation = Fractal($data, new $transformer); - return $transformation->toArray(); - //return $data; - } - protected function cacheResponse($data) - { - $url = request()->url(); - $queryParams = request()->query(); - ksort($queryParams); - $queryString = http_build_query($queryParams); - $fullUrl = "{$url}?{$queryString}"; - return Cache::remember($fullUrl, 30/60, function() use($data) { - return $data; - }); - } -} \ No newline at end of file + private function successResponse($data, $code) + { + return response()->json($data, $code); + } + + protected function errorResponse($message, $code) + { + return response()->json(['error' => $message, 'code' => $code], $code); + } + + protected function showAll(Collection $collection, $code = 200) + { + if ($collection->isEmpty()) { + return $this->successResponse(['data' => $collection], $code); + } + $transformer = $collection->first()->transformer; + $collection = $this->filterData($collection, $transformer); + $collection = $this->sortData($collection, $transformer); + $collection = $this->paginate($collection); + $collection = $this->transformData($collection, $transformer); + $collection = $this->cacheResponse($collection); + + return $this->successResponse($collection, $code); + } + + protected function showOne(Model $instance, $code = 200) + { + $transformer = $instance->transformer; + $instance = $this->transformData($instance, $transformer); + + return $this->successResponse($instance, $code); + } + + protected function showMessage($message, $code = 200) + { + return $this->successResponse(['data' => $message], $code); + } + + protected function filterData(Collection $collection, $transformer) + { + foreach (request()->query() as $query => $value) { + $attribute = $transformer::originalAttribute($query); + if (isset($attribute, $value)) { + $collection = $collection->where($attribute, $value); + } + } + + return $collection; + } + + protected function sortData(Collection $collection, $transformer) + { + if (request()->has('sort_by')) { + $attribute = $transformer::originalAttribute(request()->sort_by); + $collection = $collection->sortBy->{$attribute}; + } + + return $collection; + } + + protected function paginate(Collection $collection) + { + $rules = [ + 'per_page' => 'integer|min:2|max:50', + ]; + Validator::validate(request()->all(), $rules); + $page = LengthAwarePaginator::resolveCurrentPage(); + $perPage = 15; + if (request()->has('per_page')) { + $perPage = (int) request()->per_page; + } + $results = $collection->slice(($page - 1) * $perPage, $perPage)->values(); + $paginated = new LengthAwarePaginator($results, $collection->count(), $perPage, $page, [ + 'path' => LengthAwarePaginator::resolveCurrentPath(), + ]); + $paginated->appends(request()->all()); + + return $paginated; + } + + protected function transformData($data, $transformer) + { + $transformation = Fractal($data, new $transformer()); + + return $transformation->toArray(); + //return $data; + } + + protected function cacheResponse($data) + { + $url = request()->url(); + $queryParams = request()->query(); + ksort($queryParams); + $queryString = http_build_query($queryParams); + $fullUrl = "{$url}?{$queryString}"; + + return Cache::remember($fullUrl, 30 / 60, function () use ($data) { + return $data; + }); + } +} diff --git a/app/Transformers/AreasTransformer.php b/app/Transformers/AreasTransformer.php index 17b2462a..426144df 100644 --- a/app/Transformers/AreasTransformer.php +++ b/app/Transformers/AreasTransformer.php @@ -1,8 +1,11 @@ (string)$areas->id, - 'area' => (string)$areas->area, - 'empresa' => (string)$areas->empresa, - 'fechaCreacion' => (string)$areas->created_at, - 'fechaActualizacion' => (string)$areas->updated_at, - 'fechaEliminacion' => isset($areas->deleted_at) ? (string) $areas->deleted_at : null, + 'id' => (string) $areas->id, + 'area' => (string) $areas->area, + 'empresa' => (string) $areas->empresa, + 'fechaCreacion' => (string) $areas->created_at, + 'fechaActualizacion' => (string) $areas->updated_at, + 'fechaEliminacion' => isset($areas->deleted_at) ? (string) $areas->deleted_at : null, /*'links' => [ [ 'rel' => 'custodios.puestos', @@ -27,28 +30,32 @@ public function transform(Areas $areas) ],*/ ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'area' => 'area', - 'empresa' => 'empresa', - 'fechaCreacion' => 'created_at', + 'id' => 'id', + 'area' => 'area', + 'empresa' => 'empresa', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'area' => 'area', - 'empresa' => 'empresa', + 'id' => 'id', + 'area' => 'area', + 'empresa' => 'empresa', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/BusquedaTransformer.php b/app/Transformers/BusquedaTransformer.php index 86fdcd2e..0c9870ca 100644 --- a/app/Transformers/BusquedaTransformer.php +++ b/app/Transformers/BusquedaTransformer.php @@ -3,12 +3,11 @@ * Created by PhpStorm. * User: wcadena * Date: 6/9/2017 - * Time: 7:28 + * Time: 7:28. */ namespace App\Transformers; - use App\Busqueda; class BusquedaTransformer @@ -20,56 +19,61 @@ class BusquedaTransformer */ public function transform(Busqueda $busqueda) { - $linkrel=""; - $linkhref=""; + $linkrel = ''; + $linkhref = ''; - switch (((String)$busqueda->instancia_tabla).toUpper()){ - case "CUSTODIOs": - $linkrel="Custodio"; - $linkhref="custodio.show"; + switch (((string) $busqueda->instancia_tabla).toUpper()) { + case 'CUSTODIOs': + $linkrel = 'Custodio'; + $linkhref = 'custodio.show'; break; - case "EQUIPOS": - $linkrel="Equipo"; - $linkhref="equipos.show"; + case 'EQUIPOS': + $linkrel = 'Equipo'; + $linkhref = 'equipos.show'; break; } + return [ - 'id' => (string)$busqueda->instancia_id, - 'instancia' => (string)$busqueda->instancia_tabla, - 'dato' => (string)$busqueda->dato, - 'fechaCreacion' => (string)$busqueda->created_at, - 'fechaActualizacion' => (string)$busqueda->updated_at, - 'fechaEliminacion' => isset($busqueda->deleted_at) ? (string) $busqueda->deleted_at : null, - 'links' => [ + 'id' => (string) $busqueda->instancia_id, + 'instancia' => (string) $busqueda->instancia_tabla, + 'dato' => (string) $busqueda->dato, + 'fechaCreacion' => (string) $busqueda->created_at, + 'fechaActualizacion' => (string) $busqueda->updated_at, + 'fechaEliminacion' => isset($busqueda->deleted_at) ? (string) $busqueda->deleted_at : null, + 'links' => [ [ - 'rel' => $linkrel, + 'rel' => $linkrel, 'href' => route($linkhref, $busqueda->instancia_id), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'instancia' => 'instancia', - 'dato' => 'dato', - 'fechaCreacion' => 'created_at', + 'id' => 'id', + 'instancia' => 'instancia', + 'dato' => 'dato', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'instancia' => 'instancia', - 'dato' => 'dato', + 'id' => 'id', + 'instancia' => 'instancia', + 'dato' => 'dato', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/CheckList_OpcionesCheckListTransformer.php b/app/Transformers/CheckList_OpcionesCheckListTransformer.php index 1fdc6e7d..9d171073 100644 --- a/app/Transformers/CheckList_OpcionesCheckListTransformer.php +++ b/app/Transformers/CheckList_OpcionesCheckListTransformer.php @@ -1,7 +1,10 @@ (int)$checkList_OpcionesCheckList->id, - 'valor1' => (string)$checkList_OpcionesCheckList->valor1, - 'valor2' => (string)$checkList_OpcionesCheckList->valor2, - 'valor3' => (string)$checkList_OpcionesCheckList->valor3, - 'valor4' => (string)$checkList_OpcionesCheckList->valor4, - 'valor5' => (string)$checkList_OpcionesCheckList->valor5, - 'valor6' => (string)$checkList_OpcionesCheckList->valor6, - 'valor7' => (string)$checkList_OpcionesCheckList->valor7, - 'valor8' => (string)$checkList_OpcionesCheckList->valor8, - 'valor9' => (string)$checkList_OpcionesCheckList->valor9, - 'valor10' => (string)$checkList_OpcionesCheckList->valor10, + 'id' => (int) $checkList_OpcionesCheckList->id, + 'valor1' => (string) $checkList_OpcionesCheckList->valor1, + 'valor2' => (string) $checkList_OpcionesCheckList->valor2, + 'valor3' => (string) $checkList_OpcionesCheckList->valor3, + 'valor4' => (string) $checkList_OpcionesCheckList->valor4, + 'valor5' => (string) $checkList_OpcionesCheckList->valor5, + 'valor6' => (string) $checkList_OpcionesCheckList->valor6, + 'valor7' => (string) $checkList_OpcionesCheckList->valor7, + 'valor8' => (string) $checkList_OpcionesCheckList->valor8, + 'valor9' => (string) $checkList_OpcionesCheckList->valor9, + 'valor10' => (string) $checkList_OpcionesCheckList->valor10, - 'tipo' => (string)$checkList_OpcionesCheckList->tipo, - 'atributo' => (string)$checkList_OpcionesCheckList->atributo, + 'tipo' => (string) $checkList_OpcionesCheckList->tipo, + 'atributo' => (string) $checkList_OpcionesCheckList->atributo, - - 'fechaCreacion' => (string)$checkList_OpcionesCheckList->created_at, - 'fechaActualizacion' => (string)$checkList_OpcionesCheckList->updated_at, - 'fechaEliminacion' => isset($checkList_OpcionesCheckList->deleted_at) ? (string) $checkList_OpcionesCheckList->deleted_at : null, - 'links' => [ + 'fechaCreacion' => (string) $checkList_OpcionesCheckList->created_at, + 'fechaActualizacion' => (string) $checkList_OpcionesCheckList->updated_at, + 'fechaEliminacion' => isset($checkList_OpcionesCheckList->deleted_at) ? (string) $checkList_OpcionesCheckList->deleted_at : null, + 'links' => [ [ - 'rel' => 'self', + 'rel' => 'self', 'href' => route('checkList.show', $checkList_OpcionesCheckList->check_list_id), ], /*[ @@ -44,50 +46,54 @@ public function transform(CheckList_OpcionesCheckList $checkList_OpcionesCheckLi ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'valor1' => 'valor1', - 'valor2' => 'valor2', - 'valor3' => 'valor3', - 'valor4' => 'valor4', - 'valor5' => 'valor5', - 'valor6' => 'valor6', - 'valor7' => 'valor7', - 'valor8' => 'valor8', - 'valor9' => 'valor9', - 'valor10' => 'valor10', - 'tipo' => 'tipo', + 'id' => 'id', + 'valor1' => 'valor1', + 'valor2' => 'valor2', + 'valor3' => 'valor3', + 'valor4' => 'valor4', + 'valor5' => 'valor5', + 'valor6' => 'valor6', + 'valor7' => 'valor7', + 'valor8' => 'valor8', + 'valor9' => 'valor9', + 'valor10' => 'valor10', + 'tipo' => 'tipo', 'atributo' => 'atributo', - 'fechaCreacion' => 'created_at', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'valor1' => 'valor1', - 'valor2' => 'valor2', - 'valor3' => 'valor3', - 'valor4' => 'valor4', - 'valor5' => 'valor5', - 'valor6' => 'valor6', - 'valor7' => 'valor7', - 'valor8' => 'valor8', - 'valor9' => 'valor9', - 'valor10' => 'valor10', - 'tipo' => 'tipo', + 'id' => 'id', + 'valor1' => 'valor1', + 'valor2' => 'valor2', + 'valor3' => 'valor3', + 'valor4' => 'valor4', + 'valor5' => 'valor5', + 'valor6' => 'valor6', + 'valor7' => 'valor7', + 'valor8' => 'valor8', + 'valor9' => 'valor9', + 'valor10' => 'valor10', + 'tipo' => 'tipo', 'atributo' => 'atributo', - 'fechaCreacion' => 'created_at', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/ChecklistTransformer.php b/app/Transformers/ChecklistTransformer.php index 68a52038..d9fcf59c 100644 --- a/app/Transformers/ChecklistTransformer.php +++ b/app/Transformers/ChecklistTransformer.php @@ -1,7 +1,10 @@ (int)$checklist->id, - 'id_check_lists' => (string)$checklist->id_check_lists, - 'unik_check_lists' => (string)$checklist->unik_check_lists, - 'fechaCreacion' => (string)$checklist->created_at, - 'fechaActualizacion' => (string)$checklist->updated_at, - 'fechaEliminacion' => isset($checklist->deleted_at) ? (string) $checklist->deleted_at : null, - 'links' => [ + 'id' => (int) $checklist->id, + 'id_check_lists' => (string) $checklist->id_check_lists, + 'unik_check_lists' => (string) $checklist->unik_check_lists, + 'fechaCreacion' => (string) $checklist->created_at, + 'fechaActualizacion' => (string) $checklist->updated_at, + 'fechaEliminacion' => isset($checklist->deleted_at) ? (string) $checklist->deleted_at : null, + 'links' => [ [ - 'rel' => 'self', + 'rel' => 'self', 'href' => route('users.show', $checklist->user_id), ], [ - 'rel' => 'self', + 'rel' => 'self', 'href' => action('api\AreasController@show', ['id' => $checklist->area_id]), ], [ - 'rel' => 'self', + 'rel' => 'self', 'href' => action('api\EquiposController@show', ['id' => $checklist->equiposxm['id']]), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'id_check_lists' => 'id_check_lists', - 'unik_check_lists' => 'unik_check_lists', - 'fechaCreacion' => 'created_at', + 'id' => 'id', + 'id_check_lists' => 'id_check_lists', + 'unik_check_lists' => 'unik_check_lists', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'id_check_lists' => 'id_check_lists', - 'unik_check_lists' => 'unik_check_lists', - 'fechaCreacion' => 'created_at', + 'id' => 'id', + 'id_check_lists' => 'id_check_lists', + 'unik_check_lists' => 'unik_check_lists', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/CustodiosTransformer.php b/app/Transformers/CustodiosTransformer.php index 0b3079e6..ba0cb956 100644 --- a/app/Transformers/CustodiosTransformer.php +++ b/app/Transformers/CustodiosTransformer.php @@ -1,7 +1,10 @@ (string)$custodios->id, - 'nombre_responsable' => (string)$custodios->nombre_responsable, - 'pais' => (string)$custodios->pais, - 'ciudad' => (string)$custodios->ciudad, - 'direccion' => (string)$custodios->direccion, - 'documentoIdentificacion' => (string)$custodios->documentoIdentificacion, - 'cargo' => (string)$custodios->cargo, - 'compania' => (string)$custodios->compania, - 'telefono' => (string)$custodios->telefono, - 'estado' => (string)$custodios->estado, - 'celular' => (string)$custodios->celular, - 'ext' => (string)$custodios->ext, - 'fechaCreacion' => (string)$custodios->created_at, - 'fechaActualizacion' => (string)$custodios->updated_at, - 'fechaEliminacion' => isset($custodios->deleted_at) ? (string) $custodios->deleted_at : null, - 'image' => env('APP_URL').'/img/perfil/'.$custodios->image, - 'links' => [ + 'id' => (string) $custodios->id, + 'nombre_responsable' => (string) $custodios->nombre_responsable, + 'pais' => (string) $custodios->pais, + 'ciudad' => (string) $custodios->ciudad, + 'direccion' => (string) $custodios->direccion, + 'documentoIdentificacion' => (string) $custodios->documentoIdentificacion, + 'cargo' => (string) $custodios->cargo, + 'compania' => (string) $custodios->compania, + 'telefono' => (string) $custodios->telefono, + 'estado' => (string) $custodios->estado, + 'celular' => (string) $custodios->celular, + 'ext' => (string) $custodios->ext, + 'fechaCreacion' => (string) $custodios->created_at, + 'fechaActualizacion' => (string) $custodios->updated_at, + 'fechaEliminacion' => isset($custodios->deleted_at) ? (string) $custodios->deleted_at : null, + 'image' => env('APP_URL').'/img/perfil/'.$custodios->image, + 'links' => [ [ - 'rel' => 'custodios.puestos', + 'rel' => 'custodios.puestos', 'href' => route('custodios.puestos.index', $custodios), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'nombre_responsable' => 'nombre_responsable', - 'pais' => 'pais', - 'ciudad' => 'ciudad', - 'direccion' => 'direccion', + 'id' => 'id', + 'nombre_responsable' => 'nombre_responsable', + 'pais' => 'pais', + 'ciudad' => 'ciudad', + 'direccion' => 'direccion', 'documentoIdentificacion' => 'documentoIdentificacion', - 'cargo' => 'cargo', - 'compania' => 'compania', - 'telefono' => 'telefono', - 'estado' => 'estado', - 'celular' => 'celular', - 'ext' => 'ext', - 'image' => 'image', - 'fechaCreacion' => 'created_at', - 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'cargo' => 'cargo', + 'compania' => 'compania', + 'telefono' => 'telefono', + 'estado' => 'estado', + 'celular' => 'celular', + 'ext' => 'ext', + 'image' => 'image', + 'fechaCreacion' => 'created_at', + 'fechaActualizacion' => 'updated_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'nombre_responsable' => 'nombre_responsable', - 'pais' => 'pais', - 'ciudad' => 'ciudad', - 'direccion' => 'direccion', + 'id' => 'id', + 'nombre_responsable' => 'nombre_responsable', + 'pais' => 'pais', + 'ciudad' => 'ciudad', + 'direccion' => 'direccion', 'documentoIdentificacion' => 'documentoIdentificacion', - 'cargo' => 'cargo', - 'compania' => 'compania', - 'telefono' => 'telefono', - 'estado' => 'estado', - 'celular' => 'celular', - 'ext' => 'ext', - 'image' => 'image', - 'created_at' => 'fechaCreacion', - 'updated_at' => 'fechaActualizacion', - 'deleted_at' => 'fechaEliminacion', + 'cargo' => 'cargo', + 'compania' => 'compania', + 'telefono' => 'telefono', + 'estado' => 'estado', + 'celular' => 'celular', + 'ext' => 'ext', + 'image' => 'image', + 'created_at' => 'fechaCreacion', + 'updated_at' => 'fechaActualizacion', + 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/EmpresaTransformer.php b/app/Transformers/EmpresaTransformer.php index 4e1fe088..53227610 100644 --- a/app/Transformers/EmpresaTransformer.php +++ b/app/Transformers/EmpresaTransformer.php @@ -1,8 +1,10 @@ (string)$empresa->empresa, - 'fechaCreacion' => (string)$empresa->created_at, - 'fechaActualizacion' => (string)$empresa->updated_at, - 'fechaEliminacion' => isset($empresa->deleted_at) ? (string) $empresa->deleted_at : null, + 'empresa' => (string) $empresa->empresa, + 'fechaCreacion' => (string) $empresa->created_at, + 'fechaActualizacion' => (string) $empresa->updated_at, + 'fechaEliminacion' => isset($empresa->deleted_at) ? (string) $empresa->deleted_at : null, ]; } + public static function originalAttribute($index) { $attributes = [ - 'empresa' => 'empresa', - 'fechaCreacion' => 'created_at', + 'empresa' => 'empresa', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'empresa' => 'empresa', + 'empresa' => 'empresa', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/EquiposTransformer.php b/app/Transformers/EquiposTransformer.php index ed7c7982..888a0b10 100644 --- a/app/Transformers/EquiposTransformer.php +++ b/app/Transformers/EquiposTransformer.php @@ -1,8 +1,11 @@ (string)$equipos->id, - 'modelo_equipo_id' => (string)$equipos->modelo_equipo_id, - 'orden_de_compra_id' => (string)$equipos->orden_de_compra_id, - 'custodio_id' => (string)$equipos->custodio_id, - 'estacione_id' => (string)$equipos->estacione_id, - 'area_id' => (string)$equipos->area_id, - 'check_list_id' => (string)$equipos->check_list_id, - 'imagen' => (string)$equipos->imagen, - 'num_cajas' => (string)$equipos->num_cajas, - 'sociedad' => (string)$equipos->sociedad, + 'id' => (string) $equipos->id, + 'modelo_equipo_id' => (string) $equipos->modelo_equipo_id, + 'orden_de_compra_id' => (string) $equipos->orden_de_compra_id, + 'custodio_id' => (string) $equipos->custodio_id, + 'estacione_id' => (string) $equipos->estacione_id, + 'area_id' => (string) $equipos->area_id, + 'check_list_id' => (string) $equipos->check_list_id, + 'imagen' => (string) $equipos->imagen, + 'num_cajas' => (string) $equipos->num_cajas, + 'sociedad' => (string) $equipos->sociedad, - 'no_serie' => (string)$equipos->no_serie, - 'codigo_barras' => (string)$equipos->codigo_barras, - 'codigo_avianca' => (string)$equipos->codigo_avianca, - 'codigo_otro' => (string)$equipos->codigo_otro, - 'descripcion' => (string)$equipos->descripcion, + 'no_serie' => (string) $equipos->no_serie, + 'codigo_barras' => (string) $equipos->codigo_barras, + 'codigo_avianca' => (string) $equipos->codigo_avianca, + 'codigo_otro' => (string) $equipos->codigo_otro, + 'descripcion' => (string) $equipos->descripcion, - 'ip' => (string)$equipos->ip, - 'estado' => (string)$equipos->estado, - 'estatus' => (string)$equipos->estatus, - 'garantia' => (string)$equipos->garantia, - 'observaciones' => (string)$equipos->observaciones, + 'ip' => (string) $equipos->ip, + 'estado' => (string) $equipos->estado, + 'estatus' => (string) $equipos->estatus, + 'garantia' => (string) $equipos->garantia, + 'observaciones' => (string) $equipos->observaciones, - 'codigo_contable' => (string)$equipos->codigo_contable, - 'hp_warrantyLevel' => (string)$equipos->hp_warrantyLevel, - 'hp_endDate' => (string)$equipos->hp_endDate, - 'hp_displaySerialNumber' => (string)$equipos->hp_displaySerialNumber, - 'hp_modelNumber' => (string)$equipos->hp_modelNumber, + 'codigo_contable' => (string) $equipos->codigo_contable, + 'hp_warrantyLevel' => (string) $equipos->hp_warrantyLevel, + 'hp_endDate' => (string) $equipos->hp_endDate, + 'hp_displaySerialNumber' => (string) $equipos->hp_displaySerialNumber, + 'hp_modelNumber' => (string) $equipos->hp_modelNumber, - 'hp_countryOfPurchase' => (string)$equipos->hp_countryOfPurchase, - 'hp_newProduct_seriesName' => (string)$equipos->hp_newProduct_seriesName, - 'hp_newProduct_imageUrl' => (string)$equipos->hp_newProduct_imageUrl, - 'hp_warrantyResultRedirectUrl' => (string)$equipos->hp_warrantyResultRedirectUrl, + 'hp_countryOfPurchase' => (string) $equipos->hp_countryOfPurchase, + 'hp_newProduct_seriesName' => (string) $equipos->hp_newProduct_seriesName, + 'hp_newProduct_imageUrl' => (string) $equipos->hp_newProduct_imageUrl, + 'hp_warrantyResultRedirectUrl' => (string) $equipos->hp_warrantyResultRedirectUrl, - 'fechaCreacion' => (string)$equipos->created_at, - 'fechaActualizacion' => (string)$equipos->updated_at, - 'fechaEliminacion' => isset($equipos->deleted_at) ? (string) $equipos->deleted_at : null, + 'fechaCreacion' => (string) $equipos->created_at, + 'fechaActualizacion' => (string) $equipos->updated_at, + 'fechaEliminacion' => isset($equipos->deleted_at) ? (string) $equipos->deleted_at : null, 'links' => [ [ - 'rel' => 'custodios.puestos', + 'rel' => 'custodios.puestos', 'href' => route('custodios.puestos.index', $equipos), ], [ - 'rel' => 'equipos.checkList', + 'rel' => 'equipos.checkList', 'href' => route('equipos.checkList.index', $equipos), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'id' => 'id', - 'modelo_equipo_id' => 'modelo_equipo_id', - 'orden_de_compra_id' => 'orden_de_compra_id', - 'custodio_id' => 'custodio_id', - 'estacione_id' => 'estacione_id', - 'area_id' => 'area_id', - 'check_list_id' => 'check_list_id', - 'imagen' => 'imagen', - 'num_cajas' => 'num_cajas', - 'sociedad' => 'sociedad', - 'no_serie' => 'no_serie', - 'codigo_barras' => 'codigo_barras', - 'codigo_avianca' => 'codigo_avianca', - 'codigo_otro' => 'codigo_otro', - 'descripcion' => 'descripcion', - 'ip' => 'ip', - 'estado' => 'estado', - 'estatus' => 'estatus', - 'garantia' => 'garantia', - 'observaciones' => 'observaciones', - 'codigo_contable' => 'codigo_contable', - 'hp_warrantyLevel' => 'hp_warrantyLevel', - 'hp_endDate' => 'hp_endDate', - 'hp_displaySerialNumber' => 'hp_displaySerialNumber', - 'hp_modelNumber' => 'hp_modelNumber', - 'hp_countryOfPurchase' => 'hp_countryOfPurchase', - 'hp_newProduct_seriesName' => 'hp_newProduct_seriesName', - 'hp_newProduct_imageUrl' => 'hp_newProduct_imageUrl', + 'id' => 'id', + 'modelo_equipo_id' => 'modelo_equipo_id', + 'orden_de_compra_id' => 'orden_de_compra_id', + 'custodio_id' => 'custodio_id', + 'estacione_id' => 'estacione_id', + 'area_id' => 'area_id', + 'check_list_id' => 'check_list_id', + 'imagen' => 'imagen', + 'num_cajas' => 'num_cajas', + 'sociedad' => 'sociedad', + 'no_serie' => 'no_serie', + 'codigo_barras' => 'codigo_barras', + 'codigo_avianca' => 'codigo_avianca', + 'codigo_otro' => 'codigo_otro', + 'descripcion' => 'descripcion', + 'ip' => 'ip', + 'estado' => 'estado', + 'estatus' => 'estatus', + 'garantia' => 'garantia', + 'observaciones' => 'observaciones', + 'codigo_contable' => 'codigo_contable', + 'hp_warrantyLevel' => 'hp_warrantyLevel', + 'hp_endDate' => 'hp_endDate', + 'hp_displaySerialNumber' => 'hp_displaySerialNumber', + 'hp_modelNumber' => 'hp_modelNumber', + 'hp_countryOfPurchase' => 'hp_countryOfPurchase', + 'hp_newProduct_seriesName' => 'hp_newProduct_seriesName', + 'hp_newProduct_imageUrl' => 'hp_newProduct_imageUrl', 'hp_warrantyResultRedirectUrl' => 'hp_warrantyResultRedirectUrl', - 'fechaCreacion' => 'created_at', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'id', - 'modelo_equipo_id' => 'modelo_equipo_id', - 'orden_de_compra_id' => 'orden_de_compra_id', - 'custodio_id' => 'custodio_id', - 'estacione_id' => 'estacione_id', - 'area_id' => 'area_id', - 'check_list_id' => 'check_list_id', - 'imagen' => 'imagen', - 'num_cajas' => 'num_cajas', - 'sociedad' => 'sociedad', - 'no_serie' => 'no_serie', - 'codigo_barras' => 'codigo_barras', - 'codigo_avianca' => 'codigo_avianca', - 'codigo_otro' => 'codigo_otro', - 'descripcion' => 'descripcion', - 'ip' => 'ip', - 'estado' => 'estado', - 'estatus' => 'estatus', - 'garantia' => 'garantia', - 'observaciones' => 'observaciones', - 'codigo_contable' => 'codigo_contable', - 'hp_warrantyLevel' => 'hp_warrantyLevel', - 'hp_endDate' => 'hp_endDate', - 'hp_displaySerialNumber' => 'hp_displaySerialNumber', - 'hp_modelNumber' => 'hp_modelNumber', - 'hp_countryOfPurchase' => 'hp_countryOfPurchase', - 'hp_newProduct_seriesName' => 'hp_newProduct_seriesName', - 'hp_newProduct_imageUrl' => 'hp_newProduct_imageUrl', + 'id' => 'id', + 'modelo_equipo_id' => 'modelo_equipo_id', + 'orden_de_compra_id' => 'orden_de_compra_id', + 'custodio_id' => 'custodio_id', + 'estacione_id' => 'estacione_id', + 'area_id' => 'area_id', + 'check_list_id' => 'check_list_id', + 'imagen' => 'imagen', + 'num_cajas' => 'num_cajas', + 'sociedad' => 'sociedad', + 'no_serie' => 'no_serie', + 'codigo_barras' => 'codigo_barras', + 'codigo_avianca' => 'codigo_avianca', + 'codigo_otro' => 'codigo_otro', + 'descripcion' => 'descripcion', + 'ip' => 'ip', + 'estado' => 'estado', + 'estatus' => 'estatus', + 'garantia' => 'garantia', + 'observaciones' => 'observaciones', + 'codigo_contable' => 'codigo_contable', + 'hp_warrantyLevel' => 'hp_warrantyLevel', + 'hp_endDate' => 'hp_endDate', + 'hp_displaySerialNumber' => 'hp_displaySerialNumber', + 'hp_modelNumber' => 'hp_modelNumber', + 'hp_countryOfPurchase' => 'hp_countryOfPurchase', + 'hp_newProduct_seriesName' => 'hp_newProduct_seriesName', + 'hp_newProduct_imageUrl' => 'hp_newProduct_imageUrl', 'hp_warrantyResultRedirectUrl' => 'hp_warrantyResultRedirectUrl', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/InformeMantenimientoPreventivoTransformer.php b/app/Transformers/InformeMantenimientoPreventivoTransformer.php index 147269d1..1819e573 100644 --- a/app/Transformers/InformeMantenimientoPreventivoTransformer.php +++ b/app/Transformers/InformeMantenimientoPreventivoTransformer.php @@ -14,25 +14,25 @@ class InformeMantenimientoPreventivoTransformer extends TransformerAbstract public function transform(\App\InformeMantenimientoPreventivo $info) { return [ - 'id' => (int)$info->id, - 'custodio_id' => (string)$info->custodio_id, - 'area_id' => (string)$info->area_id, - 'no_orden' => (string)$info->no_orden, - 'fecha_solicitud' => (string)$info->fecha_solicitud, - 'fecha_ejecucion' => (string)$info->fecha_ejecucion, - 'hora_inicio' => (string)$info->hora_inicio, - 'hora_fin' => (string)$info->hora_fin, - 'informe_manto_prev_cate_id' => (int)$info->informe_manto_prev_cate_id, - 'requerimiento' => (string)$info->requerimiento, - 'solucion' => (string)$info->solucion, - 'resolucion' => (string)$info->resolucion, - - 'fechaCreacion' => (string)$info->created_at, - 'fechaActualizacion' => (string)$info->updated_at, - 'fechaEliminacion' => isset($info->deleted_at) ? (string) $info->deleted_at : null, - 'links' => [ + 'id' => (int) $info->id, + 'custodio_id' => (string) $info->custodio_id, + 'area_id' => (string) $info->area_id, + 'no_orden' => (string) $info->no_orden, + 'fecha_solicitud' => (string) $info->fecha_solicitud, + 'fecha_ejecucion' => (string) $info->fecha_ejecucion, + 'hora_inicio' => (string) $info->hora_inicio, + 'hora_fin' => (string) $info->hora_fin, + 'informe_manto_prev_cate_id' => (int) $info->informe_manto_prev_cate_id, + 'requerimiento' => (string) $info->requerimiento, + 'solucion' => (string) $info->solucion, + 'resolucion' => (string) $info->resolucion, + + 'fechaCreacion' => (string) $info->created_at, + 'fechaActualizacion' => (string) $info->updated_at, + 'fechaEliminacion' => isset($info->deleted_at) ? (string) $info->deleted_at : null, + 'links' => [ [ - 'rel' => 'self', + 'rel' => 'self', 'href' => route('info.show', $info->id), ], ], diff --git a/app/Transformers/PuestoCustodiosTransformer.php b/app/Transformers/PuestoCustodiosTransformer.php index 6409866f..d9c902c4 100644 --- a/app/Transformers/PuestoCustodiosTransformer.php +++ b/app/Transformers/PuestoCustodiosTransformer.php @@ -1,7 +1,10 @@ (string)$puesto->fecha_inicio, - 'fecha_fin' => (string)$puesto->fecha_fin, - 'horas_trabajadas' => (string)$puesto->horas_trabajadas, - 'fechaCreacion' => (string)$puesto->created_at, - 'fechaActualizacion' => (string)$puesto->updated_at, - 'fechaEliminacion' => isset($puesto->deleted_at) ? (string) $puesto->deleted_at : null, - 'links' => [ + 'fecha_inicio' => (string) $puesto->fecha_inicio, + 'fecha_fin' => (string) $puesto->fecha_fin, + 'horas_trabajadas' => (string) $puesto->horas_trabajadas, + 'fechaCreacion' => (string) $puesto->created_at, + 'fechaActualizacion' => (string) $puesto->updated_at, + 'fechaEliminacion' => isset($puesto->deleted_at) ? (string) $puesto->deleted_at : null, + 'links' => [ [ - 'rel' => 'custodios', + 'rel' => 'custodios', 'href' => route('custodios.show', $puesto->custodio_id), ], [ - 'rel' => 'puestos', + 'rel' => 'puestos', 'href' => route('puestos.show', $puesto->puesto_id), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'fecha_inicio' => 'fecha_inicio', - 'fecha_fin' => 'fecha_fin', - 'horas_trabajadas' => 'horas_trabajadas', - 'fechaCreacion' => 'created_at', + 'fecha_inicio' => 'fecha_inicio', + 'fecha_fin' => 'fecha_fin', + 'horas_trabajadas' => 'horas_trabajadas', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'fecha_inicio' => 'fecha_inicio', - 'fecha_fin' => 'fecha_fin', + 'fecha_inicio' => 'fecha_inicio', + 'fecha_fin' => 'fecha_fin', 'horas_trabajadas' => 'horas_trabajadas', - 'created_at' => 'fechaCreacion', - 'updated_at' => 'fechaActualizacion', - 'deleted_at' => 'fechaEliminacion', + 'created_at' => 'fechaCreacion', + 'updated_at' => 'fechaActualizacion', + 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/PuestoTransformer.php b/app/Transformers/PuestoTransformer.php index 57db8fc3..32221e5c 100644 --- a/app/Transformers/PuestoTransformer.php +++ b/app/Transformers/PuestoTransformer.php @@ -1,7 +1,10 @@ (string)$puesto->codigo, - 'detalle' => (string)$puesto->detalle, - 'x' => (int)$puesto->x, - 'y' => (int)$puesto->y, - 'ocupado' => ($puesto->estado == 'OCUPADO'), - 'reservado' => ($puesto->estado == 'RESERVADO'), - 'libre' => ($puesto->estado == 'LIBRE'), - 'fechaCreacion' => (string)$puesto->created_at, - 'fechaActualizacion' => (string)$puesto->updated_at, - 'fechaEliminacion' => isset($puesto->deleted_at) ? (string) $puesto->deleted_at : null, - 'links' => [ + 'codigo' => (string) $puesto->codigo, + 'detalle' => (string) $puesto->detalle, + 'x' => (int) $puesto->x, + 'y' => (int) $puesto->y, + 'ocupado' => ($puesto->estado == 'OCUPADO'), + 'reservado' => ($puesto->estado == 'RESERVADO'), + 'libre' => ($puesto->estado == 'LIBRE'), + 'fechaCreacion' => (string) $puesto->created_at, + 'fechaActualizacion' => (string) $puesto->updated_at, + 'fechaEliminacion' => isset($puesto->deleted_at) ? (string) $puesto->deleted_at : null, + 'links' => [ [ - 'rel' => 'puestos.custodios', + 'rel' => 'puestos.custodios', 'href' => route('puestos.custodios.index', $puesto), ], [ - 'rel' => 'ubicacions', + 'rel' => 'ubicacions', 'href' => route('ubicacions.show', $puesto->ubicacions['id']), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'codigo' => 'codigo', - 'detalle' => 'detalle', - 'x' => 'x', - 'y' => 'y', - 'estado' => 'estado', - 'fechaCreacion' => 'created_at', + 'codigo' => 'codigo', + 'detalle' => 'detalle', + 'x' => 'x', + 'y' => 'y', + 'estado' => 'estado', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'codigo' => 'codigo', - 'detalle' => 'detalle', - 'x' => 'x', - 'y' => 'y', - 'estado' => 'estado', + 'codigo' => 'codigo', + 'detalle' => 'detalle', + 'x' => 'x', + 'y' => 'y', + 'estado' => 'estado', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/UbicacionTransformer.php b/app/Transformers/UbicacionTransformer.php index 93d39198..81b971c6 100644 --- a/app/Transformers/UbicacionTransformer.php +++ b/app/Transformers/UbicacionTransformer.php @@ -1,8 +1,10 @@ (string)$ubicacion->edificio, - 'piso' => (string)$ubicacion->piso, - 'imagen' => env('APP_URL').'/img/perfil/'.$ubicacion->imagen, - 'fechaCreacion' => (string)$ubicacion->created_at, - 'fechaActualizacion' => (string)$ubicacion->updated_at, - 'fechaEliminacion' => isset($ubicacion->deleted_at) ? (string) $ubicacion->deleted_at : null, - 'links' => [ + 'edificio' => (string) $ubicacion->edificio, + 'piso' => (string) $ubicacion->piso, + 'imagen' => env('APP_URL').'/img/perfil/'.$ubicacion->imagen, + 'fechaCreacion' => (string) $ubicacion->created_at, + 'fechaActualizacion' => (string) $ubicacion->updated_at, + 'fechaEliminacion' => isset($ubicacion->deleted_at) ? (string) $ubicacion->deleted_at : null, + 'links' => [ [ - 'rel' => 'puestos.custodios', + 'rel' => 'puestos.custodios', 'href' => route('puestos.custodios.index', $ubicacion), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'edificio' => 'edificio', - 'piso' => 'piso', - 'imagen' => 'imagen', - 'fechaCreacion' => 'created_at', + 'edificio' => 'edificio', + 'piso' => 'piso', + 'imagen' => 'imagen', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'edificio' => 'edificio', - 'piso' => 'piso', - 'imagen' => 'imagen', + 'edificio' => 'edificio', + 'piso' => 'piso', + 'imagen' => 'imagen', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 15fb4bd1..cd61e645 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -1,7 +1,10 @@ (int)$user->id, - 'nombre' => (string)$user->name, - 'correo' => (string)$user->email, - 'esVerificado' => ($user->rol != 'registrado'), - 'esAdministrador' => ($user->rol === 'administrador'), - 'fechaCreacion' => (string)$user->created_at, - 'fechaActualizacion' => (string)$user->updated_at, - 'fechaEliminacion' => isset($user->deleted_at) ? (string) $user->deleted_at : null, - 'links' => [ + 'identificador' => (int) $user->id, + 'nombre' => (string) $user->name, + 'correo' => (string) $user->email, + 'esVerificado' => ($user->rol != 'registrado'), + 'esAdministrador' => ($user->rol === 'administrador'), + 'fechaCreacion' => (string) $user->created_at, + 'fechaActualizacion' => (string) $user->updated_at, + 'fechaEliminacion' => isset($user->deleted_at) ? (string) $user->deleted_at : null, + 'links' => [ [ - 'rel' => 'self', + 'rel' => 'self', 'href' => route('users.show', $user->id), ], ], ]; } + public static function originalAttribute($index) { $attributes = [ - 'identificador' => 'id', - 'nombre' => 'name', - 'correo' => 'email', - 'esVerificado' => 'verified', - 'esAdministrador' => 'admin', - 'fechaCreacion' => 'created_at', + 'identificador' => 'id', + 'nombre' => 'name', + 'correo' => 'email', + 'esVerificado' => 'verified', + 'esAdministrador' => 'admin', + 'fechaCreacion' => 'created_at', 'fechaActualizacion' => 'updated_at', - 'fechaEliminacion' => 'deleted_at', + 'fechaEliminacion' => 'deleted_at', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } + public static function transformedAttribute($index) { $attributes = [ - 'id' => 'identificador', - 'name' => 'nombre', - 'email' => 'correo', - 'verified' => 'esVerificado', - 'admin' => 'esAdministrador', + 'id' => 'identificador', + 'name' => 'nombre', + 'email' => 'correo', + 'verified' => 'esVerificado', + 'admin' => 'esAdministrador', 'created_at' => 'fechaCreacion', 'updated_at' => 'fechaActualizacion', 'deleted_at' => 'fechaEliminacion', ]; + return isset($attributes[$index]) ? $attributes[$index] : null; } -} \ No newline at end of file +} diff --git a/app/Ubicacion.php b/app/Ubicacion.php index 293f085b..dd2f758b 100644 --- a/app/Ubicacion.php +++ b/app/Ubicacion.php @@ -21,35 +21,33 @@ class Ubicacion extends Model * garantia enum('SI', 'NO') * */ - public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM ubicacions WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM ubicacions 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 estacionxc() { return $this->hasOne('App\Estaciones', 'id', 'estacione_id'); } + public function areaxc() { return $this->hasOne('App\Areas', 'id', 'area_id'); } + public function puestosxc() { - return $this->hasMany('App\Puesto', 'ubicacion_id', 'id'); } - - } diff --git a/app/User.php b/app/User.php index 49901499..0e2a8505 100644 --- a/app/User.php +++ b/app/User.php @@ -3,12 +3,12 @@ namespace App; use App\Notifications\MyOwnResetPassword; -use Laravel\Passport\HasApiTokens; use App\Transformers\UserTransformer; -use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\DB; +use Laravel\Passport\HasApiTokens; use Mpociot\Firebase\SyncsWithFirebase; class User extends Authenticatable @@ -16,20 +16,18 @@ class User extends Authenticatable use Notifiable, HasApiTokens, SoftDeletes; use SyncsWithFirebase; - - public $transformer = UserTransformer::class; + public $transformer = UserTransformer::class; const USUARIO_VERIFICADO = '1'; const USUARIO_NO_VERIFICADO = '0'; - /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ - 'name','first_name','last_name','rol','username','password','email','verification_token','token','facebook_user_id','empresa','verified' + 'name', 'first_name', 'last_name', 'rol', 'username', 'password', 'email', 'verification_token', 'token', 'facebook_user_id', 'empresa', 'verified', ]; /** @@ -41,26 +39,28 @@ class User extends Authenticatable 'password', 'remember_token', ]; protected static $graph_node_field_aliases = [ - 'id' => 'facebook_user_id', - 'name' => 'name', - 'email' => 'email', - 'email' => 'username', - 'FirstName' => 'first_name', + 'id' => 'facebook_user_id', + 'name' => 'name', + 'email' => 'email', + 'email' => 'username', + 'FirstName' => 'first_name', 'MiddleName' => 'last_name', ]; + public static function getENUM($tabla) { - $type = DB::select( DB::raw("SHOW COLUMNS FROM users WHERE Field = '".$tabla."'") )[0]->Type; + $type = DB::select(DB::raw("SHOW COLUMNS FROM users WHERE Field = '".$tabla."'"))[0]->Type; preg_match('/^enum\((.*)\)$/', $type, $matches); - $enum = array(); - $enumerado = explode(',', $matches[1]); - foreach($enumerado as $value ) - { - $v = trim( $value, "'" ); + $enum = []; + $enumerado = explode(',', $matches[1]); + foreach ($enumerado as $value) { + $v = trim($value, "'"); $enum = array_add($enum, $v, $v); } + return $enum; } + public static function generarVerificationToken() { return str_random(36); @@ -71,10 +71,12 @@ public function setNameAttribute($valor) { $this->attributes['name'] = strtolower($valor); } + public function getNameAttribute($valor) { return ucwords($valor); } + public function setEmailAttribute($valor) { $this->attributes['email'] = strtolower($valor); @@ -84,29 +86,33 @@ public function empresaxc() { return $this->hasOne('App\Empresa', 'empresa', 'empresa'); } + //////////////////////////////////////////////fin mutwadores + /** * Send the password reset notification. * - * @param string $token + * @param string $token + * * @return void */ public function sendPasswordResetNotification($token) { $this->notify(new MyOwnResetPassword($token)); } + public function esVerificado() { - return $this->verified == User::USUARIO_VERIFICADO; + return $this->verified == self::USUARIO_VERIFICADO; } - public function getEmpresa(){ + + public function getEmpresa() + { return $this->empresa; } public function roles() { - - return $this->belongsToMany('App\Rol', 'usuariorols' )->using('App\Usuariorol'); + return $this->belongsToMany('App\Rol', 'usuariorols')->using('App\Usuariorol'); } - } diff --git a/app/Usuariorol.php b/app/Usuariorol.php index 2fb8c6b3..9e37b2bd 100644 --- a/app/Usuariorol.php +++ b/app/Usuariorol.php @@ -2,7 +2,6 @@ namespace App; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; @@ -23,6 +22,7 @@ public function users() { return $this->belongsTo('App\User'); } + public function rols() { return $this->belongsTo('App\Rol'); diff --git a/bootstrap/app.php b/bootstrap/app.php index 03fd3e98..857fca4f 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -14,9 +14,8 @@ $app = new Illuminate\Foundation\Application( realpath(__DIR__.'/../') ); -$app->bind('path.public', function () -{ - return base_path() . '/html'; +$app->bind('path.public', function () { + return base_path().'/html'; }); /* |-------------------------------------------------------------------------- diff --git a/config/adminlte.php b/config/adminlte.php index d8acba71..b67c690f 100644 --- a/config/adminlte.php +++ b/config/adminlte.php @@ -39,6 +39,6 @@ | The name of the seeder to add admin user to database. */ - 'AdminUserSeeder' => 'AdminUserSeeder.php' + 'AdminUserSeeder' => 'AdminUserSeeder.php', ]; diff --git a/config/app.php b/config/app.php index 27b484b0..698cd0c8 100644 --- a/config/app.php +++ b/config/app.php @@ -198,44 +198,41 @@ *excel */ Maatwebsite\Excel\ExcelServiceProvider::class, - /** + /* *collection */ /* *spatie/laravel-fractal - */ + */ Spatie\Fractal\FractalServiceProvider::class, - /** + /* *menu services solo php 7 */ //Spatie\Menu\Laravel\MenuServiceProvider::class, - /** + /* * pusher */ //Vinkla\Pusher\PusherServiceProvider::class - /** + /* * imagen */ Intervention\Image\ImageServiceProvider::class, - /** + /* * 'fin imagen */ - /** + /* * CORS Middleware for Laravel 5 */ Barryvdh\Cors\ServiceProvider::class, - /** + /* * https://www.simplesoftware.io/docs/simple-qrcode */ SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class, - /** + /* * composer require milon/barcode */ Milon\Barcode\BarcodeServiceProvider::class, - - - ], /* @@ -251,39 +248,39 @@ 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, /* * Acacha AdminLTE template alias @@ -302,29 +299,29 @@ // ... 'Excel' => Maatwebsite\Excel\Facades\Excel::class, - + 'Uuid' => Webpatser\Uuid\Uuid::class, /* *spatie/laravel-fractal */ 'Fractal' => Spatie\Fractal\FractalFacade::class, - /** + /* *menu services solo php 7 */ //'Menu' => Spatie\Menu\Laravel\MenuFacade::class, - /** + /* * pusher */ //'Pusher' => Vinkla\Pusher\Facades\Pusher::class, - /** + /* * imagen */ 'Image' => Intervention\Image\Facades\Image::class, - /** + /* * https://www.simplesoftware.io/docs/simple-qrcode */ 'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class, - /** + /* * composer require milon/barcode */ 'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class, diff --git a/config/auth.php b/config/auth.php index f8a1194b..3b50d4c1 100644 --- a/config/auth.php +++ b/config/auth.php @@ -14,7 +14,7 @@ */ 'defaults' => [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -37,12 +37,12 @@ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'api' => [ - 'driver' => 'passport', + 'driver' => 'passport', 'provider' => 'users', ], ], @@ -67,7 +67,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\User::class, + 'model' => App\User::class, ], // 'users' => [ @@ -94,8 +94,8 @@ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, ], ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 5eecd2b2..2f417296 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -31,17 +31,17 @@ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index e87f0320..b12eff52 100644 --- a/config/cache.php +++ b/config/cache.php @@ -39,20 +39,20 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], @@ -61,15 +61,15 @@ ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cors.php b/config/cors.php index 071ae48e..0f46cfc3 100644 --- a/config/cors.php +++ b/config/cors.php @@ -11,12 +11,12 @@ | to accept any value. | */ - + 'supportsCredentials' => false, - 'allowedOrigins' => ['*'], - 'allowedHeaders' => ['*'], - 'allowedMethods' => ['*'], - 'exposedHeaders' => [], - 'maxAge' => 0, + 'allowedOrigins' => ['*'], + 'allowedHeaders' => ['*'], + 'allowedMethods' => ['*'], + 'exposedHeaders' => [], + 'maxAge' => 0, ]; diff --git a/config/database.php b/config/database.php index d144a55e..d73aa123 100644 --- a/config/database.php +++ b/config/database.php @@ -34,45 +34,45 @@ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', + 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'prefix' => '', ], 'sqlite_testing' => [ - 'driver' => 'sqlite', + 'driver' => 'sqlite', 'database' => env('DB_DATABASE_TESTING', database_path('testing.database.sqlite')), - 'prefix' => '', + 'prefix' => '', ], 'mysql' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), /*'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci',*/ - 'charset' => 'utf8', + 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false,/*true,*/ - 'engine' => null, + 'prefix' => '', + 'strict' => false, /*true,*/ + 'engine' => null, ], 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), + 'driver' => 'pgsql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - 'sslmode' => 'prefer', + 'charset' => 'utf8', + 'prefix' => '', + 'schema' => 'public', + 'sslmode' => 'prefer', ], ], @@ -106,9 +106,9 @@ 'client' => 'predis', 'default' => [ - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), + 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], diff --git a/config/dompdf.php b/config/dompdf.php index 09a41ed6..443044c1 100644 --- a/config/dompdf.php +++ b/config/dompdf.php @@ -1,6 +1,6 @@ false, // Throw an Exception on warnings from dompdf - 'orientation' => 'portrait', - 'defines' => array( - /** + 'orientation' => 'portrait', + 'defines' => [ + /* * The location of the DOMPDF font directory * * The location of the directory where DOMPDF will store fonts and font metrics @@ -38,9 +38,9 @@ * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic, * Symbol, ZapfDingbats. */ - "DOMPDF_FONT_DIR" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) + 'DOMPDF_FONT_DIR' => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) - /** + /* * The location of the DOMPDF font cache directory * * This directory contains the cached font metrics for the fonts used by DOMPDF. @@ -48,18 +48,18 @@ * * Note: This directory must exist and be writable by the webserver process. */ - "DOMPDF_FONT_CACHE" => storage_path('fonts/'), + 'DOMPDF_FONT_CACHE' => storage_path('fonts/'), - /** + /* * The location of a temporary directory. * * The directory specified must be writeable by the webserver process. * The temporary directory is required to download remote images and when * using the PFDLib back end. */ - "DOMPDF_TEMP_DIR" => sys_get_temp_dir(), + 'DOMPDF_TEMP_DIR' => sys_get_temp_dir(), - /** + /* * ==== IMPORTANT ==== * * dompdf's "chroot": Prevents dompdf from accessing system files or other @@ -71,9 +71,9 @@ * direct class use like: * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); */ - "DOMPDF_CHROOT" => realpath(base_path()), + 'DOMPDF_CHROOT' => realpath(base_path()), - /** + /* * Whether to use Unicode fonts or not. * * When set to true the PDF backend must be set to "CPDF" and fonts must be @@ -82,14 +82,14 @@ * When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a * document must be present in your fonts, however. */ - "DOMPDF_UNICODE_ENABLED" => true, + 'DOMPDF_UNICODE_ENABLED' => true, - /** + /* * Whether to enable font subsetting or not. */ - "DOMPDF_ENABLE_FONT_SUBSETTING" => false, + 'DOMPDF_ENABLE_FONT_SUBSETTING' => false, - /** + /* * The PDF rendering backend to use * * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and @@ -117,9 +117,9 @@ * @link http://www.ros.co.nz/pdf * @link http://www.php.net/image */ - "DOMPDF_PDF_BACKEND" => "CPDF", + 'DOMPDF_PDF_BACKEND' => 'CPDF', - /** + /* * PDFlib license key * * If you are using a licensed, commercial version of PDFlib, specify @@ -133,7 +133,7 @@ */ //"DOMPDF_PDFLIB_LICENSE" => "your license key here", - /** + /* * html target media view which should be rendered into pdf. * List of types and parsing rules for future extensions: * http://www.w3.org/TR/REC-html40/types.html @@ -143,26 +143,26 @@ * the desired content might be different (e.g. screen or projection view of html file). * Therefore allow specification of content here. */ - "DOMPDF_DEFAULT_MEDIA_TYPE" => "screen", + 'DOMPDF_DEFAULT_MEDIA_TYPE' => 'screen', - /** + /* * The default paper size. * * North America standard is "letter"; other countries generally "a4" * * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) */ - "DOMPDF_DEFAULT_PAPER_SIZE" => "a4", + 'DOMPDF_DEFAULT_PAPER_SIZE' => 'a4', - /** + /* * The default font family * * Used if no suitable fonts can be found. This must exist in the font folder. * @var string */ - "DOMPDF_DEFAULT_FONT" => "serif", + 'DOMPDF_DEFAULT_FONT' => 'serif', - /** + /* * Image DPI setting * * This setting determines the default DPI setting for images and fonts. The @@ -195,9 +195,9 @@ * * @var int */ - "DOMPDF_DPI" => 96, + 'DOMPDF_DPI' => 96, - /** + /* * Enable inline PHP * * If this setting is set to true then DOMPDF will automatically evaluate @@ -209,9 +209,9 @@ * * @var bool */ - "DOMPDF_ENABLE_PHP" => false, + 'DOMPDF_ENABLE_PHP' => false, - /** + /* * Enable inline Javascript * * If this setting is set to true then DOMPDF will automatically insert @@ -219,9 +219,9 @@ * * @var bool */ - "DOMPDF_ENABLE_JAVASCRIPT" => true, + 'DOMPDF_ENABLE_JAVASCRIPT' => true, - /** + /* * Enable remote file access * * If this setting is set to true, DOMPDF will access remote sites for @@ -238,29 +238,26 @@ * * @var bool */ - "DOMPDF_ENABLE_REMOTE" => true, + 'DOMPDF_ENABLE_REMOTE' => true, - /** + /* * A ratio applied to the fonts height to be more like browsers' line height */ - "DOMPDF_FONT_HEIGHT_RATIO" => 1.1, + 'DOMPDF_FONT_HEIGHT_RATIO' => 1.1, - /** + /* * Enable CSS float * * Allows people to disabled CSS float support * @var bool */ - "DOMPDF_ENABLE_CSS_FLOAT" => false, + 'DOMPDF_ENABLE_CSS_FLOAT' => false, - - /** + /* * Use the more-than-experimental HTML5 Lib parser */ - "DOMPDF_ENABLE_HTML5PARSER" => false, - - - ), + 'DOMPDF_ENABLE_HTML5PARSER' => false, + ], -); +]; diff --git a/config/excel.php b/config/excel.php index 89486d5b..7fd7a8b8 100644 --- a/config/excel.php +++ b/config/excel.php @@ -1,6 +1,6 @@ [ @@ -32,7 +32,7 @@ 'settings' => [ 'memoryCacheSize' => '32MB', - 'cacheTime' => 600 + 'cacheTime' => 600, ], @@ -54,7 +54,7 @@ |-------------------------------------------------------------------------- */ - 'dir' => storage_path('cache') + 'dir' => storage_path('cache'), ], 'properties' => [ @@ -142,7 +142,7 @@ |-------------------------------------------------------------------------- */ - 'use_bom' => false + 'use_bom' => false, ], 'export' => [ @@ -253,7 +253,7 @@ | Apply strict comparison when testing for null values in the array |-------------------------------------------------------------------------- */ - 'strictNullComparison' => false + 'strictNullComparison' => false, ], /* @@ -282,7 +282,7 @@ | Whether we want to return information about the stored file or not | */ - 'returnInfo' => false + 'returnInfo' => false, ], @@ -314,7 +314,7 @@ |-------------------------------------------------------------------------- */ 'DomPDF' => [ - 'path' => base_path('vendor/dompdf/dompdf/') + 'path' => base_path('vendor/dompdf/dompdf/'), ], /* @@ -323,7 +323,7 @@ |-------------------------------------------------------------------------- */ 'tcPDF' => [ - 'path' => base_path('vendor/tecnick.com/tcpdf/') + 'path' => base_path('vendor/tecnick.com/tcpdf/'), ], /* @@ -332,10 +332,10 @@ |-------------------------------------------------------------------------- */ 'mPDF' => [ - 'path' => base_path('vendor/mpdf/mpdf/') + 'path' => base_path('vendor/mpdf/mpdf/'), ], - ] - ] + ], + ], ], 'filters' => [ @@ -346,7 +346,7 @@ */ 'registered' => [ - 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' + 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter', ], /* @@ -355,7 +355,7 @@ |-------------------------------------------------------------------------- */ - 'enabled' => [] + 'enabled' => [], ], 'import' => [ @@ -439,7 +439,7 @@ 'encoding' => [ 'input' => 'UTF-8', - 'output' => 'UTF-8' + 'output' => 'UTF-8', ], @@ -511,7 +511,7 @@ | Date columns |-------------------------------------------------------------------------- */ - 'columns' => [] + 'columns' => [], ], /* @@ -532,11 +532,11 @@ 'test' => [ - 'firstname' => 'A2' + 'firstname' => 'A2', - ] + ], - ] + ], ], 'views' => [ @@ -561,7 +561,7 @@ 'font' => [ 'bold' => true, 'size' => 12, - ] + ], ], /* @@ -573,7 +573,7 @@ 'font' => [ 'bold' => true, 'size' => 12, - ] + ], ], /* @@ -585,7 +585,7 @@ 'font' => [ 'bold' => true, 'size' => 12, - ] + ], ], /* @@ -597,7 +597,7 @@ 'font' => [ 'italic' => true, 'size' => 12, - ] + ], ], /* @@ -609,7 +609,7 @@ 'font' => [ 'bold' => true, 'size' => 24, - ] + ], ], /* @@ -621,7 +621,7 @@ 'font' => [ 'bold' => true, 'size' => 18, - ] + ], ], /* @@ -633,7 +633,7 @@ 'font' => [ 'bold' => true, 'size' => 13.5, - ] + ], ], /* @@ -645,7 +645,7 @@ 'font' => [ 'bold' => true, 'size' => 12, - ] + ], ], /* @@ -657,7 +657,7 @@ 'font' => [ 'bold' => true, 'size' => 10, - ] + ], ], /* @@ -669,7 +669,7 @@ 'font' => [ 'bold' => true, 'size' => 7.5, - ] + ], ], /* @@ -681,7 +681,7 @@ 'font' => [ 'underline' => true, 'color' => ['argb' => 'FF0000FF'], - ] + ], ], /* @@ -693,12 +693,12 @@ 'borders' => [ 'bottom' => [ 'style' => 'thin', - 'color' => ['FF000000'] + 'color' => ['FF000000'], ], - ] - ] - ] + ], + ], + ], - ] + ], -); +]; diff --git a/config/filesystems.php b/config/filesystems.php index d091e15a..aecba252 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -45,24 +45,24 @@ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/html'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/html'), + 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 'images' => [ - 'driver' => 'local', - 'root' => public_path('img/perfil'), + 'driver' => 'local', + 'root' => public_path('img/perfil'), 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => env('AWS_KEY'), + 'key' => env('AWS_KEY'), 'secret' => env('AWS_SECRET'), 'region' => env('AWS_REGION'), 'bucket' => env('AWS_BUCKET'), diff --git a/config/gravatar.php b/config/gravatar.php index 8f4466ba..c15fa962 100644 --- a/config/gravatar.php +++ b/config/gravatar.php @@ -1,34 +1,34 @@ array( +return [ + 'default' => [ - // By default, images are presented at 80px by 80px if no size parameter is supplied. - // You may request a specific image size, which will be dynamically delivered from Gravatar - // by passing a single pixel dimension (since the images are square): - 'size' => 80, + // By default, images are presented at 80px by 80px if no size parameter is supplied. + // You may request a specific image size, which will be dynamically delivered from Gravatar + // by passing a single pixel dimension (since the images are square): + 'size' => 80, - // the fallback image, can be a string or a url - // for more info, visit: http://en.gravatar.com/site/implement/images/#default-image - 'fallback' => 'mm', + // the fallback image, can be a string or a url + // for more info, visit: http://en.gravatar.com/site/implement/images/#default-image + 'fallback' => 'mm', - // would you like to return a https://... image - 'secure' => false, + // would you like to return a https://... image + 'secure' => false, - // Gravatar allows users to self-rate their images so that they can indicate if an image - // is appropriate for a certain audience. By default, only 'G' rated images are displayed - // unless you indicate that you would like to see higher ratings. - // Available options: - // g: suitable for display on all websites with any audience type. - // pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence. - // r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use. - // x: may contain hardcore sexual imagery or extremely disturbing violence. - 'maximumRating' => 'g', + // Gravatar allows users to self-rate their images so that they can indicate if an image + // is appropriate for a certain audience. By default, only 'G' rated images are displayed + // unless you indicate that you would like to see higher ratings. + // Available options: + // g: suitable for display on all websites with any audience type. + // pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence. + // r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use. + // x: may contain hardcore sexual imagery or extremely disturbing violence. + 'maximumRating' => 'g', - // If for some reason you wanted to force the default image to always load, you can do that setting this to true - 'forceDefault' => false, + // If for some reason you wanted to force the default image to always load, you can do that setting this to true + 'forceDefault' => false, - // If you require a file-type extension (some places do) then you may also add an (optional) .jpg extension to that URL - 'forceExtension' => 'jpg', - ) -); \ No newline at end of file + // If you require a file-type extension (some places do) then you may also add an (optional) .jpg extension to that URL + 'forceExtension' => 'jpg', + ], +]; diff --git a/config/image.php b/config/image.php index b106809e..67983819 100644 --- a/config/image.php +++ b/config/image.php @@ -1,6 +1,6 @@ 'gd' + 'driver' => 'gd', -); +]; diff --git a/config/mail.php b/config/mail.php index bb92224c..0951a33f 100644 --- a/config/mail.php +++ b/config/mail.php @@ -57,7 +57,7 @@ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* diff --git a/config/menu.php b/config/menu.php index 6cf8f0e0..2dc40a84 100644 --- a/config/menu.php +++ b/config/menu.php @@ -31,20 +31,20 @@ Menu::macro('sidebar', function () { return Menu::adminlteMenu() ->add(Html::raw('HEADER')->addParentClass('header')) - ->url('home', " ".trans('home.men1')."") - - ->url('equipos', " ".trans('home.men2')."") - ->url('custodio', " ".trans('home.men3')."") - ->url('checklist', " ".trans('home.men4')."") - ->url('informes', " ".trans('Informes')."") - - ->add(Menu::new() + ->url('home', " ".trans('home.men1')."") + + ->url('equipos', " ".trans('home.men2')."") + ->url('custodio', " ".trans('home.men3')."") + ->url('checklist', " ".trans('home.men4')."") + ->url('informes', " ".trans('Informes')."") + + ->add(Menu::new() ->add(Html::raw(" ".trans('home.menrep1')." ")->addParentClass('header')) ->url('reporte1', "".('home.menrep1')." ") ) //->add(Link::to('#', " ".trans('home.men13')." ")) ->each(function (Menu $link) { - + // Return if string doesn't contain 'Foo' if (Auth::getUser()->rol!="administrador"|| Auth::getUser()->rol!="system") { @@ -56,17 +56,17 @@ ->addParentClass('treeview') ->addClass('treeview-menu') ->url('usuario', " ".trans('home.men7')."") - ->url('opciones_check', " ".trans('home.men8')."") - ->url('checklist_opcionescheck', " ".trans('home.men5')."") - ->url('areas', " ".trans('home.men9')."") - ->url('modelo', " ".trans('home.men10')."") - ->url('orden', " ".trans('home.men11')."") - ->url('estaciones', " ".trans('home.men12')."") - ->url('config', " ".trans('home.men13')."") + ->url('opciones_check', " ".trans('home.men8')."") + ->url('checklist_opcionescheck', " ".trans('home.men5')."") + ->url('areas', " ".trans('home.men9')."") + ->url('modelo', " ".trans('home.men10')."") + ->url('orden', " ".trans('home.men11')."") + ->url('estaciones', " ".trans('home.men12')."") + ->url('config', " ".trans('home.men13')."") ->url('oautho2', " ".trans('OAuth2')."") - ; + ; }) - + ->setActiveFromRequest(); /* ->add(Html::raw('HEADER')->addParentClass('header')) ->action('HomeController@index', 'Home') @@ -99,4 +99,4 @@ ->setActiveFromRequest(); * / }); -*/ \ No newline at end of file +*/ diff --git a/config/pusher.php b/config/pusher.php index 5660d887..5dc41076 100644 --- a/config/pusher.php +++ b/config/pusher.php @@ -41,22 +41,22 @@ 'main' => [ 'auth_key' => 'your-auth-key', - 'secret' => 'your-secret', - 'app_id' => 'your-app-id', - 'options' => [], - 'host' => null, - 'port' => null, - 'timeout' => null, + 'secret' => 'your-secret', + 'app_id' => 'your-app-id', + 'options' => [], + 'host' => null, + 'port' => null, + 'timeout' => null, ], 'alternative' => [ 'auth_key' => 'your-auth-key', - 'secret' => 'your-secret', - 'app_id' => 'your-app-id', - 'options' => [], - 'host' => null, - 'port' => null, - 'timeout' => null, + 'secret' => 'your-secret', + 'app_id' => 'your-app-id', + 'options' => [], + 'host' => null, + 'port' => null, + 'timeout' => null, ], ], diff --git a/config/queue.php b/config/queue.php index 4d83ebd0..3a5de83f 100644 --- a/config/queue.php +++ b/config/queue.php @@ -35,32 +35,32 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', + 'key' => 'your-public-key', 'secret' => 'your-secret-key', 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', + 'queue' => 'your-queue-name', 'region' => 'us-east-1', ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', 'retry_after' => 90, ], @@ -79,7 +79,7 @@ 'failed' => [ 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 21cc7f8e..5b4e0f7b 100644 --- a/config/services.php +++ b/config/services.php @@ -20,7 +20,7 @@ ], 'ses' => [ - 'key' => env('SES_KEY'), + 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), 'region' => 'us-east-1', ], @@ -30,16 +30,16 @@ ], 'stripe' => [ - 'model' => App\User::class, - 'key' => env('STRIPE_KEY'), + 'model' => App\User::class, + 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), ], 'firebase' => [ - 'api_key' => 'API_KEY', // Only used for JS integration - 'auth_domain' => 'AUTH_DOMAIN', // Only used for JS integration - 'database_url' => env('FIRE_DATABASE_URL'), - 'secret' => env('FIRE_DATABASE_SECRET'), + 'api_key' => 'API_KEY', // Only used for JS integration + 'auth_domain' => 'AUTH_DOMAIN', // Only used for JS integration + 'database_url' => env('FIRE_DATABASE_URL'), + 'secret' => env('FIRE_DATABASE_SECRET'), 'storage_bucket' => 'STORAGE_BUCKET', // Only used for JS integration ], diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 7926c794..8f5259ea 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -16,9 +16,9 @@ static $password; return [ - 'name' => $faker->name, - 'email' => $faker->unique()->safeEmail, - 'password' => $password ?: $password = bcrypt('secret'), + 'name' => $faker->name, + 'email' => $faker->unique()->safeEmail, + 'password' => $password ?: $password = bcrypt('secret'), 'remember_token' => str_random(10), ]; }); diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 0ab52c9f..c5055cd6 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,8 +1,8 @@ string('name'); $table->string('email')->unique(); $table->enum('rol', ['system', 'administrator']); - $table->enum('padrino', ['Avianca BOG','Avianca SAL','Avianca ECU','Avianca']); + $table->enum('padrino', ['Avianca BOG', 'Avianca SAL', 'Avianca ECU', 'Avianca']); $table->string('password'); $table->rememberToken(); $table->timestamps(); diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 0d5cb845..0ee0a36a 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,8 +1,8 @@ increments('id'); $table->bigInteger('facebook_id')->nullable()->unsigned()->index(); $table->string('name')->nullable(); diff --git a/database/migrations/2016_05_10_154524_create_arbols_table.php b/database/migrations/2016_05_10_154524_create_arbols_table.php index a11714ed..1f30e3ec 100644 --- a/database/migrations/2016_05_10_154524_create_arbols_table.php +++ b/database/migrations/2016_05_10_154524_create_arbols_table.php @@ -1,7 +1,7 @@ increments('id'); $table->string('nombre_comun'); $table->string('nombre_cientifico'); - $table->enum('patrimonial', ['si', 'no']);; + $table->enum('patrimonial', ['si', 'no']); $table->string('descripcion'); $table->binary('imagen'); $table->string('historia'); - $table->double('lat',20,10); - $table->double('lng',20,10); - + $table->double('lat', 20, 10); + $table->double('lng', 20, 10); + $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2016_05_10_154736_create_motivos__denuncias_table.php b/database/migrations/2016_05_10_154736_create_motivos__denuncias_table.php index 69dd4c26..cab82e47 100644 --- a/database/migrations/2016_05_10_154736_create_motivos__denuncias_table.php +++ b/database/migrations/2016_05_10_154736_create_motivos__denuncias_table.php @@ -1,7 +1,7 @@ binary('imagen'); $table->string('descripcion'); $table->string('lugar'); - $table->double('lat',20,10); - $table->double('lng',20,10); + $table->double('lat', 20, 10); + $table->double('lng', 20, 10); //////////////// $table->integer('motivo_den_id')->unsigned(); $table->foreign('motivo_den_id')->references('id')->on('motivos__denuncias'); diff --git a/database/migrations/2016_05_11_234952_create_posts_table.php b/database/migrations/2016_05_11_234952_create_posts_table.php index 72486750..ae4fb3c8 100644 --- a/database/migrations/2016_05_11_234952_create_posts_table.php +++ b/database/migrations/2016_05_11_234952_create_posts_table.php @@ -12,20 +12,18 @@ class CreatePostsTable extends Migration */ public function up() { - - Schema::create('posts', function(Blueprint $table) { - $table->increments('id'); - $table->string('nombre_comun'); -$table->string('nombre_cientifico'); -$table->boolean('patrimonial'); -$table->text('descripcion'); -$table->string('historia'); -$table->string('lat'); -$table->string('lng'); + Schema::create('posts', function (Blueprint $table) { + $table->increments('id'); + $table->string('nombre_comun'); + $table->string('nombre_cientifico'); + $table->boolean('patrimonial'); + $table->text('descripcion'); + $table->string('historia'); + $table->string('lat'); + $table->string('lng'); - $table->timestamps(); - }); - + $table->timestamps(); + }); } /** @@ -37,5 +35,4 @@ public function down() { Schema::drop('posts'); } - } diff --git a/database/migrations/2016_07_06_133251_create_modelo_equipos_table.php b/database/migrations/2016_07_06_133251_create_modelo_equipos_table.php index e70b770c..74840750 100644 --- a/database/migrations/2016_07_06_133251_create_modelo_equipos_table.php +++ b/database/migrations/2016_07_06_133251_create_modelo_equipos_table.php @@ -1,7 +1,7 @@ increments('id'); - $table->string("modelo"); - $table->string("fabricante"); - $table->integer("garantia_anios"); - $table->string("tipo_equipo"); + $table->string('modelo'); + $table->string('fabricante'); + $table->integer('garantia_anios'); + $table->string('tipo_equipo'); $table->timestamps(); }); diff --git a/database/migrations/2016_07_06_133335_create_orden_de_compras_table.php b/database/migrations/2016_07_06_133335_create_orden_de_compras_table.php index 86d3b33f..7b25d315 100644 --- a/database/migrations/2016_07_06_133335_create_orden_de_compras_table.php +++ b/database/migrations/2016_07_06_133335_create_orden_de_compras_table.php @@ -1,7 +1,7 @@ increments('id'); - $table->string("ordenCompra"); - $table->date("fecha_compra"); + $table->string('ordenCompra'); + $table->date('fecha_compra'); $table->timestamps(); }); } diff --git a/database/migrations/2016_07_06_133403_create_custodios_table.php b/database/migrations/2016_07_06_133403_create_custodios_table.php index 413663c5..3dd101eb 100644 --- a/database/migrations/2016_07_06_133403_create_custodios_table.php +++ b/database/migrations/2016_07_06_133403_create_custodios_table.php @@ -1,7 +1,7 @@ increments('id'); - $table->string("pais"); - $table->string("ciudad"); - $table->string("direccion"); - $table->string("area-piso"); - $table->string("documentoIdentificacion"); - $table->string("cargo"); - $table->string("compania"); - $table->string("telefono"); + $table->string('pais'); + $table->string('ciudad'); + $table->string('direccion'); + $table->string('area-piso'); + $table->string('documentoIdentificacion'); + $table->string('cargo'); + $table->string('compania'); + $table->string('telefono'); $table->enum('estado', ['ACTIVO', 'INACTIVO']); $table->softDeletes(); $table->timestamps(); diff --git a/database/migrations/2016_07_06_133435_create_estaciones_table.php b/database/migrations/2016_07_06_133435_create_estaciones_table.php index 90765245..d0401ab4 100644 --- a/database/migrations/2016_07_06_133435_create_estaciones_table.php +++ b/database/migrations/2016_07_06_133435_create_estaciones_table.php @@ -1,7 +1,7 @@ increments('id'); - $table->string("estacion"); + $table->string('estacion'); $table->timestamps(); }); } diff --git a/database/migrations/2016_07_06_133529_create_areas_table.php b/database/migrations/2016_07_06_133529_create_areas_table.php index 9815b166..eda043f1 100644 --- a/database/migrations/2016_07_06_133529_create_areas_table.php +++ b/database/migrations/2016_07_06_133529_create_areas_table.php @@ -1,7 +1,7 @@ increments('id'); - $table->string("area"); + $table->string('area'); $table->timestamps(); }); } diff --git a/database/migrations/2016_07_06_173333_create_check_lists_table.php b/database/migrations/2016_07_06_173333_create_check_lists_table.php index 4c240540..ab1a95cb 100644 --- a/database/migrations/2016_07_06_173333_create_check_lists_table.php +++ b/database/migrations/2016_07_06_173333_create_check_lists_table.php @@ -1,7 +1,7 @@ foreign('area_id')->references('id')->on('areas'); $table->string('atributo'); - $table->enum("mandatorio", ['SI', 'NO']); - $table->enum("tipo", ['si-no', 'text','equipo_id','fecha','si-no&version','ip','equipo_id&texto']); + $table->enum('mandatorio', ['SI', 'NO']); + $table->enum('tipo', ['si-no', 'text', 'equipo_id', 'fecha', 'si-no&version', 'ip', 'equipo_id&texto']); $table->timestamps(); }); diff --git a/database/migrations/2016_07_06_174853_create_check_list__opciones_check_lists_table.php b/database/migrations/2016_07_06_174853_create_check_list__opciones_check_lists_table.php index 9811ce02..76df7829 100644 --- a/database/migrations/2016_07_06_174853_create_check_list__opciones_check_lists_table.php +++ b/database/migrations/2016_07_06_174853_create_check_list__opciones_check_lists_table.php @@ -1,7 +1,7 @@ binary('imagen'); - $table->integer("num_cajas"); - $table->string("sociedad"); - $table->string("no_serie"); - $table->string("codigo_barras"); - $table->string("codigo_avianca"); - $table->string("codigo_otro"); - $table->string("descripcion"); - $table->string("ip"); + $table->integer('num_cajas'); + $table->string('sociedad'); + $table->string('no_serie'); + $table->string('codigo_barras'); + $table->string('codigo_avianca'); + $table->string('codigo_otro'); + $table->string('descripcion'); + $table->string('ip'); /*$table->string("modelo"); $table->string("cpu"); $table->string("monitor"); @@ -52,12 +52,10 @@ public function up() $table->string("custodio"); $table->string("estacion"); $table->string("oficina");*/ - $table->enum('estado', ['BUENO', 'MALO','NUEVO']); - $table->enum('estatus', ['VIGENTE', 'BODEGA','BAJA']); - $table->enum("garantia", ['SI', 'NO']); - $table->string("observaciones"); - - + $table->enum('estado', ['BUENO', 'MALO', 'NUEVO']); + $table->enum('estatus', ['VIGENTE', 'BODEGA', 'BAJA']); + $table->enum('garantia', ['SI', 'NO']); + $table->string('observaciones'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2016_07_06_205004_add_softdeleteordencompra.php b/database/migrations/2016_07_06_205004_add_softdeleteordencompra.php index 00b79849..cc82d55e 100644 --- a/database/migrations/2016_07_06_205004_add_softdeleteordencompra.php +++ b/database/migrations/2016_07_06_205004_add_softdeleteordencompra.php @@ -1,7 +1,7 @@ increments('id'); $table->integer('id_equipos')->unsigned(); - $table->enum('acciondb', ['crear', 'actualizar','editar','borrar']); + $table->enum('acciondb', ['crear', 'actualizar', 'editar', 'borrar']); //////////////// $table->integer('modelo_equipo_id')->unsigned(); //////////////// @@ -30,18 +30,18 @@ public function up() $table->integer('check_list_id')->unsigned()->nullable(); $table->binary('imagen'); - $table->integer("num_cajas"); - $table->string("sociedad"); - $table->string("no_serie"); - $table->string("codigo_barras"); - $table->string("codigo_avianca"); - $table->string("codigo_otro"); - $table->string("descripcion"); - $table->string("ip"); - $table->enum('estado', ['BUENO', 'MALO','NUEVO']); - $table->enum('estatus', ['VIGENTE', 'BODEGA','BAJA']); - $table->enum("garantia", ['SI', 'NO']); - $table->string("observaciones"); + $table->integer('num_cajas'); + $table->string('sociedad'); + $table->string('no_serie'); + $table->string('codigo_barras'); + $table->string('codigo_avianca'); + $table->string('codigo_otro'); + $table->string('descripcion'); + $table->string('ip'); + $table->enum('estado', ['BUENO', 'MALO', 'NUEVO']); + $table->enum('estatus', ['VIGENTE', 'BODEGA', 'BAJA']); + $table->enum('garantia', ['SI', 'NO']); + $table->string('observaciones'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2016_07_12_212936_create_configuracions_table.php b/database/migrations/2016_07_12_212936_create_configuracions_table.php index a876f59c..5e74f476 100644 --- a/database/migrations/2016_07_12_212936_create_configuracions_table.php +++ b/database/migrations/2016_07_12_212936_create_configuracions_table.php @@ -1,7 +1,7 @@ increments('id'); $table->string('atributo'); - $table->enum('tipo',['texto', 'lista','num']); + $table->enum('tipo', ['texto', 'lista', 'num']); $table->string('valores_fuente'); - $table->enum("fijo",['FIJO', 'MOVIL']); + $table->enum('fijo', ['FIJO', 'MOVIL']); $table->string('valor'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_04_06_172517_create_bitacoras_table.php b/database/migrations/2017_04_06_172517_create_bitacoras_table.php index 1f885664..d8f35069 100644 --- a/database/migrations/2017_04_06_172517_create_bitacoras_table.php +++ b/database/migrations/2017_04_06_172517_create_bitacoras_table.php @@ -1,7 +1,7 @@ integer('id_equipos')->unsigned(); $table->foreign('id_equipos')->references('id')->on('equipos'); - $table->string("titulo"); - $table->date("fecha_ingreso"); + $table->string('titulo'); + $table->date('fecha_ingreso'); $table->integer('custodio_id')->unsigned(); $table->foreign('custodio_id')->references('id')->on('custodios'); @@ -27,12 +27,10 @@ public function up() $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users'); - $table->string("problema"); - $table->string("solucion"); - - - $table->enum('estado', ['enviado', 'recibido','en_reparacion','espera_repuesto','reparado','para_dar_baja','en_garantía']); + $table->string('problema'); + $table->string('solucion'); + $table->enum('estado', ['enviado', 'recibido', 'en_reparacion', 'espera_repuesto', 'reparado', 'para_dar_baja', 'en_garantía']); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_04_22_040720_create_repo_novedades_table.php b/database/migrations/2017_04_22_040720_create_repo_novedades_table.php index 6c94222a..8423e632 100644 --- a/database/migrations/2017_04_22_040720_create_repo_novedades_table.php +++ b/database/migrations/2017_04_22_040720_create_repo_novedades_table.php @@ -1,7 +1,7 @@ integer('custodio_id')->unsigned(); $table->foreign('custodio_id')->references('id')->on('custodios'); - $table->date("fecha_novedades"); + $table->date('fecha_novedades'); - $table->string("correo"); + $table->string('correo'); - $table->enum('novedad', ['Asignación', 'Reasignación','Baja']); + $table->enum('novedad', ['Asignación', 'Reasignación', 'Baja']); - $table->string("observaciones"); + $table->string('observaciones'); $table->integer('antiguo_custodio_id')->unsigned(); $table->foreign('antiguo_custodio_id')->references('id')->on('custodios'); diff --git a/database/migrations/2017_04_22_152017_create_repo_novedades_detalles_table.php b/database/migrations/2017_04_22_152017_create_repo_novedades_detalles_table.php index ee55a46f..10ed8539 100644 --- a/database/migrations/2017_04_22_152017_create_repo_novedades_detalles_table.php +++ b/database/migrations/2017_04_22_152017_create_repo_novedades_detalles_table.php @@ -1,7 +1,7 @@ integer('repo_novedades_id')->unsigned(); $table->foreign('repo_novedades_id')->references('id')->on('repo_novedades'); - $table->integer('id_equipos')->unsigned(); $table->foreign('id_equipos')->references('id')->on('equipos'); @@ -43,14 +42,14 @@ public function up() $table->binary('imagen'); - $table->integer("num_cajas"); - $table->string("sociedad"); - $table->string("no_serie"); - $table->string("codigo_barras"); - $table->string("codigo_avianca"); - $table->string("codigo_otro"); - $table->string("descripcion"); - $table->string("ip"); + $table->integer('num_cajas'); + $table->string('sociedad'); + $table->string('no_serie'); + $table->string('codigo_barras'); + $table->string('codigo_avianca'); + $table->string('codigo_otro'); + $table->string('descripcion'); + $table->string('ip'); /*$table->string("modelo"); $table->string("cpu"); $table->string("monitor"); @@ -59,10 +58,10 @@ public function up() $table->string("custodio"); $table->string("estacion"); $table->string("oficina");*/ - $table->enum('estado', ['BUENO', 'MALO','NUEVO']); - $table->enum('estatus', ['VIGENTE', 'BODEGA','BAJA']); - $table->enum("garantia", ['SI', 'NO']); - $table->string("observaciones"); + $table->enum('estado', ['BUENO', 'MALO', 'NUEVO']); + $table->enum('estatus', ['VIGENTE', 'BODEGA', 'BAJA']); + $table->enum('garantia', ['SI', 'NO']); + $table->string('observaciones'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_05_15_190634_alter_estacion_table.php b/database/migrations/2017_05_15_190634_alter_estacion_table.php index 93f5bbe6..1a165014 100644 --- a/database/migrations/2017_05_15_190634_alter_estacion_table.php +++ b/database/migrations/2017_05_15_190634_alter_estacion_table.php @@ -1,7 +1,7 @@ enum('pais', ['ECUADOR', 'COLOMBIA','EL SALVADOR']); + $table->enum('pais', ['ECUADOR', 'COLOMBIA', 'EL SALVADOR']); $table->string('nombre_largo'); }); } diff --git a/database/migrations/2017_05_15_192101_create_ubicacion_table.php b/database/migrations/2017_05_15_192101_create_ubicacion_table.php index 770f4a83..aaf41b6c 100644 --- a/database/migrations/2017_05_15_192101_create_ubicacion_table.php +++ b/database/migrations/2017_05_15_192101_create_ubicacion_table.php @@ -1,7 +1,7 @@ string('no_orden'); $table->date('fecha_solicitud'); $table->date('fecha_ejecucion'); - $table->time('hora_inicio'); $table->time('hora_fin'); @@ -42,7 +40,6 @@ public function up() $table->string('solucion')->nullable(); $table->string('resolucion')->nullable(); - $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_05_15_203632_create_informe_mantenimiento_preventivo_tecnicos_table.php b/database/migrations/2017_05_15_203632_create_informe_mantenimiento_preventivo_tecnicos_table.php index 8626f5f7..b4ede01f 100644 --- a/database/migrations/2017_05_15_203632_create_informe_mantenimiento_preventivo_tecnicos_table.php +++ b/database/migrations/2017_05_15_203632_create_informe_mantenimiento_preventivo_tecnicos_table.php @@ -1,7 +1,7 @@ string('solucion', 255)->nullable()->change(); }); - } /** diff --git a/database/migrations/2017_08_05_192847_alter_table_equipos.php b/database/migrations/2017_08_05_192847_alter_table_equipos.php index 472d88d9..4908b7ce 100644 --- a/database/migrations/2017_08_05_192847_alter_table_equipos.php +++ b/database/migrations/2017_08_05_192847_alter_table_equipos.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + public function up() { Schema::table('equipos_logs', function (Blueprint $table) { diff --git a/database/migrations/2017_08_05_200742_alter_table_chklisOpcheck.php b/database/migrations/2017_08_05_200742_alter_table_chklisOpcheck.php index 10cc4270..2f29d058 100644 --- a/database/migrations/2017_08_05_200742_alter_table_chklisOpcheck.php +++ b/database/migrations/2017_08_05_200742_alter_table_chklisOpcheck.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + public function up() { Schema::table('check_list__opciones_check_lists', function (Blueprint $table) { diff --git a/database/migrations/2017_08_05_225412_alter_table_reponovedades.php b/database/migrations/2017_08_05_225412_alter_table_reponovedades.php index a36809d2..159d1707 100644 --- a/database/migrations/2017_08_05_225412_alter_table_reponovedades.php +++ b/database/migrations/2017_08_05_225412_alter_table_reponovedades.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * diff --git a/database/migrations/2017_08_10_194318_puestos_table.php b/database/migrations/2017_08_10_194318_puestos_table.php index 9d4e7d35..7aab665c 100644 --- a/database/migrations/2017_08_10_194318_puestos_table.php +++ b/database/migrations/2017_08_10_194318_puestos_table.php @@ -1,8 +1,8 @@ increments('id'); - //////////////// $table->integer('ubicacion_id')->unsigned()->nullable(); $table->foreign('ubicacion_id')->references('id')->on('ubicacions'); //////////////// - - $table->string("codigo"); - $table->string("detalle")->nullable(); - $table->string("x")->nullable(); - $table->string("y")->nullable(); - $table->enum('estado', ['OCUPADO', 'RESERVADO','LIBRE']); - - - + $table->string('codigo'); + $table->string('detalle')->nullable(); + $table->string('x')->nullable(); + $table->string('y')->nullable(); + $table->enum('estado', ['OCUPADO', 'RESERVADO', 'LIBRE']); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_08_10_200907_puestos_personas_table.php b/database/migrations/2017_08_10_200907_puestos_personas_table.php index 2138ab1d..d6055c59 100644 --- a/database/migrations/2017_08_10_200907_puestos_personas_table.php +++ b/database/migrations/2017_08_10_200907_puestos_personas_table.php @@ -1,8 +1,8 @@ increments('id'); - //////////////// $table->integer('puesto_id')->unsigned()->nullable(); $table->foreign('puesto_id')->references('id')->on('puestos'); @@ -24,9 +23,9 @@ public function up() $table->integer('custodio_id')->unsigned(); $table->foreign('custodio_id')->references('id')->on('custodios'); //////////////// - $table->dateTime("fecha_inicio"); - $table->dateTime("fecha_fin"); - $table->dateTime("horas_trabajadas"); + $table->dateTime('fecha_inicio'); + $table->dateTime('fecha_fin'); + $table->dateTime('horas_trabajadas'); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2017_08_10_201959_cambiar_ubicacion_table.php b/database/migrations/2017_08_10_201959_cambiar_ubicacion_table.php index 8824d151..14bfbc33 100644 --- a/database/migrations/2017_08_10_201959_cambiar_ubicacion_table.php +++ b/database/migrations/2017_08_10_201959_cambiar_ubicacion_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * diff --git a/database/migrations/2017_08_10_204650_cambiar_puesto_table.php b/database/migrations/2017_08_10_204650_cambiar_puesto_table.php index b3354b03..3b7a4d4a 100644 --- a/database/migrations/2017_08_10_204650_cambiar_puesto_table.php +++ b/database/migrations/2017_08_10_204650_cambiar_puesto_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -19,7 +20,7 @@ public function up() { Schema::table('puestos', function (Blueprint $table) { // - $table->string("codigo")->unique()->change(); + $table->string('codigo')->unique()->change(); }); } diff --git a/database/migrations/2017_08_12_072927_cambiarpuestospersonasTabla.php b/database/migrations/2017_08_12_072927_cambiarpuestospersonasTabla.php index fc4aaca0..4d840611 100644 --- a/database/migrations/2017_08_12_072927_cambiarpuestospersonasTabla.php +++ b/database/migrations/2017_08_12_072927_cambiarpuestospersonasTabla.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -19,8 +20,8 @@ public function up() { Schema::table('puestos_custodios', function (Blueprint $table) { // - $table->dateTime("fecha_fin")->nullable()->change(); - $table->integer("horas_trabajadas")->change(); + $table->dateTime('fecha_fin')->nullable()->change(); + $table->integer('horas_trabajadas')->change(); }); } diff --git a/database/migrations/2017_09_06_091619_create_busquedas_table.php b/database/migrations/2017_09_06_091619_create_busquedas_table.php index a5bf669b..4817e512 100644 --- a/database/migrations/2017_09_06_091619_create_busquedas_table.php +++ b/database/migrations/2017_09_06_091619_create_busquedas_table.php @@ -1,8 +1,8 @@ integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users'); - $table->string("palabra_q"); - $table->string("instancia"); - $table->string("instancia_id"); - $table->string("dato"); + $table->string('palabra_q'); + $table->string('instancia'); + $table->string('instancia_id'); + $table->string('dato'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_09_07_191456_add_rol_to_users_table.php b/database/migrations/2017_09_07_191456_add_rol_to_users_table.php index 021a1070..3309b583 100644 --- a/database/migrations/2017_09_07_191456_add_rol_to_users_table.php +++ b/database/migrations/2017_09_07_191456_add_rol_to_users_table.php @@ -1,16 +1,16 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * diff --git a/database/migrations/2017_09_07_203832_add_contable_to_equipos_table.php b/database/migrations/2017_09_07_203832_add_contable_to_equipos_table.php index de70649b..c02096f0 100644 --- a/database/migrations/2017_09_07_203832_add_contable_to_equipos_table.php +++ b/database/migrations/2017_09_07_203832_add_contable_to_equipos_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,7 +19,7 @@ public function __construct() public function up() { Schema::table('equipos', function (Blueprint $table) { - $table->string("codigo_contable")->nullable(); + $table->string('codigo_contable')->nullable(); }); } diff --git a/database/migrations/2017_09_08_131936_add_verificado_to_users_table.php b/database/migrations/2017_09_08_131936_add_verificado_to_users_table.php index 83b0cb68..fddb879f 100644 --- a/database/migrations/2017_09_08_131936_add_verificado_to_users_table.php +++ b/database/migrations/2017_09_08_131936_add_verificado_to_users_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -31,7 +32,6 @@ public function up() public function down() { Schema::table('users', function (Blueprint $table) { - }); } } diff --git a/database/migrations/2017_09_09_103000_add_garantiaHP_campos_to_equipos_table.php b/database/migrations/2017_09_09_103000_add_garantiaHP_campos_to_equipos_table.php index be4dd1a5..a1c51f4c 100644 --- a/database/migrations/2017_09_09_103000_add_garantiaHP_campos_to_equipos_table.php +++ b/database/migrations/2017_09_09_103000_add_garantiaHP_campos_to_equipos_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,14 +19,14 @@ public function __construct() public function up() { Schema::table('equipos', function (Blueprint $table) { - $table->string("hp_warrantyLevel")->nullable(); - $table->string("hp_endDate")->nullable(); - $table->string("hp_displaySerialNumber")->nullable(); - $table->string("hp_modelNumber")->nullable(); - $table->string("hp_countryOfPurchase")->nullable(); - $table->string("hp_newProduct_seriesName")->nullable(); - $table->string("hp_newProduct_imageUrl")->nullable(); - $table->string("hp_warrantyResultRedirectUrl")->nullable(); + $table->string('hp_warrantyLevel')->nullable(); + $table->string('hp_endDate')->nullable(); + $table->string('hp_displaySerialNumber')->nullable(); + $table->string('hp_modelNumber')->nullable(); + $table->string('hp_countryOfPurchase')->nullable(); + $table->string('hp_newProduct_seriesName')->nullable(); + $table->string('hp_newProduct_imageUrl')->nullable(); + $table->string('hp_warrantyResultRedirectUrl')->nullable(); }); } diff --git a/database/migrations/2017_09_09_190759_add_garantiaHP_campos_to_equiposLog_table.php b/database/migrations/2017_09_09_190759_add_garantiaHP_campos_to_equiposLog_table.php index 64861ab4..59eca5c0 100644 --- a/database/migrations/2017_09_09_190759_add_garantiaHP_campos_to_equiposLog_table.php +++ b/database/migrations/2017_09_09_190759_add_garantiaHP_campos_to_equiposLog_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,15 +19,15 @@ public function __construct() public function up() { Schema::table('equipos_logs', function (Blueprint $table) { - $table->string("codigo_contable")->nullable(); - $table->string("hp_warrantyLevel")->nullable(); - $table->string("hp_endDate")->nullable(); - $table->string("hp_displaySerialNumber")->nullable(); - $table->string("hp_modelNumber")->nullable(); - $table->string("hp_countryOfPurchase")->nullable(); - $table->string("hp_newProduct_seriesName")->nullable(); - $table->string("hp_newProduct_imageUrl")->nullable(); - $table->string("hp_warrantyResultRedirectUrl")->nullable(); + $table->string('codigo_contable')->nullable(); + $table->string('hp_warrantyLevel')->nullable(); + $table->string('hp_endDate')->nullable(); + $table->string('hp_displaySerialNumber')->nullable(); + $table->string('hp_modelNumber')->nullable(); + $table->string('hp_countryOfPurchase')->nullable(); + $table->string('hp_newProduct_seriesName')->nullable(); + $table->string('hp_newProduct_imageUrl')->nullable(); + $table->string('hp_warrantyResultRedirectUrl')->nullable(); }); } diff --git a/database/migrations/2017_09_09_203809_create_jobs_table.php b/database/migrations/2017_09_09_203809_create_jobs_table.php index acd2597a..ddbb2dce 100644 --- a/database/migrations/2017_09_09_203809_create_jobs_table.php +++ b/database/migrations/2017_09_09_203809_create_jobs_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,8 +19,8 @@ public function __construct() public function up() { Schema::table('custodios', function (Blueprint $table) { - $table->string("email")->nullable(); - $table->integer("notificado")->default(0)->nullable()->unsigned(); + $table->string('email')->nullable(); + $table->integer('notificado')->default(0)->nullable()->unsigned(); }); } diff --git a/database/migrations/2017_09_11_124453_add_documentoIdentificacion_users_table.php b/database/migrations/2017_09_11_124453_add_documentoIdentificacion_users_table.php index 123e12a2..c8727434 100644 --- a/database/migrations/2017_09_11_124453_add_documentoIdentificacion_users_table.php +++ b/database/migrations/2017_09_11_124453_add_documentoIdentificacion_users_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,7 +19,7 @@ public function __construct() public function up() { Schema::table('users', function (Blueprint $table) { - $table->string("documentoIdentificacion")->nullable(); + $table->string('documentoIdentificacion')->nullable(); }); } diff --git a/database/migrations/2017_09_19_204458_add_acceso_custodio_table.php b/database/migrations/2017_09_19_204458_add_acceso_custodio_table.php index 7a57ae88..26b4de27 100644 --- a/database/migrations/2017_09_19_204458_add_acceso_custodio_table.php +++ b/database/migrations/2017_09_19_204458_add_acceso_custodio_table.php @@ -1,8 +1,8 @@ string("empresa")->unique(); + $table->string('empresa')->unique(); $table->timestamps(); $table->softDeletes(); }); $e = new \App\Empresa(); $e->empresa = 'Avianca EC'; $e->save(); - } /** diff --git a/database/migrations/2017_09_21_193956_add_empresa_usuarios_table.php b/database/migrations/2017_09_21_193956_add_empresa_usuarios_table.php index 869ca96a..a3360a18 100644 --- a/database/migrations/2017_09_21_193956_add_empresa_usuarios_table.php +++ b/database/migrations/2017_09_21_193956_add_empresa_usuarios_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * @@ -18,20 +19,14 @@ public function __construct() public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('empresa'); }); - $affected = DB::update('update users set empresa = ?', ['Avianca Ec']); - Schema::table('users', function (Blueprint $table) { $table->foreign('empresa')->references('empresa')->on('empresas'); }); - - - } /** diff --git a/database/migrations/2017_09_22_191222_add_empresa_areas_table.php b/database/migrations/2017_09_22_191222_add_empresa_areas_table.php index 0af2f161..a3ad3b34 100644 --- a/database/migrations/2017_09_22_191222_add_empresa_areas_table.php +++ b/database/migrations/2017_09_22_191222_add_empresa_areas_table.php @@ -1,8 +1,8 @@ string('empresa'); - }); - - $affected = DB::update('update areas set empresa = ?', ['Avianca Ec']); - + Schema::table('areas', function (Blueprint $table) { + $table->string('empresa'); + }); - Schema::table('areas', function (Blueprint $table) { + $affected = DB::update('update areas set empresa = ?', ['Avianca Ec']); - $table->foreign('empresa')->references('empresa')->on('empresas'); - }); + Schema::table('areas', function (Blueprint $table) { + $table->foreign('empresa')->references('empresa')->on('empresas'); + }); } /** diff --git a/database/migrations/2017_09_22_191358_add_empres_configuration_areas_table.php b/database/migrations/2017_09_22_191358_add_empres_configuration_areas_table.php index 5c8985ca..3dc1799b 100644 --- a/database/migrations/2017_09_22_191358_add_empres_configuration_areas_table.php +++ b/database/migrations/2017_09_22_191358_add_empres_configuration_areas_table.php @@ -1,8 +1,8 @@ string('empresa'); - }); - $affected = DB::update('update configuracions set empresa = ?', ['Avianca Ec']); - - - Schema::table('configuracions', function (Blueprint $table) { + $table->string('empresa'); + }); + $affected = DB::update('update configuracions set empresa = ?', ['Avianca Ec']); - $table->foreign('empresa')->references('empresa')->on('empresas'); - }); + Schema::table('configuracions', function (Blueprint $table) { + $table->foreign('empresa')->references('empresa')->on('empresas'); + }); } /** diff --git a/database/migrations/2017_09_22_191548_add_usuario_equipos_table.php b/database/migrations/2017_09_22_191548_add_usuario_equipos_table.php index bfe65068..0a11360e 100644 --- a/database/migrations/2017_09_22_191548_add_usuario_equipos_table.php +++ b/database/migrations/2017_09_22_191548_add_usuario_equipos_table.php @@ -1,8 +1,8 @@ integer('id_users')->unsigned(); + $table->integer('id_users')->unsigned(); }); echo '[1]'; } diff --git a/database/migrations/2017_09_22_191652_add_empresa_estaciones_table.php b/database/migrations/2017_09_22_191652_add_empresa_estaciones_table.php index b9177bb1..4da3920b 100644 --- a/database/migrations/2017_09_22_191652_add_empresa_estaciones_table.php +++ b/database/migrations/2017_09_22_191652_add_empresa_estaciones_table.php @@ -1,8 +1,8 @@ string('empresa'); - }); - $affected = DB::update('update estaciones set empresa = ?', ['Avianca Ec']); - - Schema::table('estaciones', function (Blueprint $table) { + }); + $affected = DB::update('update estaciones set empresa = ?', ['Avianca Ec']); - $table->foreign('empresa')->references('empresa')->on('empresas'); - }); + Schema::table('estaciones', function (Blueprint $table) { + $table->foreign('empresa')->references('empresa')->on('empresas'); + }); } /** diff --git a/database/migrations/2017_09_22_200206_borrar_padrino_users_table.php b/database/migrations/2017_09_22_200206_borrar_padrino_users_table.php index 5f7b1a5f..80fa9c0b 100644 --- a/database/migrations/2017_09_22_200206_borrar_padrino_users_table.php +++ b/database/migrations/2017_09_22_200206_borrar_padrino_users_table.php @@ -1,8 +1,8 @@ string('token_secret', 100)->nullable(); $table->string('client_secret', 100)->nullable(); $table->integer('client_id')->unsigned(); - $table->string('activo',1)->default(\App\OAuthApp::AUTH_INACTIVO); + $table->string('activo', 1)->default(\App\OAuthApp::AUTH_INACTIVO); $table->string('token_type')->nullable(); $table->date('expires_in')->nullable(); $table->string('access_token')->nullable(); diff --git a/database/migrations/2017_10_13_095239_add_unico_to_reporteNovedades_table.php b/database/migrations/2017_10_13_095239_add_unico_to_reporteNovedades_table.php index 2324af3a..7e5764ad 100644 --- a/database/migrations/2017_10_13_095239_add_unico_to_reporteNovedades_table.php +++ b/database/migrations/2017_10_13_095239_add_unico_to_reporteNovedades_table.php @@ -1,13 +1,11 @@ token_unico == null){ - $uno->token_unico=\App\RepoNovedades::generarUnico(); + foreach ($todos as $uno) { + if ($uno->token_unico == null) { + $uno->token_unico = \App\RepoNovedades::generarUnico(); $uno->save(); } } diff --git a/database/migrations/2017_10_14_201903_add_rol_aplicacion_to_users_table.php b/database/migrations/2017_10_14_201903_add_rol_aplicacion_to_users_table.php index 4cffabd7..b2609eef 100644 --- a/database/migrations/2017_10_14_201903_add_rol_aplicacion_to_users_table.php +++ b/database/migrations/2017_10_14_201903_add_rol_aplicacion_to_users_table.php @@ -1,8 +1,8 @@ getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } + /** * Run the migrations. * diff --git a/database/migrations/2017_10_17_085241_add_celular_ext_to_custodios_table.php b/database/migrations/2017_10_17_085241_add_celular_ext_to_custodios_table.php index f46f8f6e..8392edeb 100644 --- a/database/migrations/2017_10_17_085241_add_celular_ext_to_custodios_table.php +++ b/database/migrations/2017_10_17_085241_add_celular_ext_to_custodios_table.php @@ -1,8 +1,8 @@ dropColumn('image'); }); } diff --git a/database/migrations/2017_11_01_212815_create_modulos_table.php b/database/migrations/2017_11_01_212815_create_modulos_table.php index cbbb0f9b..8670b0c0 100644 --- a/database/migrations/2017_11_01_212815_create_modulos_table.php +++ b/database/migrations/2017_11_01_212815_create_modulos_table.php @@ -1,8 +1,8 @@ increments('id'); - $table->string('modulo',100); + $table->string('modulo', 100); $table->boolean('activo'); $table->timestamps(); diff --git a/database/migrations/2017_11_01_213648_create_permisos_table.php b/database/migrations/2017_11_01_213648_create_permisos_table.php index 7b61f89a..9c8ab9fc 100644 --- a/database/migrations/2017_11_01_213648_create_permisos_table.php +++ b/database/migrations/2017_11_01_213648_create_permisos_table.php @@ -1,8 +1,8 @@ increments('id'); - $table->string('permiso',100); + $table->string('permiso', 100); $table->integer('modulo_id')->unsigned(); $table->foreign('modulo_id')->references('id')->on('modulos'); - $table->string('descripcion',150); - + $table->string('descripcion', 150); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_11_02_081747_create_rols_table.php b/database/migrations/2017_11_02_081747_create_rols_table.php index 31413753..f52efc01 100644 --- a/database/migrations/2017_11_02_081747_create_rols_table.php +++ b/database/migrations/2017_11_02_081747_create_rols_table.php @@ -1,8 +1,8 @@ increments('id'); - $table->string('rol',100); - $table->string('descripcion',150); + $table->string('rol', 100); + $table->string('descripcion', 150); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2017_11_02_081859_create_usuariorols_table.php b/database/migrations/2017_11_02_081859_create_usuariorols_table.php index 1da01fbb..58f959a8 100644 --- a/database/migrations/2017_11_02_081859_create_usuariorols_table.php +++ b/database/migrations/2017_11_02_081859_create_usuariorols_table.php @@ -1,8 +1,8 @@ softDeletes(); $table->timestamps(); - }); } diff --git a/database/migrations/2017_11_02_082042_create_permisorols_table.php b/database/migrations/2017_11_02_082042_create_permisorols_table.php index 943d86e8..b2ab0100 100644 --- a/database/migrations/2017_11_02_082042_create_permisorols_table.php +++ b/database/migrations/2017_11_02_082042_create_permisorols_table.php @@ -1,8 +1,8 @@ string('empresa_procede1')->nullable(); + $table->string('empresa_procede1')->nullable(); }); $affected = DB::update('update equipos set empresa_procede1 = ?', ['Avianca Ec']); Schema::table('equipos', function (Blueprint $table) { - $table->foreign('empresa_procede1')->references('empresa')->on('empresas'); + $table->foreign('empresa_procede1')->references('empresa')->on('empresas'); }); Schema::table('equipos_logs', function (Blueprint $table) { @@ -28,7 +28,6 @@ public function up() Schema::table('equipos_logs', function (Blueprint $table) { $table->foreign('empresa_procede1')->references('empresa')->on('empresas'); }); - } /** diff --git a/database/migrations/2017_12_27_204040_add_valida_codigo_empresa_table.php b/database/migrations/2017_12_27_204040_add_valida_codigo_empresa_table.php index bc41ee9d..2ce46260 100644 --- a/database/migrations/2017_12_27_204040_add_valida_codigo_empresa_table.php +++ b/database/migrations/2017_12_27_204040_add_valida_codigo_empresa_table.php @@ -1,8 +1,8 @@ */ diff --git a/html/plugins/ckeditor/samples/old/assets/posteddata.php b/html/plugins/ckeditor/samples/old/assets/posteddata.php index 914b0984..1f5d6202 100644 --- a/html/plugins/ckeditor/samples/old/assets/posteddata.php +++ b/html/plugins/ckeditor/samples/old/assets/posteddata.php @@ -25,24 +25,23 @@ $value ) - { - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) - continue; +if (!empty($_POST)) { + foreach ($_POST as $key => $value) { + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { + continue; + } - if ( get_magic_quotes_gpc() ) - $value = htmlspecialchars( stripslashes((string)$value) ); - else - $value = htmlspecialchars( (string)$value ); -?> + if (get_magic_quotes_gpc()) { + $value = htmlspecialchars(stripslashes((string) $value)); + } else { + $value = htmlspecialchars((string) $value); + } ?> - +
diff --git a/html/plugins/ckeditor/samples/old/sample_posteddata.php b/html/plugins/ckeditor/samples/old/sample_posteddata.php index d34d5811..4fef2f1c 100644 --- a/html/plugins/ckeditor/samples/old/sample_posteddata.php +++ b/html/plugins/ckeditor/samples/old/sample_posteddata.php @@ -13,4 +13,4 @@ For licensing, see LICENSE.md or http://ckeditor.com/license ------------------------------------------------------------------------------------------- -
*/ include "assets/posteddata.php"; ?> +
*/ include 'assets/posteddata.php'; diff --git a/html/plugins/datatables/extensions/Scroller/examples/data/ssp.php b/html/plugins/datatables/extensions/Scroller/examples/data/ssp.php index 71057e9e..6bbc133c 100644 --- a/html/plugins/datatables/extensions/Scroller/examples/data/ssp.php +++ b/html/plugins/datatables/extensions/Scroller/examples/data/ssp.php @@ -28,31 +28,29 @@ // The `db` parameter represents the column name in the database, while the `dt` // parameter represents the DataTables column identifier. In this case simple // indexes -$columns = array( - array( 'db' => 'id', 'dt' => 0 ), - array( 'db' => 'firstname', 'dt' => 1 ), - array( 'db' => 'surname', 'dt' => 2 ), - array( 'db' => 'zip', 'dt' => 3 ), - array( 'db' => 'country', 'dt' => 4 ) -); +$columns = [ + ['db' => 'id', 'dt' => 0], + ['db' => 'firstname', 'dt' => 1], + ['db' => 'surname', 'dt' => 2], + ['db' => 'zip', 'dt' => 3], + ['db' => 'country', 'dt' => 4], +]; // SQL server connection information -$sql_details = array( - 'user' => '', - 'pass' => '', - 'db' => '', - 'host' => '' -); - +$sql_details = [ + 'user' => '', + 'pass' => '', + 'db' => '', + 'host' => '', +]; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * If you just want to use the basic configuration for DataTables with PHP * server-side, there is no need to edit below this line. */ -require( '../../../../examples/server_side/scripts/ssp.class.php' ); +require '../../../../examples/server_side/scripts/ssp.class.php'; echo json_encode( - SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns ) + SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns) ); - diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index e5506df2..6ef1a733 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -13,7 +13,7 @@ | */ - 'failed' => 'These credentials do not match our records.', + 'failed' => 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ]; diff --git a/resources/lang/en/form.php b/resources/lang/en/form.php index 47483e6a..e4c87c99 100644 --- a/resources/lang/en/form.php +++ b/resources/lang/en/form.php @@ -11,35 +11,35 @@ | messages that we need to display to the user. You are free to modify | these language lines according to your application's requirements. | - */ - 'buscar' => 'Buscar', - 'update' => 'Actualizar', - 'update_modificar' => 'Abrir&Modificar', - 'deletee' => 'Borrar', - 'addnew' => 'Añadir ', - 'sno' => '#', - 'equipos' => 'Equipos', - 'equipo' => 'Equipo', - 'reqeq' => 'Reasignar Equipo', - 'retg' => 'Imprimir Reporte de novedades FULL', - 'retg_custom' => 'Imprimir Reporte de novedades Personalizado', - 'codint' => 'Codigo Interno', - 'noser' => 'No. Serie', - 'odci1' => 'Orden De Compra:', - 'eid3' => 'Estacion: ', - 'ai3e' => 'Area: ', - 'usid23' => 'Usuario: ', - 'clid32' => 'Check List: ', - 'sxs3' => 'Sociedad: ', - 'ncs234' => 'Num Cajas: ', - 'asadd2' => 'Custodio:', - 'kijhuu7y' => 'Crear Equipo', + */ + 'buscar' => 'Buscar', + 'update' => 'Actualizar', + 'update_modificar' => 'Abrir&Modificar', + 'deletee' => 'Borrar', + 'addnew' => 'Añadir ', + 'sno' => '#', + 'equipos' => 'Equipos', + 'equipo' => 'Equipo', + 'reqeq' => 'Reasignar Equipo', + 'retg' => 'Imprimir Reporte de novedades FULL', + 'retg_custom' => 'Imprimir Reporte de novedades Personalizado', + 'codint' => 'Codigo Interno', + 'noser' => 'No. Serie', + 'odci1' => 'Orden De Compra:', + 'eid3' => 'Estacion: ', + 'ai3e' => 'Area: ', + 'usid23' => 'Usuario: ', + 'clid32' => 'Check List: ', + 'sxs3' => 'Sociedad: ', + 'ncs234' => 'Num Cajas: ', + 'asadd2' => 'Custodio:', + 'kijhuu7y' => 'Crear Equipo', - 'name' => 'Nombre completo', + 'name' => 'Nombre completo', 'first_name' => 'Primer Nombre', - 'last_name' => 'Apellido', - 'username' => 'usuario de dominio Avianca\xxxxxx', + 'last_name' => 'Apellido', + 'username' => 'usuario de dominio Avianca\xxxxxx', - '' => '', - '' => '', + '' => '', + '' => '', ]; diff --git a/resources/lang/en/message.php b/resources/lang/en/message.php index 9ecd082e..b4bc1d90 100644 --- a/resources/lang/en/message.php +++ b/resources/lang/en/message.php @@ -1,8 +1,8 @@ 'Hola', - 'verifica_correo' => 'Verifica tu correo', - 'verifica_correo_line1' => 'Verifica tu correo por favor, esto te permitira ingresar al sistema.', - 'verifica_correo_fin' => 'Sin embargo si usted no realizo esta accion, por favor no realice ninguna accion.', + 'verifica_saludo' => 'Hola', + 'verifica_correo' => 'Verifica tu correo', + 'verifica_correo_line1' => 'Verifica tu correo por favor, esto te permitira ingresar al sistema.', + 'verifica_correo_fin' => 'Sin embargo si usted no realizo esta accion, por favor no realice ninguna accion.', ]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index d4814118..fcab34b2 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -14,6 +14,6 @@ */ 'previous' => '« Previous', - 'next' => 'Next »', + 'next' => 'Next »', ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index e5544d20..ffa19ba4 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -14,9 +14,9 @@ */ 'password' => 'Passwords must be at least six characters and match the confirmation.', - 'reset' => 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", + 'reset' => 'Your password has been reset!', + 'sent' => 'We have e-mailed your password reset link!', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that e-mail address.", ]; diff --git a/resources/lang/en/rep.php b/resources/lang/en/rep.php index e34105f1..3a3219ce 100644 --- a/resources/lang/en/rep.php +++ b/resources/lang/en/rep.php @@ -2,26 +2,24 @@ return [ + 'modelo' => 'Modelo', + 'ordenCompra' => 'Orden de Compra', + 'nombre_responsable' => 'Nombre Custodio', + 'area_piso' => 'Area de Custodio', + 'ciudad' => 'Ciudad de Custodio', + 'estacion' => 'Estacion', + 'area' => 'Area', + 'num_cajas' => 'Numero de Caja', + 'sociedad' => 'Sociedad', + 'no_serie' => 'N° de Serie', + 'codigo_barras' => 'Codigo de Barras', + 'codigo_avianca' => 'Codigo Avianca', + 'codigo_otro' => 'Codigo Otro', + 'descripcion' => 'Descripcion', + 'ip' => 'IP', + 'estado' => 'Estado', + 'estatus' => 'Status', + 'garantia' => 'Garantia', + 'observaciones' => 'Observaciones', - 'modelo' => 'Modelo', - 'ordenCompra' => 'Orden de Compra', - 'nombre_responsable' => 'Nombre Custodio', - 'area_piso' => 'Area de Custodio', - 'ciudad' => 'Ciudad de Custodio', - 'estacion' => 'Estacion', - 'area' => 'Area', - 'num_cajas' => 'Numero de Caja', - 'sociedad' => 'Sociedad', - 'no_serie' => 'N° de Serie', - 'codigo_barras' => 'Codigo de Barras', - 'codigo_avianca' => 'Codigo Avianca', - 'codigo_otro' => 'Codigo Otro', - 'descripcion' => 'Descripcion', - 'ip' => 'IP', - 'estado' => 'Estado', - 'estatus' => 'Status', - 'garantia' => 'Garantia', - 'observaciones' => 'Observaciones', - - ] - ?> \ No newline at end of file + ]; diff --git a/resources/lang/es/auth.php b/resources/lang/es/auth.php index 346e97c5..bd6f9608 100644 --- a/resources/lang/es/auth.php +++ b/resources/lang/es/auth.php @@ -13,7 +13,7 @@ | */ - 'failed' => 'Estas credenciales no coinciden con nuestros registros.', + 'failed' => 'Estas credenciales no coinciden con nuestros registros.', 'throttle' => 'Demasiados intentos de inicio de sesión. Por favor, inténtelo de nuevo en :seconds segundos.', ]; diff --git a/resources/lang/es/fo.php b/resources/lang/es/fo.php index 6c58a2cd..1c8960b6 100644 --- a/resources/lang/es/fo.php +++ b/resources/lang/es/fo.php @@ -13,92 +13,91 @@ | */ - 'create_new_custodio' => 'Crear nuevo custodio', - 'notificar_custodio' => 'Notificar Custodios cambios de equipos', - 'notificar_custodio_todos' => 'Notificar a todos', - 'notificar_custodio_uno' => 'Notificar', - 'nombre_responsable' => 'Nombre Responsable: ', - 'ciudad' => 'Ciudad: ', - 'direccion' => 'Localidad: ', - 'area_piso' => 'Área Piso: ', - 'email' => 'Correo: ', - 'documentoIdentificacion' => 'Documento de Identificación: ', - 'cargo' => 'Cargo: ', - 'compania' => 'Compañía: ', - 'telefono' => 'Teléfono: ', - 'estado' => 'Estado: ', - 'Create' => 'Crear', - 'edit_custodio' => 'Editar Custodio', - 'Custodio' => 'Custodio', - 'Actions' => 'Acciones', - 'seleccion_de_usuario' => 'Selección de Custodio', - 'ID' => 'ID.', - 'nombre__respnsable' => 'Nombre Responsable', - 'ciudad_' => 'Ciudad', - 'direccion_' => 'Localidad', - 'area_' => 'Área', - 'Acciones' => 'Acciones', - 'Accion' => 'Acciones', - 'Sociedad' => 'Sociedad', - 'No. RPM (Cód.Barras)' => 'No. RPM (Cód. Barras)', - 'Descripción (Marca - Modelo)' => 'Descripción (Marca - Modelo)', - 'Estado' => 'Estado', - 'Equipos a cargo de usuario' => 'Equipos a cargo de custodio', - 'Modelo' => 'Modelo', - 'Fabricante' => 'Fabricante', - 'Garantia Anios' => 'Garantía Años', - 'Create New Modelo' => 'Crear nuevo modelo', - 'fabricante' => 'Fabricante: ', - 'garantia_anios' => 'Garantía Años: ', - 'tipo_equipo' => 'Tipo de equipo: ', - 'no_serie' => 'Serie', - 'Edit Modelo' => 'Editar Modelo', - 'Add New Area' => 'Añadir nueva área', - 'Areas' => 'Áreas', - 'Area' => 'Área', - 'Update' => 'Actualizar', - 'Delete' => 'Borrar', - 'area' => 'Área:', - 'Edit Area' => 'Editar Área', - 'Estaciones' => 'Estaciones', - 'Add New Estacione' => 'Añadir Estación', - 'Estacion' => 'Estación', - 'Pais' => 'País', - 'Maquinas' => 'Máquinas/Equipos', - 'Nombre Largo' => 'Nombre Largo', - 'Create New Estacione' => 'Crear nueva Estación', - 'estacion' => 'Estación: ', - 'pais' => 'País: ', - 'nombre_largo' => 'Nombre Largo: ', - 'Edit Estacione' => 'Editar Estación', - 'atencion' => 'Atención', - 'empresa' => 'Empresa:', - 'mensaje_de_notificacion_pagina' => 'El mensaje de notificación le toma 30 minutos en refrescarse, los correo son instantáneos', - 'Equipos a cargo de usuario' => 'Equipos a cargo de usuario', - 'RepoNovedades'=>'Reporte de Novedades', - 'Novedad'=>'Acta de Entrega', - 'sinNovedad'=>'No tiene novedad', - 'Atributo' => 'Atributo', - 'Tipo' => 'Tipo', - 'Valor' => 'Valor', - 'Config'=>'Atributos de configuracion de sistema, no modificar', - 'Add New Config'=>'Nueva Configuracion', + 'create_new_custodio' => 'Crear nuevo custodio', + 'notificar_custodio' => 'Notificar Custodios cambios de equipos', + 'notificar_custodio_todos' => 'Notificar a todos', + 'notificar_custodio_uno' => 'Notificar', + 'nombre_responsable' => 'Nombre Responsable: ', + 'ciudad' => 'Ciudad: ', + 'direccion' => 'Localidad: ', + 'area_piso' => 'Área Piso: ', + 'email' => 'Correo: ', + 'documentoIdentificacion' => 'Documento de Identificación: ', + 'cargo' => 'Cargo: ', + 'compania' => 'Compañía: ', + 'telefono' => 'Teléfono: ', + 'estado' => 'Estado: ', + 'Create' => 'Crear', + 'edit_custodio' => 'Editar Custodio', + 'Custodio' => 'Custodio', + 'Actions' => 'Acciones', + 'seleccion_de_usuario' => 'Selección de Custodio', + 'ID' => 'ID.', + 'nombre__respnsable' => 'Nombre Responsable', + 'ciudad_' => 'Ciudad', + 'direccion_' => 'Localidad', + 'area_' => 'Área', + 'Acciones' => 'Acciones', + 'Accion' => 'Acciones', + 'Sociedad' => 'Sociedad', + 'No. RPM (Cód.Barras)' => 'No. RPM (Cód. Barras)', + 'Descripción (Marca - Modelo)' => 'Descripción (Marca - Modelo)', + 'Estado' => 'Estado', + 'Equipos a cargo de usuario' => 'Equipos a cargo de custodio', + 'Modelo' => 'Modelo', + 'Fabricante' => 'Fabricante', + 'Garantia Anios' => 'Garantía Años', + 'Create New Modelo' => 'Crear nuevo modelo', + 'fabricante' => 'Fabricante: ', + 'garantia_anios' => 'Garantía Años: ', + 'tipo_equipo' => 'Tipo de equipo: ', + 'no_serie' => 'Serie', + 'Edit Modelo' => 'Editar Modelo', + 'Add New Area' => 'Añadir nueva área', + 'Areas' => 'Áreas', + 'Area' => 'Área', + 'Update' => 'Actualizar', + 'Delete' => 'Borrar', + 'area' => 'Área:', + 'Edit Area' => 'Editar Área', + 'Estaciones' => 'Estaciones', + 'Add New Estacione' => 'Añadir Estación', + 'Estacion' => 'Estación', + 'Pais' => 'País', + 'Maquinas' => 'Máquinas/Equipos', + 'Nombre Largo' => 'Nombre Largo', + 'Create New Estacione' => 'Crear nueva Estación', + 'estacion' => 'Estación: ', + 'pais' => 'País: ', + 'nombre_largo' => 'Nombre Largo: ', + 'Edit Estacione' => 'Editar Estación', + 'atencion' => 'Atención', + 'empresa' => 'Empresa:', + 'mensaje_de_notificacion_pagina' => 'El mensaje de notificación le toma 30 minutos en refrescarse, los correo son instantáneos', + 'Equipos a cargo de usuario' => 'Equipos a cargo de usuario', + 'RepoNovedades' => 'Reporte de Novedades', + 'Novedad' => 'Acta de Entrega', + 'sinNovedad' => 'No tiene novedad', + 'Atributo' => 'Atributo', + 'Tipo' => 'Tipo', + 'Valor' => 'Valor', + 'Config' => 'Atributos de configuracion de sistema, no modificar', + 'Add New Config' => 'Nueva Configuracion', - 'rol' => 'rol', - 'Rol' => 'Rol', - 'descripcion' => 'Descripción', - 'Ruta' => 'Ruta', - 'Permisos' => 'Permisos', - 'Descripcion' => 'Descripción', - 'permiso' => 'Permiso', - 'modulo' => 'Modulo', - 'Roles' => 'Roles', - 'Empresa' => 'Empresa', - 'formula_codigo' => 'Formula de etiqueta', - 'empresa' => 'Empresa', - 'formula_codigo' => 'Formula de etiqueta', - '' => '', - '' => '', + 'rol' => 'rol', + 'Rol' => 'Rol', + 'descripcion' => 'Descripción', + 'Ruta' => 'Ruta', + 'Permisos' => 'Permisos', + 'Descripcion' => 'Descripción', + 'permiso' => 'Permiso', + 'modulo' => 'Modulo', + 'Roles' => 'Roles', + 'Empresa' => 'Empresa', + 'formula_codigo' => 'Formula de etiqueta', + 'empresa' => 'Empresa', + 'formula_codigo' => 'Formula de etiqueta', + '' => '', + '' => '', ]; - diff --git a/resources/lang/es/form.php b/resources/lang/es/form.php index 24388f96..633997a4 100644 --- a/resources/lang/es/form.php +++ b/resources/lang/es/form.php @@ -12,63 +12,62 @@ | these language lines according to your application's requirements. | */ - 'buscar' => 'Buscar', - 'update' => 'Actualizar', - 'delete' => 'Borrar', - 'update2' => 'Actualizando', + 'buscar' => 'Buscar', + 'update' => 'Actualizar', + 'delete' => 'Borrar', + 'update2' => 'Actualizando', 'update_modificar' => 'Abrir & Modificar', - 'deletee' => 'Borrar', - 'addnew' => 'Añadir ', - 'sno' => '#', - 'equipos' => 'Equipos', - 'reqeq' => 'Reasignar Equipo', - 'retg' => 'Imprimir Reporte de novedades FULL', - 'retg_custom' => 'Imprimir Reporte de novedades Personalizado', - 'codint' => 'Código Interno', - 'noser' => 'Número de Serie', - 'odci1' => 'Orden De Compra:', - 'eid3' => 'Estación: ', - 'ai3e' => 'Área: ', - 'usid23' => 'Usuario: ', - 'clid32' => 'Check List: ', - 'sxs3' => 'Sociedad: ', - 'ncs234' => 'Número Cajas: ', - 'asadd2' => 'Custodio:', - 'kijhuu7y' => 'Crear Equipo', + 'deletee' => 'Borrar', + 'addnew' => 'Añadir ', + 'sno' => '#', + 'equipos' => 'Equipos', + 'reqeq' => 'Reasignar Equipo', + 'retg' => 'Imprimir Reporte de novedades FULL', + 'retg_custom' => 'Imprimir Reporte de novedades Personalizado', + 'codint' => 'Código Interno', + 'noser' => 'Número de Serie', + 'odci1' => 'Orden De Compra:', + 'eid3' => 'Estación: ', + 'ai3e' => 'Área: ', + 'usid23' => 'Usuario: ', + 'clid32' => 'Check List: ', + 'sxs3' => 'Sociedad: ', + 'ncs234' => 'Número Cajas: ', + 'asadd2' => 'Custodio:', + 'kijhuu7y' => 'Crear Equipo', - 'name' => 'Nombre completo', + 'name' => 'Nombre completo', 'first_name' => 'Primer Nombre', - 'last_name' => 'Apellido', - 'username' => 'usuario de dominio Avianca\xxxxxx', + 'last_name' => 'Apellido', + 'username' => 'usuario de dominio Avianca\xxxxxx', - 'cerrar' => 'Cerrar', - 'editEquipo' => 'Editar información de Equipo', - 'hojatrabaj' => 'Hoja de trabajo', - 'ordencompra' => 'Orden De Compra: ', - 'modeloid' => 'Modelo: ', - 'noserie' => 'Número de Serie: ', - 'aviancacode' => 'Código Avianca: ', - 'descrip' => 'Descripción: ', - 'iip' => 'Ip: ', - 'estad2w' => 'Estado: ', - 'statyhs' => 'Estatus: ', - 'garantia' => 'Garantía: ', - 'obs123' => 'Observaciones: ', - 'editarChecklist' => 'Editar CheckList', - 'modal1' => 'Modal título', - 'verchecklist' => 'Ver checklist', - 'nogarantia' => 'Equipo fuera de garantía, caducó en: ', - 'garantia_s' => 'Esta en garantía la máquina, caduca el: ', - 'checklist' => 'Checklist', - 'nombre' => 'Nombre', - 'atributo' => 'Atributo', - 'valor_es' => 'Valor(es)', - 'bitacora' => 'Bitácora', - 'actions' => 'Acciones', - 'fecha_ingreso' => 'Fecha Ingreso', - 'titulobitacora' => 'Título de Bitácora', - 'empresa_procede1' => 'Empresa Procede Equipo', - 'The page has expired due to inactivity.' => 'La página a expirado por inactividad.',// vendor/laravel/franework/src/illuminate/fundation/exception/views/ - 'Please refresh and try again.' => 'Por favor refresque el navegador (F5) y trate nuevamente.', + 'cerrar' => 'Cerrar', + 'editEquipo' => 'Editar información de Equipo', + 'hojatrabaj' => 'Hoja de trabajo', + 'ordencompra' => 'Orden De Compra: ', + 'modeloid' => 'Modelo: ', + 'noserie' => 'Número de Serie: ', + 'aviancacode' => 'Código Avianca: ', + 'descrip' => 'Descripción: ', + 'iip' => 'Ip: ', + 'estad2w' => 'Estado: ', + 'statyhs' => 'Estatus: ', + 'garantia' => 'Garantía: ', + 'obs123' => 'Observaciones: ', + 'editarChecklist' => 'Editar CheckList', + 'modal1' => 'Modal título', + 'verchecklist' => 'Ver checklist', + 'nogarantia' => 'Equipo fuera de garantía, caducó en: ', + 'garantia_s' => 'Esta en garantía la máquina, caduca el: ', + 'checklist' => 'Checklist', + 'nombre' => 'Nombre', + 'atributo' => 'Atributo', + 'valor_es' => 'Valor(es)', + 'bitacora' => 'Bitácora', + 'actions' => 'Acciones', + 'fecha_ingreso' => 'Fecha Ingreso', + 'titulobitacora' => 'Título de Bitácora', + 'empresa_procede1' => 'Empresa Procede Equipo', + 'The page has expired due to inactivity.' => 'La página a expirado por inactividad.', // vendor/laravel/franework/src/illuminate/fundation/exception/views/ + 'Please refresh and try again.' => 'Por favor refresque el navegador (F5) y trate nuevamente.', ]; - diff --git a/resources/lang/es/home.php b/resources/lang/es/home.php index c300d119..d5af5d91 100644 --- a/resources/lang/es/home.php +++ b/resources/lang/es/home.php @@ -13,89 +13,87 @@ | */ - - 'foot1' => '. Sistema de Inventarios ', - 'foot0' => 'Avianca', + 'foot1' => '. Sistema de Inventarios ', + 'foot0' => 'Avianca', 'foot2' => 'SES Ecuador', 'foot3' => 'Created by Wagner Cadena Template tomado de Github', - 'init1'=>'Sistema de Inventario de máquinas', - 'init2'=>'', - 'init3'=>'Esta aquí', - 'url1'=>'Sistema de Inventarios SES Ecuador', - 'url2'=>'El título del sitio Aquí', - 'logo1'=>'EC', - 'logo2' => 'SES Inventarios', - 'logo3' => 'SESInventarios', - 'usu1' => 'Su rol es: ', - 'profile' => 'Perfil', - 'salir' => 'Salir', - 'seguidores' => 'Informes', - 'ventas' => 'Actividad', - 'amigos' => 'Reportes', - 'login' => 'Ingresar', - 'register' => 'Registrarse', - 'men1' => 'Bienvenido', - 'men2' => 'Equipos', - 'men3' => 'Custodios', - 'men4' => 'Admin Checlist', - 'men5' => 'Hoja de Checlist', - 'men6' => 'Administración', - 'men61' => 'Administración del Sistema', - 'men7' => 'Administrar Usuarios', - 'garantiasHP' => 'Garantias de HP', - 'men8' => 'Opciones de Checklist', - 'men9' => 'Áreas', - 'men10' => 'Modelos', - 'men11' => 'Orden de Compra', - 'men12' => 'Estaciones', - 'men13' => 'Configuraciones', - 'menrepM' => 'Reportes', - 'menrep1' => 'Reporte Total', - 'menrep2' => 'Reporte Estaciones', - 'menError' => 'Errores y Sugerencias', - 'whoops' => '¡Ups!', - 'problemlog' => 'Hay un problema con tu Ingreso.', - 'sing1' => 'Ingrese para iniciar sección', - 'sing2' => 'Correo', - 'sing3' => 'Clave', - 'sing4' => 'Recuérdame', - 'sing5' => 'Olvide mi clave', - 'sing6' => 'Registre un nuevo miembro', - 'sing7' => 'Nombre Completo', - 'sing8' => 'Reescriba su clave', - 'sing9' => 'Estoy de acuerdo a ', - 'sing10' => 'términos', - 'sing11' => 'Regístreme', - 'sing12' => 'avianca\[usuario]', - 'alert1' => 'El usuario no tiene Permiso para esta acción, solicite cambio de permisos por favor, su usuario tiene permiso de {:name} y necesita {:name2}', - 'home0qw' => 'Bienvenido, usted está dentro del sistema', - 'recuppass' => 'Presiona aquí para recuperar clave:', - 'facebook1' => 'Firmarse Usando FaceBook', - 'reco1' => 'Recuperar clave', - 'reco2' => 'Resetear Clave', - 'reco3' => 'Enviar password', - 'o' => '- O -', - 'sesinvetecu' => 'SES Inventarios Ecuador', - 'descripcion' => 'Este sistema de SES Ecuador, tiene la capacidad de manejar inventario tanto de máquinas como cualquier otro tipo de activo. Tiene implementado un Checklist para manejo de órdenes de trabajo y configuraciones especiales de máquinas', - 'url' => env('APP_URL', 'http://localhost').'/', - 'comenzar' => 'Ingresar', - 'equipo2r' => 'Equipos Registrados', - 'equipo3r' => 'Unidades', - 'equipo4r' => 'Usuarios', - 'equipo5r' => 'Máquinas asignadas', - 'equipo6r' => 'Custodios', - 'equipo7r' => 'Máquinas por Estación', - 'footer1j' => 'Sistema de Inventario', - 'Copyrightw1' => 'Copyright © 2017', - 'creadopor4' => 'Created by', - 'autor' => 'Wagner Cadena', - 'equipo1c' => 'Desarrollo', - 'equipo2c' => 'Aerogal', - 'mensaje_custodio' => '{0} No hay mensajes pendientes|{1} Hay un mensaje pendiente|[2,*] Hay :custodios mensajes pendientes', - 'mensaje_custodio_a' => '{1} Un Custodio|[2,*] Hay :custodios Custodios', - 'mensaje_custodio_b' => 'Pendientes de enviar la Notificación', - 'mensaje_custodio_b1' => 'Hace :hora min', - 'mensaje_custodio_c' => 'Envía Notificaciones', - 'empresa' => 'Empresa', + 'init1' => 'Sistema de Inventario de máquinas', + 'init2' => '', + 'init3' => 'Esta aquí', + 'url1' => 'Sistema de Inventarios SES Ecuador', + 'url2' => 'El título del sitio Aquí', + 'logo1' => 'EC', + 'logo2' => 'SES Inventarios', + 'logo3' => 'SESInventarios', + 'usu1' => 'Su rol es: ', + 'profile' => 'Perfil', + 'salir' => 'Salir', + 'seguidores' => 'Informes', + 'ventas' => 'Actividad', + 'amigos' => 'Reportes', + 'login' => 'Ingresar', + 'register' => 'Registrarse', + 'men1' => 'Bienvenido', + 'men2' => 'Equipos', + 'men3' => 'Custodios', + 'men4' => 'Admin Checlist', + 'men5' => 'Hoja de Checlist', + 'men6' => 'Administración', + 'men61' => 'Administración del Sistema', + 'men7' => 'Administrar Usuarios', + 'garantiasHP' => 'Garantias de HP', + 'men8' => 'Opciones de Checklist', + 'men9' => 'Áreas', + 'men10' => 'Modelos', + 'men11' => 'Orden de Compra', + 'men12' => 'Estaciones', + 'men13' => 'Configuraciones', + 'menrepM' => 'Reportes', + 'menrep1' => 'Reporte Total', + 'menrep2' => 'Reporte Estaciones', + 'menError' => 'Errores y Sugerencias', + 'whoops' => '¡Ups!', + 'problemlog' => 'Hay un problema con tu Ingreso.', + 'sing1' => 'Ingrese para iniciar sección', + 'sing2' => 'Correo', + 'sing3' => 'Clave', + 'sing4' => 'Recuérdame', + 'sing5' => 'Olvide mi clave', + 'sing6' => 'Registre un nuevo miembro', + 'sing7' => 'Nombre Completo', + 'sing8' => 'Reescriba su clave', + 'sing9' => 'Estoy de acuerdo a ', + 'sing10' => 'términos', + 'sing11' => 'Regístreme', + 'sing12' => 'avianca\[usuario]', + 'alert1' => 'El usuario no tiene Permiso para esta acción, solicite cambio de permisos por favor, su usuario tiene permiso de {:name} y necesita {:name2}', + 'home0qw' => 'Bienvenido, usted está dentro del sistema', + 'recuppass' => 'Presiona aquí para recuperar clave:', + 'facebook1' => 'Firmarse Usando FaceBook', + 'reco1' => 'Recuperar clave', + 'reco2' => 'Resetear Clave', + 'reco3' => 'Enviar password', + 'o' => '- O -', + 'sesinvetecu' => 'SES Inventarios Ecuador', + 'descripcion' => 'Este sistema de SES Ecuador, tiene la capacidad de manejar inventario tanto de máquinas como cualquier otro tipo de activo. Tiene implementado un Checklist para manejo de órdenes de trabajo y configuraciones especiales de máquinas', + 'url' => env('APP_URL', 'http://localhost').'/', + 'comenzar' => 'Ingresar', + 'equipo2r' => 'Equipos Registrados', + 'equipo3r' => 'Unidades', + 'equipo4r' => 'Usuarios', + 'equipo5r' => 'Máquinas asignadas', + 'equipo6r' => 'Custodios', + 'equipo7r' => 'Máquinas por Estación', + 'footer1j' => 'Sistema de Inventario', + 'Copyrightw1' => 'Copyright © 2017', + 'creadopor4' => 'Created by', + 'autor' => 'Wagner Cadena', + 'equipo1c' => 'Desarrollo', + 'equipo2c' => 'Aerogal', + 'mensaje_custodio' => '{0} No hay mensajes pendientes|{1} Hay un mensaje pendiente|[2,*] Hay :custodios mensajes pendientes', + 'mensaje_custodio_a' => '{1} Un Custodio|[2,*] Hay :custodios Custodios', + 'mensaje_custodio_b' => 'Pendientes de enviar la Notificación', + 'mensaje_custodio_b1' => 'Hace :hora min', + 'mensaje_custodio_c' => 'Envía Notificaciones', + 'empresa' => 'Empresa', ]; - diff --git a/resources/lang/es/message.php b/resources/lang/es/message.php index 29c8fd60..0626bb66 100644 --- a/resources/lang/es/message.php +++ b/resources/lang/es/message.php @@ -1,12 +1,12 @@ 'Hola', - 'verifica_correo' => 'Verifica tu correo', - 'verifica_correo_line1' => 'Verifica tu correo por favor, esto te permitira ingresar al sistema.', - 'verifica_correo_fin' => 'Sin embargo si usted no realizo esta accion, por favor no realice ninguna accion.', - 'notifica_saludo' => 'Hola', - 'notifica_correo' => 'Notificacion de Cambio de Equipos de activos fijos', - 'notifica_correo_line1' => 'Se a realizado un cambio de Equipo en el sistema de activos fijos.', - 'notifica_correo_fin' => 'Revice el correo adjunto de los equipos asignado a usted.', + 'verifica_saludo' => 'Hola', + 'verifica_correo' => 'Verifica tu correo', + 'verifica_correo_line1' => 'Verifica tu correo por favor, esto te permitira ingresar al sistema.', + 'verifica_correo_fin' => 'Sin embargo si usted no realizo esta accion, por favor no realice ninguna accion.', + 'notifica_saludo' => 'Hola', + 'notifica_correo' => 'Notificacion de Cambio de Equipos de activos fijos', + 'notifica_correo_line1' => 'Se a realizado un cambio de Equipo en el sistema de activos fijos.', + 'notifica_correo_fin' => 'Revice el correo adjunto de los equipos asignado a usted.', ]; diff --git a/resources/lang/es/pagination.php b/resources/lang/es/pagination.php index f8f044e1..325916dc 100644 --- a/resources/lang/es/pagination.php +++ b/resources/lang/es/pagination.php @@ -14,6 +14,6 @@ */ 'previous' => '« Anterior', - 'next' => 'Siguiente »', + 'next' => 'Siguiente »', ]; diff --git a/resources/lang/es/passwords.php b/resources/lang/es/passwords.php index 2c441df5..4c3a294b 100644 --- a/resources/lang/es/passwords.php +++ b/resources/lang/es/passwords.php @@ -14,9 +14,9 @@ */ 'password' => 'Las contraseñas deben tener al menos seis caracteres y coincidir con la confirmación.', - 'reset' => '¡Tu contraseña ha sido restablecida!', - 'sent' => '¡Le hemos enviado por correo electrónico el enlace de restablecimiento de contraseña!', - 'token' => 'Este token de restablecimiento de contraseña no es válido.', - 'user' => "No podemos encontrar un usuario con esa dirección de correo electrónico.", + 'reset' => '¡Tu contraseña ha sido restablecida!', + 'sent' => '¡Le hemos enviado por correo electrónico el enlace de restablecimiento de contraseña!', + 'token' => 'Este token de restablecimiento de contraseña no es válido.', + 'user' => 'No podemos encontrar un usuario con esa dirección de correo electrónico.', ]; diff --git a/resources/lang/es/rep.php b/resources/lang/es/rep.php index 109e4574..e22f3325 100644 --- a/resources/lang/es/rep.php +++ b/resources/lang/es/rep.php @@ -2,31 +2,29 @@ return [ - - 'modelo' => 'Modelo', - 'ordenCompra' => 'Orden de Compra', - 'nombre_responsable' => 'Nombre Custodio', - 'area_piso' => 'Área de Custodio', - 'ciudad' => 'Ciudad de Custodio', - 'estacion' => 'Estación', - 'area' => 'Área', - 'num_cajas' => 'Número de Caja', - 'sociedad' => 'Sociedad', - 'no_serie' => 'N° de Serie', - 'codigo_barras' => 'Código de Barras', - 'codigo_avianca' => 'Código Avianca', - 'codigo_otro' => 'Código Otro', - 'descripcion' => 'Descripción', - 'ip' => 'IP', - 'estado' => 'Estado', - 'estatus' => 'Status', - 'garantia' => 'Garantía', - 'observaciones' => 'Observaciones', - 'sistema_operativo' => 'Sistema Operativo', - 'fecha_orden_compra' => 'Fecha de orden de compra', - 'Excel' => 'Excel', - '' => '', - '' => '', - '' => '', -] - ?> \ No newline at end of file + 'modelo' => 'Modelo', + 'ordenCompra' => 'Orden de Compra', + 'nombre_responsable' => 'Nombre Custodio', + 'area_piso' => 'Área de Custodio', + 'ciudad' => 'Ciudad de Custodio', + 'estacion' => 'Estación', + 'area' => 'Área', + 'num_cajas' => 'Número de Caja', + 'sociedad' => 'Sociedad', + 'no_serie' => 'N° de Serie', + 'codigo_barras' => 'Código de Barras', + 'codigo_avianca' => 'Código Avianca', + 'codigo_otro' => 'Código Otro', + 'descripcion' => 'Descripción', + 'ip' => 'IP', + 'estado' => 'Estado', + 'estatus' => 'Status', + 'garantia' => 'Garantía', + 'observaciones' => 'Observaciones', + 'sistema_operativo' => 'Sistema Operativo', + 'fecha_orden_compra' => 'Fecha de orden de compra', + 'Excel' => 'Excel', + '' => '', + '' => '', + '' => '', +]; diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index faf04411..27dc0663 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -82,11 +82,11 @@ 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], - 'string' => 'El :attribute debe ser una cadena de caracteres.', - 'timezone' => 'El :attribute debe ser una zona valida.', - 'unique' => 'El :attribute ya ha sido tomado anteriormente.', - 'uploaded' => 'El :attribute fallo al subir.', - 'url' => 'El :attribute es un formato invalido(URL).', + 'string' => 'El :attribute debe ser una cadena de caracteres.', + 'timezone' => 'El :attribute debe ser una zona valida.', + 'unique' => 'El :attribute ya ha sido tomado anteriormente.', + 'uploaded' => 'El :attribute fallo al subir.', + 'url' => 'El :attribute es un formato invalido(URL).', 'is_jpg' => 'The :attribute no es jpg.', 'imageable' => 'El texto :attribute no es jpg, revisar el texto data:image/jpeg;base64 .', diff --git a/resources/views/directory/custodio/create.blade.php b/resources/views/directory/custodio/create.blade.php index dc20a283..955b0327 100644 --- a/resources/views/directory/custodio/create.blade.php +++ b/resources/views/directory/custodio/create.blade.php @@ -1,123 +1,123 @@ -@extends('layouts.master') - - - -@section('content') - - - -

@lang('fo.create_new_custodio')

- -
- - - - {!! Form::open(['url' => 'custodio', 'class' => 'form-horizontal']) !!} - - - -
- {!! Form::label('nombre_responsable', trans('fo.nombre_responsable'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('nombre_responsable', null, ['class' => 'form-control']) !!} - {!! $errors->first('nombre_responsable', '

:message

') !!} -
-
-
- {!! Form::label('ciudad',trans('fo.ciudad') , ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('ciudad', null, ['class' => 'form-control']) !!} - {!! $errors->first('ciudad', '

:message

') !!} -
-
-
- {!! Form::label('direccion', trans('fo.direccion'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('direccion', null, ['class' => 'form-control']) !!} - {!! $errors->first('direccion', '

:message

') !!} -
-
-
- {!! Form::label('area_piso',trans('fo.area_piso') , ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::select('area_piso', $areas, null, ['class' => 'chosen-select form-control']) !!} - {!! $errors->first('area_piso', '

:message

') !!} -
-
-
- {!! Form::label('documentoIdentificacion', trans('fo.documentoIdentificacion'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('documentoIdentificacion', null, ['class' => 'form-control']) !!} - {!! $errors->first('documentoIdentificacion', '

:message

') !!} -
-
-
- {!! Form::label('cargo', trans('fo.cargo'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('cargo', null, ['class' => 'form-control']) !!} - {!! $errors->first('cargo', '

:message

') !!} -
-
-
- {!! Form::label('compania', trans('fo.compania'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('compania', Auth::user()->empresa, ['class' => 'form-control', 'readonly' => 'readonly']) !!} - {!! $errors->first('compania', '

:message

') !!} -
-
-
- {!! Form::label('telefono', trans('fo.telefono'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('telefono', null, ['class' => 'form-control']) !!} - {!! $errors->first('telefono', '

:message

') !!} -
-
-
- {!! Form::label('email', trans('fo.email'), ['class' => 'col-sm-3 control-label']) !!} -
- {!! Form::text('email', null, ['class' => 'form-control']) !!} - {!! $errors->first('email', '

:message

') !!} -
-
-
- {!! Form::label('estado', trans('fo.estado'), ['class' => 'col-sm-3 control-label']) !!} -
- 'form-control']); ?> - {!! $errors->first('estado', '

:message

') !!} -
-
- - - - -
- -
- - {!! Form::submit(trans('fo.Create'), ['class' => 'btn btn-primary form-control']) !!} - -
- -
- - {!! Form::close() !!} - - - - @if ($errors->any()) - - - - @endif - - - +@extends('layouts.master') + + + +@section('content') + + + +

@lang('fo.create_new_custodio')

+ +
+ + + + {!! Form::open(['url' => 'custodio', 'class' => 'form-horizontal']) !!} + + + +
+ {!! Form::label('nombre_responsable', trans('fo.nombre_responsable'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('nombre_responsable', null, ['class' => 'form-control']) !!} + {!! $errors->first('nombre_responsable', '

:message

') !!} +
+
+
+ {!! Form::label('ciudad',trans('fo.ciudad') , ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('ciudad', null, ['class' => 'form-control']) !!} + {!! $errors->first('ciudad', '

:message

') !!} +
+
+
+ {!! Form::label('direccion', trans('fo.direccion'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('direccion', null, ['class' => 'form-control']) !!} + {!! $errors->first('direccion', '

:message

') !!} +
+
+
+ {!! Form::label('area_piso',trans('fo.area_piso') , ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::select('area_piso', $areas, null, ['class' => 'chosen-select form-control']) !!} + {!! $errors->first('area_piso', '

:message

') !!} +
+
+
+ {!! Form::label('documentoIdentificacion', trans('fo.documentoIdentificacion'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('documentoIdentificacion', null, ['class' => 'form-control']) !!} + {!! $errors->first('documentoIdentificacion', '

:message

') !!} +
+
+
+ {!! Form::label('cargo', trans('fo.cargo'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('cargo', null, ['class' => 'form-control']) !!} + {!! $errors->first('cargo', '

:message

') !!} +
+
+
+ {!! Form::label('compania', trans('fo.compania'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('compania', Auth::user()->empresa, ['class' => 'form-control', 'readonly' => 'readonly']) !!} + {!! $errors->first('compania', '

:message

') !!} +
+
+
+ {!! Form::label('telefono', trans('fo.telefono'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('telefono', null, ['class' => 'form-control']) !!} + {!! $errors->first('telefono', '

:message

') !!} +
+
+
+ {!! Form::label('email', trans('fo.email'), ['class' => 'col-sm-3 control-label']) !!} +
+ {!! Form::text('email', null, ['class' => 'form-control']) !!} + {!! $errors->first('email', '

:message

') !!} +
+
+
+ {!! Form::label('estado', trans('fo.estado'), ['class' => 'col-sm-3 control-label']) !!} +
+ 'form-control']); ?> + {!! $errors->first('estado', '

:message

') !!} +
+
+ + + + +
+ +
+ + {!! Form::submit(trans('fo.Create'), ['class' => 'btn btn-primary form-control']) !!} + +
+ +
+ + {!! Form::close() !!} + + + + @if ($errors->any()) + + + + @endif + + + @endsection \ No newline at end of file diff --git a/resources/views/directory/equipos/index.blade.php b/resources/views/directory/equipos/index.blade.php index cb37d89e..2ec03501 100644 --- a/resources/views/directory/equipos/index.blade.php +++ b/resources/views/directory/equipos/index.blade.php @@ -1,285 +1,285 @@ -@extends('layouts.master') - -@section('htmlheader') - -@include('layouts.partials.htmlheader') - - - - - - - -@endsection - - - -@section('contentheader_aqui', 'Equipos') - -@section('content') - - - -

@lang('form.equipos')@lang('form.addnew') Equipo

- - - - - - - -
- -
- -
- - - - - - - - - - - - {{Form::select('equipoidf', array(), '',array('id' => 'equipoidf','class' => 'id_serchf form-control')) }} - - - -
- - - - - - - -
- - - -
- - - -
- - - - - - - - - - - - - - - - @php $x=0; @endphp - - @foreach($equipos as $item) - - @php $x++;@endphp - - - - - - - - - - - - - - @endforeach - - - -
@lang('form.sno')ModeloCustodioEstacioneActions
{{ $x }}{{ $item->modelo_equipoxc->modelo }}{{ $item->custodioxc['nombre_responsable'] }}{{ $item->estacionxc->estacion }} - - - - - - / - - {!! Form::open([ - - 'method'=>'DELETE', - - 'url' => ['equipos', $item->id], - - 'style' => 'display:inline' - - ]) !!} - - {!! Form::submit(trans('form.deletee'), ['class' => 'btn btn-danger btn-xs']) !!} - - {!! Form::close() !!} - -
- - - -
- - - -@endsection - -@section('scripts') - - @include('layouts.partials.scripts') - - - - - +@extends('layouts.master') + +@section('htmlheader') + +@include('layouts.partials.htmlheader') + + + + + + + +@endsection + + + +@section('contentheader_aqui', 'Equipos') + +@section('content') + + + +

@lang('form.equipos')@lang('form.addnew') Equipo

+ + + + + + + +
+ +
+ +
+ + + + + + + + + + + + {{Form::select('equipoidf', array(), '',array('id' => 'equipoidf','class' => 'id_serchf form-control')) }} + + + +
+ + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + + + + + + + + @php $x=0; @endphp + + @foreach($equipos as $item) + + @php $x++;@endphp + + + + + + + + + + + + + + @endforeach + + + +
@lang('form.sno')ModeloCustodioEstacioneActions
{{ $x }}{{ $item->modelo_equipoxc->modelo }}{{ $item->custodioxc['nombre_responsable'] }}{{ $item->estacionxc->estacion }} + + + + + + / + + {!! Form::open([ + + 'method'=>'DELETE', + + 'url' => ['equipos', $item->id], + + 'style' => 'display:inline' + + ]) !!} + + {!! Form::submit(trans('form.deletee'), ['class' => 'btn btn-danger btn-xs']) !!} + + {!! Form::close() !!} + +
+ + + +
+ + + +@endsection + +@section('scripts') + + @include('layouts.partials.scripts') + + + + + @endsection \ No newline at end of file diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index b1de6cfa..9c1cc8e6 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -1,174 +1,174 @@ - - - - - - - -REPORTE DE NOVEDADES FR-SO0702-02 - - - - - - - @php( $x=0) - @forelse($custodio->equiposhm as $item ) - @if($x==0) - @include('pdf.invoice_header') - @endif - @include('pdf.invoice_tabla_llena') - @php( $x++) - @if($x==19) - @include('pdf.invoice_footer') - @php($x=0) -
-
- - - @endif - @empty - - @endforelse - {{--footer default--}} - @while($x<19) - @php( $x++) - - - - - - - - - - - @endwhile - - @if($x==19) - @include('pdf.invoice_footer') - @php($x=0) -
-

{{$x+1}}

-
-

{{--AEROGAL--}}

-
-

-
-

{{--2k4005805--}}

-
-

-
-

{{--HP ELITE BOOK 840G3 TOUCH--}}

-
-

{{--5CG70870CJ--}}

-
-

{{--N--}}

-
- @endif -{{-- - ---}} - - - - - - + + + + + + + +REPORTE DE NOVEDADES FR-SO0702-02 + + + + + + + @php( $x=0) + @forelse($custodio->equiposhm as $item ) + @if($x==0) + @include('pdf.invoice_header') + @endif + @include('pdf.invoice_tabla_llena') + @php( $x++) + @if($x==19) + @include('pdf.invoice_footer') + @php($x=0) +
+
+ + + @endif + @empty + + @endforelse + {{--footer default--}} + @while($x<19) + @php( $x++) + + + + + + + + + + + @endwhile + + @if($x==19) + @include('pdf.invoice_footer') + @php($x=0) +
+

{{$x+1}}

+
+

{{--AEROGAL--}}

+
+

+
+

{{--2k4005805--}}

+
+

+
+

{{--HP ELITE BOOK 840G3 TOUCH--}}

+
+

{{--5CG70870CJ--}}

+
+

{{--N--}}

+
+ @endif +{{-- + +--}} + + + + + + diff --git a/routes/api.php b/routes/api.php index 2d1eece9..8f21504d 100644 --- a/routes/api.php +++ b/routes/api.php @@ -24,38 +24,36 @@ #adminlte_api_routes });*/ -Route::resource('users', 'api\UserController',['excepto' => 'create,edit']); +Route::resource('users', 'api\UserController', ['excepto' => 'create,edit']); Route::get('users/verificar', 'api\UserController@verify'); Route::get('usuario', 'api\UserController@usuario'); -Route::resource('info', 'api\InformeMantenimientoPreventivoController',['excepto' => 'create,edit']); - +Route::resource('info', 'api\InformeMantenimientoPreventivoController', ['excepto' => 'create,edit']); //Route::post('oauth/token','\Laravel\Passport\Http\Controllers\AccessTokenController@issueToken'); - -Route::resource('puestos', 'api\PuestoController',['excepto' => 'create']); +Route::resource('puestos', 'api\PuestoController', ['excepto' => 'create']); Route::resource('puestos.custodios', 'api\PuestoCustodioController'); -Route::resource('ubicacions', 'api\UbicacionController',['excepto' => 'create']); +Route::resource('ubicacions', 'api\UbicacionController', ['excepto' => 'create']); Route::get('puesto_asigna', 'api\PuestoCustodioController@asigna'); Route::get('puesto_liberar', 'api\PuestoCustodioController@liberar'); -Route::resource('custodios', 'api\CustodioController', ['only' => ['index', 'show','store']]); +Route::resource('custodios', 'api\CustodioController', ['only' => ['index', 'show', 'store']]); Route::resource('custodios.puestos', 'api\CustodioPuestoController'); Route::get('custodiosCedula', 'api\CustodioController@cedula'); Route::get('custodiosBuscar', 'api\CustodioController@persona'); -Route::post('custodiosSetImage','api\CustodioController@storeImagen'); +Route::post('custodiosSetImage', 'api\CustodioController@storeImagen'); -Route::resource('/empresas', 'api\EmpresaController',['excepto' => 'create']); -Route::resource('/areas', 'api\AreasController',['only' => ['index', 'show','store'],'parameters' => [ - 'areas' => 'areas']]); -Route::resource('/equipos', 'api\EquiposController',['only' => ['index', 'show','store'],'parameters' => [ - 'equipos' => 'equipos']]); -Route::resource('/equipos.checkList', 'api\EquipoCheckListController',['only' => ['index','store'],'parameters' => [ - 'equipos' => 'equipos']]); +Route::resource('/empresas', 'api\EmpresaController', ['excepto' => 'create']); +Route::resource('/areas', 'api\AreasController', ['only' => ['index', 'show', 'store'], 'parameters' => [ + 'areas' => 'areas', ]]); +Route::resource('/equipos', 'api\EquiposController', ['only' => ['index', 'show', 'store'], 'parameters' => [ + 'equipos' => 'equipos', ]]); +Route::resource('/equipos.checkList', 'api\EquipoCheckListController', ['only' => ['index', 'store'], 'parameters' => [ + 'equipos' => 'equipos', ]]); Route::get('equipo_no_serie', 'api\EquiposController@equipo_no_serie'); -Route::resource('/checkList', 'api\CheckListController',['only' => ['index', 'show','store']]); -Route::resource('/check_list__opciones_check_lists', 'api\CheckList_OpcionesCheckListController',['only' => ['index', 'show','store']]); +Route::resource('/checkList', 'api\CheckListController', ['only' => ['index', 'show', 'store']]); +Route::resource('/check_list__opciones_check_lists', 'api\CheckList_OpcionesCheckListController', ['only' => ['index', 'show', 'store']]); diff --git a/routes/web.php b/routes/web.php index 08d49afd..7ee82e72 100644 --- a/routes/web.php +++ b/routes/web.php @@ -21,19 +21,19 @@ // }); //Please do not remove this if you want adminlte:route and adminlte:link commands to works correctly. - #adminlte_routes + //adminlte_routes }); ////////////////////////////////////////////////////////////////////////////////////////////////////// Route::get('/home', 'HomeController@index'); -/** +/* * del usuariologin * https://packagist.org/packages/jaapmoolenaar.nl/crud-generator * php artisan crud:controller UsuarioLogController --crud-name=usuario --model-name=User --view-path=directory * php artisan crud:view usuario --fields=name:string,first_name:string,last_name:string,rol:boolean,padrino:boolean,username:string,email:email,password:password --view-path=directory */ Route::resource('usuario', 'UsuarioLogController'); -/** +/* * fin usuariologin */ Route::resource('opciones_check', 'OpcionesCheckListController'); @@ -42,7 +42,7 @@ Route::resource('orden', 'OrdenDeCompraController'); Route::resource('equipos', 'EquiposController'); -Route::get('equipos/{id}/image','EquiposController@showPicture'); +Route::get('equipos/{id}/image', 'EquiposController@showPicture'); Route::resource('custodio', 'CustodiosController'); Route::resource('estaciones', 'EstacionesController'); @@ -55,23 +55,23 @@ Route::get('checklist_editar/{area_id}/{checklist}', 'CheckListController@editarChecklist'); Route::post('checklist_editar/{area_id}/{checklist}', 'CheckListController@editarChecklist'); - Route::resource('equiposerching', 'EquiposController@home'); Route::resource('postSearch', 'EquiposController@postSearch'); Route::get('tags', function (Illuminate\Http\Request $request) { $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\Equipos::where('no_serie', 'like', '%'.$term.'%')-> + $term = str_replace(' ', '%', "$term"); + $tags = App\Equipos::where('no_serie', 'like', '%'.$term.'%')-> orwhere('codigo_barras', 'like', '%'.$term.'%')-> orwhere('codigo_otro', 'like', '%'.$term.'%')-> orwhere('descripcion', 'like', '%'.$term.'%')-> orwhere('ip', 'like', '%'.$term.'%')-> - orwhere('codigo_avianca', 'like', '%'.$term.'%')->pluck('no_serie','id'); + orwhere('codigo_avianca', 'like', '%'.$term.'%')->pluck('no_serie', 'id'); $valid_tags = []; foreach ($tags as $id => $tag) { $valid_tags[] = ['id' => $id, 'text' => $tag]; } + return \Response::json($valid_tags); }); @@ -84,42 +84,45 @@ Route::get('tags_custodio', function (Illuminate\Http\Request $request) { $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\Custodios::where('nombre_responsable', 'like', '%'.$term.'%')-> + $term = str_replace(' ', '%', "$term"); + $tags = App\Custodios::where('nombre_responsable', 'like', '%'.$term.'%')-> orwhere('cargo', 'like', '%'.$term.'%')-> - orwhere('area_piso', 'like', '%'.$term.'%')->pluck('nombre_responsable','id'); + orwhere('area_piso', 'like', '%'.$term.'%')->pluck('nombre_responsable', 'id'); $valid_tags = []; foreach ($tags as $id => $tag) { $valid_tags[] = ['id' => $id, 'text' => $tag]; } + return \Response::json($valid_tags); }); Route::get('tags_checklist', function (Illuminate\Http\Request $request) { $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\CheckList_OpcionesCheckList::where('valor1', 'like', '%'.$term.'%')-> + $term = str_replace(' ', '%', "$term"); + $tags = App\CheckList_OpcionesCheckList::where('valor1', 'like', '%'.$term.'%')-> orwhere('valor2', 'like', '%'.$term.'%')-> orwhere('valor3', 'like', '%'.$term.'%')-> - orwhere('valor4', 'like', '%'.$term.'%')->pluck('atributo','id'); + orwhere('valor4', 'like', '%'.$term.'%')->pluck('atributo', 'id'); $valid_tags = []; foreach ($tags as $id => $tag) { $valid_tags[] = ['id' => $id, 'text' => $tag]; } + return \Response::json($valid_tags); }); Route::get('tags_model', function (Illuminate\Http\Request $request) { $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\CheckList_OpcionesCheckList::where('valor1', 'like', '%'.$term.'%')-> + $term = str_replace(' ', '%', "$term"); + $tags = App\CheckList_OpcionesCheckList::where('valor1', 'like', '%'.$term.'%')-> orwhere('valor2', 'like', '%'.$term.'%')-> orwhere('valor3', 'like', '%'.$term.'%')-> - orwhere('valor4', 'like', '%'.$term.'%')->pluck('atributo','id'); + orwhere('valor4', 'like', '%'.$term.'%')->pluck('atributo', 'id'); $valid_tags = []; foreach ($tags as $id => $tag) { $valid_tags[] = ['id' => $id, 'text' => $tag]; } + return \Response::json($valid_tags); }); @@ -129,42 +132,41 @@ Route::get('reasignarindexecho', 'EquiposController@reasignarindexecho'); Route::post('reasignarindexecho', 'EquiposController@reasignarindexecho'); - Route::name('pdf')->get('pdf/{custodio_id}', 'PdfController@invoice'); Route::get('pdf_custom/{token_unico}', 'PdfController@invoiceCustom'); Route::get('checklist_crear_mini/{area_id}/{checklist}', 'CheckListController@crearChecklist_mini'); Route::post('checklist_crear_mini/{area_id}/{checklist}', 'CheckListController@crearChecklist_mini'); - Route::resource('checklist_opcionescheck', 'CheckList_OpcionesCheckListController'); //Route::get('checklist_crear_option', 'CheckListController@crearChecklist'); //Route::post('checklist_crear_option', 'CheckListController@crearChecklist'); // API ROUTES ================================== -Route::group(array('prefix' => 'api'), function() { +Route::group(['prefix' => 'api'], function () { Route::get('checklist_crear_option/{id}', 'CheckList_OpcionesCheckListController@crearChecklist_option_create'); Route::post('checklist_crear_option', 'CheckList_OpcionesCheckListController@crearChecklist_option_storage'); Route::delete('checklist_crear_option/{id}/delete', 'CheckList_OpcionesCheckListController@crearChecklist_option_delete'); }); Route::get('tags_model_tipo', function (Illuminate\Http\Request $request) { - $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\ModeloEquipo::where('tipo_equipo', 'like', '%'.$term.'%') + $term = str_replace(' ', '%', "$term"); + $tags = App\ModeloEquipo::where('tipo_equipo', 'like', '%'.$term.'%') ->select(DB::raw('tipo_equipo')) ->groupby('tipo_equipo') ->get(); + return response()->json($tags, 200); }); Route::get('tags_model_modelo', function (Illuminate\Http\Request $request) { $term = $request->term ?: ''; - $term = str_replace(" ", "%", "$term"); - $tags= App\ModeloEquipo::where('modelo', 'like', '%'.$term.'%') + $term = str_replace(' ', '%', "$term"); + $tags = App\ModeloEquipo::where('modelo', 'like', '%'.$term.'%') ->select(DB::raw('modelo')) ->groupby('modelo')->get(); + return \Response::json($tags); }); @@ -191,19 +193,16 @@ Route::post('users/store', 'api\UserController@store'); Route::get('oautho2', function (Illuminate\Http\Request $request) { - return view('oauth2'); -})->middleware('auth')->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas');; - - + return view('oauth2'); +})->middleware('auth')->middleware('authEmp:administrador;system;planta_fisica;recursos_humanos;encargado_activos_fijos;sistemas'); Route::get('pusher', function (Request $request) { + Vinkla\Pusher\Facades\Pusher::trigger('my-channel', 'my-event', ['message' => 'Hola tewst laravel']); - Vinkla\Pusher\Facades\Pusher::trigger('my-channel', 'my-event', ['message' => "Hola tewst laravel"]); - - $options = array( - 'cluster' => 'us2', - 'encrypted' => true - ); + $options = [ + 'cluster' => 'us2', + 'encrypted' => true, + ]; $pusher = new Pusher\Pusher( 'b320838d82f185dbab9d', '552daa7dde66a26359ab', @@ -214,52 +213,49 @@ $data['message'] = 'hello world'; $pusher->trigger('my-channel', 'my-event', $data); - return "Manda mensaje pusher"; + return 'Manda mensaje pusher'; }); Route::get('fire-test', function (Request $request) { - - $DEFAULT_URL = env('FIRE_DATABASE_URL');// 'https://inventario-352a6.firebaseio.com'; - $DEFAULT_TOKEN = env('FIRE_DATABASE_SECRET');//'0KGnKhp8pLGa2Mtzm14KkOpENc1Sw5eQIagN33xQ'; //https://console.firebase.google.com/project/inventario-352a6/settings/serviceaccounts/databasesecrets?hl=es-419 + $DEFAULT_URL = env('FIRE_DATABASE_URL'); // 'https://inventario-352a6.firebaseio.com'; + $DEFAULT_TOKEN = env('FIRE_DATABASE_SECRET'); //'0KGnKhp8pLGa2Mtzm14KkOpENc1Sw5eQIagN33xQ'; //https://console.firebase.google.com/project/inventario-352a6/settings/serviceaccounts/databasesecrets?hl=es-419 $DEFAULT_PATH = '/firebase/example'; /**/ $firebase = new \Firebase\FirebaseLib($DEFAULT_URL, $DEFAULT_TOKEN); - -// --- storing an array --- - $test = array( - "foo" => "bar", - "i_love" => "lamp", - "id" => 42 - ); + // --- storing an array --- + $test = [ + 'foo' => 'bar', + 'i_love' => 'lamp', + 'id' => 42, + ]; $dateTime = new DateTime(); //$firebase->set($DEFAULT_PATH . '/' . $dateTime->format('c'), $test); //dd($firebase); -// --- storing a string --- + // --- storing a string --- //$firebase->set($DEFAULT_PATH . '/name/contact001', "John Doe"); -// --- reading the stored string --- - $name = $firebase->get($DEFAULT_PATH . '/name/contact001'); + // --- reading the stored string --- + $name = $firebase->get($DEFAULT_PATH.'/name/contact001'); -/* + /* + $p = new \App\Puesto(); + $p->ubicacion_id=1; + $p->codigo="asd7"; + $p->estado= "LIBRE"; + $p->save(); + */ $p = new \App\Puesto(); - $p->ubicacion_id=1; - $p->codigo="asd7"; - $p->estado= "LIBRE"; - $p->save(); -*/ -$p = new \App\Puesto(); -$p->find(7); -$p->estado= "OCUPADO"; -$p->update(); + $p->find(7); + $p->estado = 'OCUPADO'; + $p->update(); dd($name); //dd($firebase); - return "Manda mensaje firebase"; - + return 'Manda mensaje firebase'; }); Route::post('busqueda', 'BusquedaController@busqueda'); @@ -270,7 +266,6 @@ Route::name('enviar_notificaciones')->get('enviar_notificaciones', 'CustodiosController@indexnotificaciones'); - Route::name('verify_custodio')->get('custodio/verify/{token}', 'CustodiosController@verify'); Route::name('resend_custodio')->get('custodio/{custodios}/resend', 'CustodiosController@resend'); @@ -278,18 +273,17 @@ Route::get('sendNotificacion', 'api\CustodioController@cedula'); -Route::name('garantiasHP')->get('garantiasHP','EquiposController@garantiasHP'); +Route::name('garantiasHP')->get('garantiasHP', 'EquiposController@garantiasHP'); Route::get('/redirect', 'Auth\Oauth2Controller@redirect'); Route::get('/callback', 'Auth\Oauth2Controller@callback'); Route::name('OauthFinal')->get('oauth_final', function (Request $request) { - return view('oauth2_final'); + return view('oauth2_final'); }); -Route::get('imagenUbicacion','UbicacionController@daImagen'); - +Route::get('imagenUbicacion', 'UbicacionController@daImagen'); -Route::resource('roles','RolController'); -Route::resource('empresa','EmpresaController'); +Route::resource('roles', 'RolController'); +Route::resource('empresa', 'EmpresaController'); diff --git a/server.php b/server.php index 5fb6379e..20bc389f 100644 --- a/server.php +++ b/server.php @@ -1,12 +1,10 @@ */ - $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); diff --git a/tests/Browser/AcachaAdmintLTELaravelTest.php b/tests/Browser/AcachaAdmintLTELaravelTest.php index 4e828a7c..6302286a 100644 --- a/tests/Browser/AcachaAdmintLTELaravelTest.php +++ b/tests/Browser/AcachaAdmintLTELaravelTest.php @@ -2,15 +2,13 @@ namespace Tests\Browser; +use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Support\Facades\Hash; -use Tests\DuskTestCase; use Laravel\Dusk\Browser; -use Illuminate\Foundation\Testing\DatabaseMigrations; +use Tests\DuskTestCase; /** * Class AcachaAdmintLTELaravelTest. - * - * @package Tests\Browser */ class AcachaAdmintLTELaravelTest extends DuskTestCase { diff --git a/tests/Feature/AcachaAdminLTELaravelTest.php b/tests/Feature/AcachaAdminLTELaravelTest.php index 4ce61789..07d5db97 100644 --- a/tests/Feature/AcachaAdminLTELaravelTest.php +++ b/tests/Feature/AcachaAdminLTELaravelTest.php @@ -2,19 +2,15 @@ namespace Tests\Feature; +use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Hash; use ReflectionException; use Tests\TestCase; -use Illuminate\Foundation\Testing\WithoutMiddleware; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; /** * Class AcachaAdminLTELaravelTest. - * - * @package Tests\Feature */ class AcachaAdminLTELaravelTest extends TestCase { @@ -77,8 +73,6 @@ public function urlReturns401($url) $this->urlReturnsCode($url, 401); } - - /** * Test url returns a specific status code. * @@ -170,18 +164,18 @@ public function testUserApi() public function testNewUserRegistration() { $response = $this->json('POST', '/register', [ - 'name' => 'Sergi Tur Badenas', - 'email' => 'sergiturbadenas@gmail.com', - 'terms' => 'true', - 'password' => 'passw0RD', + 'name' => 'Sergi Tur Badenas', + 'email' => 'sergiturbadenas@gmail.com', + 'terms' => 'true', + 'password' => 'passw0RD', 'password_confirmation' => 'passw0RD', ]); $response->assertStatus(302); $this->assertDatabaseHas('users', [ - 'name' => 'Sergi Tur Badenas', - 'email' => 'sergiturbadenas@gmail.com' + 'name' => 'Sergi Tur Badenas', + 'email' => 'sergiturbadenas@gmail.com', ]); } @@ -193,17 +187,17 @@ public function testNewUserRegistration() public function testNewUserRegistrationRequiredFields() { $response = $this->json('POST', '/register', [ - 'name' => '', - 'email' => '', - 'password' => '', + 'name' => '', + 'email' => '', + 'password' => '', 'password_confirmation' => '', ]); $response->assertStatus(422)->assertJson([ - 'name' => [ "The name field is required." ], - 'email' => [ "The email field is required." ], - 'password' => [ "The password field is required." ], - 'terms' => [ "The terms field is required." ], + 'name' => ['The name field is required.'], + 'email' => ['The email field is required.'], + 'password' => ['The password field is required.'], + 'terms' => ['The terms field is required.'], ]); } @@ -217,7 +211,7 @@ public function testLogin() $user = factory(\App\User::class)->create(['password' => Hash::make('passw0RD')]); $response = $this->json('POST', '/login', [ - 'email' => $user->email, + 'email' => $user->email, 'password' => 'passw0RD', ]); @@ -232,12 +226,12 @@ public function testLogin() public function testLoginFailed() { $response = $this->json('POST', '/login', [ - 'email' => 'sergiturbadenas@gmail.com', + 'email' => 'sergiturbadenas@gmail.com', 'password' => 'passw0RDinventatquenopotfuncionat', ]); $response->assertStatus(422)->assertJson([ - "email" => "These credentials do not match our records." + 'email' => 'These credentials do not match our records.', ]); } @@ -249,31 +243,31 @@ public function testLoginFailed() public function testLoginRequiredFields() { $response = $this->json('POST', '/login', [ - 'email' => '', + 'email' => '', 'password' => '', ]); $response->assertStatus(422)->assertJson([ - 'email' => [ "The email field is required." ], - 'password' => [ "The password field is required." ], + 'email' => ['The email field is required.'], + 'password' => ['The password field is required.'], ]); } /** - * Test make:view command - * + * Test make:view command. */ public function testMakeViewCommand() { $view = 'ehqwiqweiohqweihoqweiohqweiojhqwejioqwejjqwe'; - $viewPath= 'views/' . $view . '.blade.php'; + $viewPath = 'views/'.$view.'.blade.php'; + try { unlink(resource_path($view)); } catch (\Exception $e) { } $this->callArtisanMakeView($view); $resultAsText = Artisan::output(); - $expectedOutput = 'File ' . resource_path($viewPath) . ' created'; + $expectedOutput = 'File '.resource_path($viewPath).' created'; $this->assertEquals($expectedOutput, trim($resultAsText)); $this->assertFileExists(resource_path($viewPath)); $this->callArtisanMakeView($view); @@ -295,13 +289,14 @@ protected function callArtisanMakeView($view) } /** - * Test adminlte:admin command + * Test adminlte:admin command. * * @group */ public function testAdminlteAdminCommand() { $seed = database_path('seeds/AdminUserSeeder.php'); + try { unlink($seed); } catch (\Exception $e) { @@ -310,7 +305,6 @@ public function testAdminlteAdminCommand() $this->assertFileExists($seed); } - /** * Call adminlte:admin command. */ diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 486dc271..8fbf3706 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,9 +3,6 @@ namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\WithoutMiddleware; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; class ExampleTest extends TestCase { diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index c192d266..64af7819 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class UserTest extends TestCase { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 5663bb49..06ece2c2 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -3,8 +3,6 @@ namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; class ExampleTest extends TestCase { diff --git a/tests/Unit/UserTest.php b/tests/Unit/UserTest.php index a2a27684..d858b439 100644 --- a/tests/Unit/UserTest.php +++ b/tests/Unit/UserTest.php @@ -3,7 +3,6 @@ namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class UserTest extends TestCase {