Skip to content

Commit

Permalink
Merge pull request #5 from MikeLG909/main
Browse files Browse the repository at this point in the history
Prime
  • Loading branch information
MikeLG909 authored Jul 23, 2024
2 parents 09c51cc + e9436ee commit 624f84c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DB_USERNAME=adminprime
DB_PASSWORD=Orionpax9
DB_SSLCA=DigiCertGlobalRootCA.crt.pem

BROADCAST_DRIVER=log
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
Expand Down Expand Up @@ -45,13 +45,13 @@ AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_ID=1774971
PUSHER_APP_KEY=19d773bf0fcaed00027c
PUSHER_APP_SECRET=a6d6ac4f18b294965d80
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
PUSHER_APP_CLUSTER=ap2

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
Expand Down
21 changes: 17 additions & 4 deletions app/Http/Controllers/ApiUaqrooController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\User;
use Carbon\Carbon;
use App\Notifications\AccesoNoAutorizadoNotification;
use Illuminate\Support\Str;


class ApiUaqrooController extends Controller
Expand Down Expand Up @@ -59,8 +60,10 @@ public function buscarUsuario($email, $areaId)
$e = new EventosAcceso;
$e->area_id = $areaId;
$e->usuario_id = $user_id;
$e->fecha_hora = now();

$e->fecha_hora = Carbon::now();
$e->updated_at = Carbon::now();
$e->created_at = Carbon::now();
$e->evento_id = $this->generateEventoId();
if($user) {

$validacion = Autorizaciones::where('usuario_id', $user_id)
Expand All @@ -81,15 +84,25 @@ public function buscarUsuario($email, $areaId)
$e->permiso = 'NO PERMITIDO';
$e->save();

$user->notify(new AccesoNoAutorizadoNotification());
// $user->notify(new AccesoNoAutorizadoNotification());

return response()->json(['acceso' => false]);
}
}else {
return response()->json(['Usuario no encontrado']);
}



}

public function generateEventoId()
{
$maxValue = 999999999;

do {
$randomNumber = random_int(1, $maxValue); // Puedes ajustar el rango según tus necesidades
} while (EventosAcceso::where('evento_id', $randomNumber)->exists());

return $randomNumber; }

}
4 changes: 2 additions & 2 deletions app/Http/Controllers/DashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function index()
->count();

$total = $conteo_permitido + $conteo_denegado;
$porcentaje_perm = ($conteo_permitido / $total) * 100;
$porcentaje_deneg = ($conteo_denegado / $total) * 100;
$porcentaje_perm = $total == 0 ? 0 : ($conteo_permitido / $total) * 100;
$porcentaje_deneg = $total == 0 ? 0 : ($conteo_denegado / $total) * 100;

// Crear gráfico semanal
$eventos_m = EventosAcceso::accesosSemanalesM();
Expand Down
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|
*/

'default' => env('DB_CONNECTION', 'localhost'),
'default' => env('DB_CONNECTION', 'mysql'),

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 624f84c

Please sign in to comment.