Initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Auth\LoginRequest;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthenticatedSessionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the login view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming authentication request.
|
||||
*
|
||||
* @param \App\Http\Requests\Auth\LoginRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(LoginRequest $request)
|
||||
{
|
||||
$request->authenticate();
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->intended(RouteServiceProvider::HOME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an authenticated session.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class ConfirmablePasswordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the confirm password view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return view('auth.confirm-password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm the user's password.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (! Auth::guard('web')->validate([
|
||||
'email' => $request->user()->email,
|
||||
'password' => $request->password,
|
||||
])) {
|
||||
throw ValidationException::withMessages([
|
||||
'password' => __('auth.password'),
|
||||
]);
|
||||
}
|
||||
|
||||
$request->session()->put('auth.password_confirmed_at', time());
|
||||
|
||||
return redirect()->intended(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmailVerificationNotificationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Send a new email verification notification.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return redirect()->intended(RouteServiceProvider::HOME);
|
||||
}
|
||||
|
||||
$request->user()->sendEmailVerificationNotification();
|
||||
|
||||
return back()->with('status', 'verification-link-sent');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmailVerificationPromptController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the email verification prompt.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
return $request->user()->hasVerifiedEmail()
|
||||
? redirect()->intended(RouteServiceProvider::HOME)
|
||||
: view('auth.verify-email');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rules;
|
||||
|
||||
class NewPasswordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the password reset view.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
return view('auth.reset-password', ['request' => $request]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming new password request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'token' => ['required'],
|
||||
'email' => ['required', 'email'],
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
]);
|
||||
|
||||
// Here we will attempt to reset the user's password. If it is successful we
|
||||
// will update the password on an actual user model and persist it to the
|
||||
// database. Otherwise we will parse the error and return the response.
|
||||
$status = Password::reset(
|
||||
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||
function ($user) use ($request) {
|
||||
$user->forceFill([
|
||||
'password' => Hash::make($request->password),
|
||||
'remember_token' => Str::random(60),
|
||||
])->save();
|
||||
|
||||
event(new PasswordReset($user));
|
||||
}
|
||||
);
|
||||
|
||||
// If the password was successfully reset, we will redirect the user back to
|
||||
// the application's home authenticated view. If there is an error we can
|
||||
// redirect them back to where they came from with their error message.
|
||||
return $status == Password::PASSWORD_RESET
|
||||
? redirect()->route('login')->with('status', __($status))
|
||||
: back()->withInput($request->only('email'))
|
||||
->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
class PasswordResetLinkController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the password reset link request view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('auth.forgot-password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming password reset link request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => ['required', 'email'],
|
||||
]);
|
||||
|
||||
// We will send the password reset link to this user. Once we have attempted
|
||||
// to send the link, we will examine the response then see the message we
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
$status = Password::sendResetLink(
|
||||
$request->only('email')
|
||||
);
|
||||
|
||||
return $status == Password::RESET_LINK_SENT
|
||||
? back()->with('status', __($status))
|
||||
: back()->withInput($request->only('email'))
|
||||
->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules;
|
||||
|
||||
class RegisteredUserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the registration view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming registration request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
Auth::login($user);
|
||||
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
|
||||
class VerifyEmailController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mark the authenticated user's email address as verified.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function __invoke(EmailVerificationRequest $request)
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
|
||||
}
|
||||
|
||||
if ($request->user()->markEmailAsVerified()) {
|
||||
event(new Verified($request->user()));
|
||||
}
|
||||
|
||||
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,683 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Configuracione;
|
||||
use App\Models\Cuentas;
|
||||
use App\Models\Historial_cuenta;
|
||||
use App\Models\Historiale;
|
||||
use App\Notifications\Vencimiento;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use App\Models\Promociones;
|
||||
use App\Models\recarga;
|
||||
use App\Models\Role;
|
||||
use App\Models\Saldo;
|
||||
use App\Models\slider;
|
||||
use App\Models\Tarifas;
|
||||
use App\Models\User;
|
||||
use App\Notifications\compra;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Exception;
|
||||
use Twilio\Rest\Client;
|
||||
use AshAllenDesign\ShortURL\Facades\ShortURL;
|
||||
|
||||
|
||||
class MenuController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function showwelcome(){
|
||||
$consulta_promociones = slider::get();
|
||||
return view('welcome',[
|
||||
'promociones' => $consulta_promociones,
|
||||
]);
|
||||
}
|
||||
|
||||
public function showclientes(){
|
||||
return view('menu/clientes');
|
||||
}
|
||||
public function showservicios(){
|
||||
return view('menu/servicios');
|
||||
}
|
||||
public function showtop(){
|
||||
return view('menu/top');
|
||||
}
|
||||
public function showreportes(){
|
||||
return view('menu/reportes');
|
||||
}
|
||||
public function showperfil(){
|
||||
return view('menu/perfil');
|
||||
}
|
||||
public function showconfiguracion(){
|
||||
return view('menu/configuracion');
|
||||
}
|
||||
public function showplanes(){
|
||||
return view('menu/planes');
|
||||
}
|
||||
|
||||
public function showusuarios(){
|
||||
return view('menu/usuarios');
|
||||
}
|
||||
|
||||
public function showadmin(){
|
||||
return view('menu/admin');
|
||||
}
|
||||
|
||||
public function showrecarga(){
|
||||
return view('menu/recarga');
|
||||
}
|
||||
|
||||
public function showcomprar(){
|
||||
return view('menu/comprar');
|
||||
}
|
||||
|
||||
public function showLogRecargas(){
|
||||
return view('menu/logs_recargas');
|
||||
}
|
||||
|
||||
public function showroles(){
|
||||
return view('menu/roles');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function pay($estado){
|
||||
return view('menu/order',[
|
||||
'estado' => $estado,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function showcredenciales(Request $request){
|
||||
|
||||
$credencial = Crypt::decryptString($request->id);
|
||||
$consulta_historiales = Historiale::where('id',$credencial)->with('cuentas')->first();
|
||||
$msj = Configuracione::orderby('id','desc')->select('msj_compra','msj_wp','clave_1','clave_2','clave_3','clave_4','clave_5','clave_6','iptv')->first();
|
||||
|
||||
return view('menu/credenciales',[
|
||||
'consulta' =>$consulta_historiales,
|
||||
'msj' => $msj,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function order( Request $request ){
|
||||
|
||||
$payment_id= $request->get('payment_id');
|
||||
$response = Http::get("https://api.mercadopago.com/v1/payments/$payment_id" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439");
|
||||
$response = json_decode($response);
|
||||
|
||||
$status = $response->status;
|
||||
if ($status == 'approved') {
|
||||
|
||||
$metodo_pago = $response->payment_method_id;
|
||||
$referencia = $response->external_reference;
|
||||
$consulta = recarga::where('reference',$referencia)->where('status',$status)->exists();
|
||||
if ($consulta == false){
|
||||
$update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]);
|
||||
$recarga = recarga::where('reference',$referencia)->with('usuario')->first();
|
||||
$usuario= $recarga->usuario;
|
||||
|
||||
$saldo = $usuario->saldo;
|
||||
$saldo_anterior = $saldo->valor;
|
||||
$rol = $usuario->rol->nombre;
|
||||
$monto = $recarga->valor_recarga;
|
||||
|
||||
if (!empty($saldo_anterior)) {
|
||||
|
||||
$valor= (float)$saldo_anterior + (float)$monto ;
|
||||
$nuevo_saldo = $saldo->update(['valor'=>$valor]);
|
||||
|
||||
}else{
|
||||
$nuevo_saldo = $saldo->update(['valor'=>$monto]);
|
||||
}
|
||||
|
||||
}
|
||||
$estado= 'aprobado';
|
||||
|
||||
}elseif($status == 'pending'){
|
||||
|
||||
|
||||
$metodo_pago = $response->payment_method_id;
|
||||
$referencia = $response->external_reference;
|
||||
$update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]);
|
||||
$usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario;
|
||||
|
||||
$estado= 'pendiente';
|
||||
}else{
|
||||
|
||||
|
||||
$metodo_pago = $response->payment_method_id;
|
||||
$referencia = $response->external_reference;
|
||||
$update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]);
|
||||
$usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario;
|
||||
|
||||
$estado ='rechazado';
|
||||
};
|
||||
|
||||
|
||||
return redirect()->route('pay',$estado);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function showwebhooks(Request $request){
|
||||
|
||||
}
|
||||
|
||||
public function recargas(){
|
||||
return view('menu/recargas');
|
||||
}
|
||||
|
||||
public function showutilidad(){
|
||||
return view('menu/utilidades');
|
||||
}
|
||||
|
||||
public function showwompi($monto){
|
||||
return view('menu/wompi',[
|
||||
'monto' => $monto,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function showoferta(){
|
||||
return view('portadaservicio');
|
||||
}
|
||||
|
||||
|
||||
public function showsingle(){
|
||||
return view('menu/single');
|
||||
}
|
||||
|
||||
|
||||
public function showpromo(){
|
||||
return view('menu/promo');
|
||||
}
|
||||
|
||||
|
||||
public function showlogs(){
|
||||
return view('menu/logs');
|
||||
}
|
||||
|
||||
|
||||
public function showpromociones(){
|
||||
return view('menu/promociones');
|
||||
}
|
||||
|
||||
public function showimport(){
|
||||
return view('menu/importar');
|
||||
}
|
||||
|
||||
public function showcategoria(){
|
||||
return view('menu/categoria');
|
||||
}
|
||||
|
||||
public function showcategorias(){
|
||||
return view('menu/ver');
|
||||
}
|
||||
|
||||
public function showservicio(){
|
||||
return view('menu/servicio');
|
||||
}
|
||||
public function compras( Request $request ){
|
||||
|
||||
$payment_id= $request->get('payment_id');
|
||||
$response = Http::get("https://api.mercadopago.com/v1/payments/$payment_id" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439");
|
||||
$response = json_decode($response);
|
||||
|
||||
|
||||
$status = $response->status;
|
||||
if ($status == 'approved') {
|
||||
|
||||
foreach($response->additional_info->items as $item){
|
||||
$consulta = Historiale::where('id', $item->id)->first();
|
||||
$tarifa_id=$consulta->tarifa_id;
|
||||
}
|
||||
$date = Carbon::now()->subDay(30);
|
||||
$fecha= $date->format('Y-m-d');
|
||||
|
||||
//SERVICIO//
|
||||
if (!empty($consulta->tarifa_id)) {
|
||||
|
||||
$pantallas = Tarifas::where('id', $tarifa_id)->with('servicio')->first();
|
||||
$servicio_id= $pantallas->servicio_id;
|
||||
$pantalla_servicio = $pantallas->servicio->pantallas;
|
||||
$pantalla_servicio_completa = $pantallas->servicio->completa;
|
||||
|
||||
|
||||
|
||||
$pantallas= $pantallas ->pantallas ?? null;
|
||||
$cantidad_tarjetaPlan = $consulta->cantidad;
|
||||
|
||||
$cantidad_solicitada = (int)$cantidad_tarjetaPlan*(int)$pantallas;
|
||||
//dd($cantidad_tarjetaPlan);
|
||||
if((int)$pantalla_servicio_completa >= (int)$cantidad_solicitada ){
|
||||
$suma = $pantalla_servicio-$cantidad_solicitada;
|
||||
|
||||
$cuenta = Cuentas::where('servicio_id',$servicio_id)->whereDate('inicio','>=',$fecha)->Orderby('created_at', 'ASC')->withCount('historiales')->where('estado','activo')->having('historiales_count', '<=', $suma)->first();
|
||||
}elseif((int)$pantalla_servicio_completa == (int)$cantidad_solicitada){
|
||||
$this->fecha_final_1 = $today = Carbon::now()->addDays($pantallas->dias-15);
|
||||
$this->fecha_final_2 = $today = Carbon::now()->addDays($pantallas->dias+15);
|
||||
//completas
|
||||
$cuenta = Cuentas::where('servicio_id',$this->servicio_id)->whereDate('inicio','>=',$this->fecha)->whereDate('vencimiento','>=',$this->fecha_final_1)->whereDate('vencimiento','<=',$this->fecha_final_2)->Orderby('created_at', 'ASC')->withCount('historiales')->where('estado','pendiente')->having('historiales_count', '==', 0)->first();
|
||||
}else{
|
||||
$cuenta=null;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($cuenta) ) {
|
||||
|
||||
$perfil = $cuenta->historiales_count;
|
||||
for ($n=1; $n <= $cantidad_solicitada ; $n++) {
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->historial_id = $item->id;
|
||||
$historial_cuenta->perfil = (int)$perfil + (int)$n;
|
||||
$historial_cuenta->save();
|
||||
//dd($historial_cuenta->id);
|
||||
}
|
||||
|
||||
if (($n-1) == $cantidad_solicitada) {
|
||||
|
||||
$consulta->update(['estado'=>'activo']);
|
||||
$this->cred($consulta);
|
||||
$encryptado = Crypt::encryptString($consulta->id);
|
||||
//dd('llegue');
|
||||
return redirect('/credenciales?id='.$encryptado);
|
||||
|
||||
}else{
|
||||
|
||||
return 'Error en la asignacion de cuentas, comuniquese con soporte!';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
//dd($cuenta);
|
||||
$suma2= $pantalla_servicio - $pantallas;
|
||||
|
||||
|
||||
for ($h=0; $h < (int)$cantidad_tarjetaPlan ; $h++) {
|
||||
//dd($n);
|
||||
$cuenta = Cuentas::where('servicio_id',$servicio_id)->whereDate('inicio','>=',$fecha)->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado','activo')->having('historiales_count', '<=', (int)$suma2)->first();
|
||||
//dd($cuenta);
|
||||
if (!empty($cuenta)) {
|
||||
$perfil = $cuenta->historiales_count;
|
||||
for ($y=0; $y < (int)$pantallas ; $y++) {
|
||||
//dd($pantallas);
|
||||
$historial_cuenta = new Historial_cuenta;
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->historial_id = $item->id;
|
||||
$historial_cuenta->perfil = (int)$perfil + (int)$y+1;
|
||||
$historial_cuenta->save();
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
return 'No hay cuentas disponibles, comuniquese con soporte!';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$consulta->update(['estado'=>'activo']);
|
||||
$this->cred($consulta);
|
||||
$encryptado = Crypt::encryptString($consulta->id);
|
||||
return redirect('/credenciales?id='.$encryptado);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//PROMOCION
|
||||
if (!empty($consulta->promocion_id)){
|
||||
|
||||
for ($p = 0; $p < (int)$consulta->cantidad; $p++) {
|
||||
//dd($this->cantidad_comprarPromo);
|
||||
foreach ($consulta->promocion->tarifas as $tarifa) {
|
||||
|
||||
$pantallas_tarifa = $tarifa->pantallas;
|
||||
$servicio_id = $tarifa->servicio_id;
|
||||
$pantalla_servicio = $tarifa->servicio->pantallas;
|
||||
$pantalla_servicio_completa = $tarifa->servicio->completa;
|
||||
|
||||
$faltante = $pantalla_servicio - $pantallas_tarifa;
|
||||
if ($pantalla_servicio_completa == $pantallas_tarifa) {
|
||||
$this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias-15);
|
||||
$this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias+15);
|
||||
$cuenta = Cuentas::where('servicio_id',$servicio_id)->whereDate('inicio','>=',$fecha)->whereDate('vencimiento','>=',$this->fecha_final_1)->whereDate('vencimiento','<=',$this->fecha_final_2)->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado','pendiente')->having('historiales_count', '==', 0)->first();
|
||||
}else{
|
||||
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio','>=',$fecha)->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first();
|
||||
}
|
||||
//dd($tarifa);
|
||||
|
||||
|
||||
if (!empty($cuenta)) {
|
||||
$perfil = $cuenta->historiales_count;
|
||||
for ($y = 0; $y < (int)$pantallas_tarifa; $y++) {
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->historial_id = $item->id;
|
||||
$historial_cuenta->perfil = (int)$perfil + (int)$y+1;
|
||||
$historial_cuenta->save();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
return 'No hay cuentas disponibles, comuniquese con soporte!';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($y)) {
|
||||
|
||||
$consulta->update(['estado'=>'activo']);
|
||||
$this->cred($consulta);
|
||||
$encryptado = Crypt::encryptString($consulta->id);
|
||||
//dd('llegue');
|
||||
return redirect('/credenciales?id='.$encryptado);
|
||||
|
||||
}else{
|
||||
return 'No hay cuentas disponibles, comuniquese con soporte!';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//wompi
|
||||
|
||||
public function wompi_pagos(Request $request){
|
||||
|
||||
$response = Http::get("https://sandbox.wompi.co/v1/transactions/136099-1677473887-65588");
|
||||
$response = json_decode($response);
|
||||
//dd($response);
|
||||
|
||||
}
|
||||
|
||||
public function wompi_hook(Request $request){
|
||||
//return json_encode('hola');
|
||||
|
||||
if (!empty($request)) {
|
||||
|
||||
|
||||
|
||||
foreach($request->data as $item ){
|
||||
//return $item;
|
||||
$status = $item['status'];
|
||||
$user_id = $item['reference'];
|
||||
$monto = substr($item['amount_in_cents'], 0, -2);
|
||||
$metodo_pago = $item['payment_method_type'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
$update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]);
|
||||
if ($status == 'APPROVED') {
|
||||
|
||||
$usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario;
|
||||
$saldo = $usuario->saldo;
|
||||
$saldo_anterior = $saldo->valor;
|
||||
$rol = $usuario->rol->nombre;
|
||||
//return $rol;
|
||||
$monto_adicional = 0;
|
||||
if ($rol == "super" || $rol == "administrador" || $rol == "distribuidor") {
|
||||
$monto_adicional = 500;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($saldo_anterior)) {
|
||||
|
||||
$valor= (float)$saldo_anterior + (float)$monto - (float)$monto_adicional;
|
||||
$nuevo_saldo = $saldo->update(['valor'=>$valor]);
|
||||
|
||||
// return $nuevo_saldo;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function cred($consulta){
|
||||
|
||||
|
||||
$encryptado = Crypt::encryptString($consulta->id);
|
||||
|
||||
$enlace = '/credenciales?id='.$encryptado;
|
||||
|
||||
$user=User::find($consulta->cliente);
|
||||
if (!empty($consulta->promocion_id)){ {
|
||||
|
||||
$shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co'.$enlace)->make();
|
||||
$shortURL = $shortURLObject->default_short_url;
|
||||
$message = $consulta->promocion->nombre.'. Ver credenciales: '.$shortURL ;
|
||||
$recipients= '+57'.$consulta->cliente->celular;
|
||||
|
||||
$this->sendMessage($message, $recipients);
|
||||
|
||||
$notificacion = [
|
||||
'enlace' => $enlace,
|
||||
'fecha_final' => $consulta->fecha_final,
|
||||
'cliente' => $consulta->cliente->name,
|
||||
'servicio' => $consulta->promocion->nombre,
|
||||
'tipo' => 'compra',
|
||||
'vendedor' => Role::where('nombre','super')->first()->usuarios->first()->name,
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
if (!empty($consulta->tarifa_id)){
|
||||
|
||||
$shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co'.$enlace)->make();
|
||||
$shortURL = $shortURLObject->default_short_url;
|
||||
$message = $consulta->tarifa->servicio->nombre.'-'.$consulta->tarifa->pantallas. 'P. Ver credenciales: '.$shortURL ;
|
||||
$recipients= '+57'.$consulta->cliente->celular;
|
||||
|
||||
$this->sendMessage($message, $recipients);
|
||||
|
||||
|
||||
$notificacion = [
|
||||
'enlace' => $enlace,
|
||||
'fecha_final' => $consulta->fecha_final,
|
||||
'cliente' => $consulta->cliente->name,
|
||||
'servicio' => $consulta->tarifa->servicio->nombre.'-'.$consulta->tarifa->pantallas. 'pantallas',
|
||||
'tipo' => 'compra',
|
||||
'vendedor' => Role::where('nombre','super')->first()->usuarios->first()->name,
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Notification::send($user, new compra($notificacion));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sendMessage($message, $recipients)
|
||||
{
|
||||
|
||||
|
||||
$auth_basic = base64_encode(getenv("USER_LABSMOBILE").':'.getenv("PASS_LABSMOBILE"));
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://api.labsmobile.com/json/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":[{"msisdn":"'.$recipients.'"}]}',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
"Authorization: Basic ".$auth_basic,
|
||||
"Cache-Control: no-cache",
|
||||
"Content-Type: application/json"
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
if ($err) {
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
public function showmp(Request $request){
|
||||
|
||||
Log::info('MercadoPago webhook received', $request->all());
|
||||
|
||||
// Aquí puedes agregar la lógica para manejar las notificaciones de MercadoPago
|
||||
$data = json_decode($request->getContent(), true);
|
||||
$paymentId = $data['data']['id'];
|
||||
|
||||
$response = Http::get("https://api.mercadopago.com/v1/payments/$paymentId" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439");
|
||||
//return $response;
|
||||
$response = json_decode($response);
|
||||
$status = $response->status;
|
||||
|
||||
if ($status == 'approved') {
|
||||
$metodo_pago = $response->payment_method_id;
|
||||
$referencia = $response->external_reference;
|
||||
$consulta = recarga::where('reference',$referencia)->where('status',$status)->exists();
|
||||
if ($consulta == false){
|
||||
$update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]);
|
||||
$recarga = recarga::where('reference',$referencia)->with('usuario')->first();
|
||||
$usuario= $recarga->usuario;
|
||||
|
||||
$saldo = $usuario->saldo;
|
||||
$saldo_anterior = $saldo->valor;
|
||||
$monto = $recarga->valor_recarga;
|
||||
|
||||
$valor= (float)$saldo_anterior + (float)$monto ;
|
||||
$nuevo_saldo = $saldo->update(['valor'=>$valor]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return response()->json(['status' => 'ok']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function pruebas (){
|
||||
$fechaHoy = Carbon::now()->format('Y-m-d');
|
||||
|
||||
$consulta_historial = Historiale::whereDate('fecha_final', $fechaHoy)->with('cliente')->get();
|
||||
|
||||
foreach ($consulta_historial as $item) {
|
||||
|
||||
$user = User::find($item->cliente->id);
|
||||
|
||||
if (!empty($item->promocion_id)) {
|
||||
|
||||
$nombre= $item->promocion->nombre;
|
||||
}
|
||||
if (!empty($item->tarifa_id)) {
|
||||
$nombre = $item->tarifa->servicio->nombre . '-' . $item->tarifa->pantallas . 'P';
|
||||
}
|
||||
|
||||
$notificacion = [
|
||||
//'valor' => $value['precio'],
|
||||
'fecha_final' => $item->fecha_final,
|
||||
'cliente' => $item->cliente->name,
|
||||
'servicio' => $nombre,
|
||||
'tipo' => 'vencimiento',
|
||||
'vendedor' =>$item->vendedor->name,
|
||||
|
||||
];
|
||||
|
||||
Notification::sendNow($user, new Vencimiento($notificacion));
|
||||
|
||||
// $fecha=Carbon::parse($item->fecha_final)->format('d/m/Y');
|
||||
|
||||
//$message = 'Su '.$nombre.', Vence Hoy, '.$fecha.'. Renueva ahora!!' ;
|
||||
//$recipients= '+57'.$item->cliente->celular;
|
||||
|
||||
//$auth_basic = base64_encode('admin@jaguarws.ga:9u3xxXhHt8maeiOexg07pFKI0rpYazI0');
|
||||
|
||||
//$curl = curl_init();
|
||||
|
||||
//curl_setopt_array($curl, array(
|
||||
//CURLOPT_URL => "https://api.labsmobile.com/json/send",
|
||||
//CURLOPT_RETURNTRANSFER => true,
|
||||
//CURLOPT_ENCODING => "",
|
||||
//CURLOPT_MAXREDIRS => 10,
|
||||
//CURLOPT_TIMEOUT => 30,
|
||||
//CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
//CURLOPT_CUSTOMREQUEST => "POST",
|
||||
//CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":[{"msisdn":"'.$recipients.'"}]}',
|
||||
//CURLOPT_HTTPHEADER => array(
|
||||
// "Authorization: Basic ".$auth_basic,
|
||||
// "Cache-Control: no-cache",
|
||||
// "Content-Type: application/json"
|
||||
//),
|
||||
//));
|
||||
|
||||
//$response = curl_exec($curl);
|
||||
//$err = curl_error($curl);
|
||||
|
||||
//curl_close($curl);
|
||||
//return $response;
|
||||
//if ($err) {
|
||||
|
||||
|
||||
//} else {
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$fechaHoy1 = Carbon::now();
|
||||
$fechaHoy1 = Carbon::parse($fechaHoy1)->subDay(1);
|
||||
|
||||
$consulta_historial1= Historiale::whereDate('fecha_final','<',$fechaHoy1)->with('cliente','cuentas')->get();
|
||||
foreach ($consulta_historial1 as $item1) {
|
||||
|
||||
foreach($item1->cuentas->unique() as $item2){
|
||||
//dd($item2);
|
||||
$logs = new log;
|
||||
$logs->historial_id = $item1->id;
|
||||
$logs->cuenta_id = $item2->id;
|
||||
$logs->save();
|
||||
}
|
||||
//$eliminar_cuentas = Historial_cuenta::where('historial_id',$item1->id)->truncate();
|
||||
//dd('termine');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
||||
use WpOrg\Requests\Requests;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Twilio\Jwt\AccessToken;
|
||||
use Twilio\Rest\Client;
|
||||
|
||||
class TwilioSMSController extends Controller
|
||||
{
|
||||
/**
|
||||
* Write code on Method
|
||||
*
|
||||
* @return response()
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//auth2.0
|
||||
$client_id=getenv("NEQUI_CLIENT_ID");
|
||||
$client_secret=getenv("NEQUI_CLIENT_SECRET");
|
||||
$api_key=getenv("NEQUI_API_KEY");
|
||||
$endpoint=getenv("NEQUI_ENDPOINT");
|
||||
|
||||
|
||||
//push
|
||||
$RestEndpoint = '/payments/v2/-services-paymentservice-unregisteredpayment';
|
||||
|
||||
try{
|
||||
$authorization = 'Basic ' . base64_encode($client_id . ':' . $client_secret);
|
||||
$headers = array(
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
'Accept' => 'application/json',
|
||||
'Authorization' => $authorization
|
||||
);
|
||||
$request = Requests::post($endpoint, $headers);
|
||||
if (
|
||||
isset($request->status_code) && $request->status_code == 200
|
||||
&& isset($request->body) && !empty($request->body)
|
||||
) {
|
||||
$response = json_decode($request->body);
|
||||
|
||||
$tokenExpiresAt = new DateTime();
|
||||
$tokenExpiresAt->add(new DateInterval('PT' . $response->expires_in . 'S'));
|
||||
$token = $response->access_token;
|
||||
$tokenType = $response->token_type;
|
||||
} else {
|
||||
throw new Exception('Unable to connect to Nequi, please check the information sent.');
|
||||
}
|
||||
}catch(Exception $e){
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
// pago
|
||||
|
||||
$headers1 = array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json',
|
||||
'Authorization' => $token,
|
||||
'x-api-key' => $api_key
|
||||
);
|
||||
|
||||
$options = array(
|
||||
'timeout' => 30
|
||||
|
||||
);
|
||||
$endpoint1 = 'https://api.sandbox.nequi.com' . $RestEndpoint;
|
||||
|
||||
$body1 = json_encode(array(
|
||||
'RequestMessage' => array(
|
||||
'RequestHeader' => array(
|
||||
'Channel' => 'PNP04-C001',
|
||||
'RequestDate' => '2020-01-14T10:26:12.654Z',
|
||||
'MessageID' => '1234567890',
|
||||
'ClientID' => '12345',
|
||||
'Destination' => array(
|
||||
'ServiceName' => 'PaymentsService',
|
||||
'ServiceOperation' => 'unregisteredPayment',
|
||||
'ServiceRegion' => 'C001',
|
||||
'ServiceVersion' => '1.2.0'
|
||||
)
|
||||
),
|
||||
'RequestBody' => array(
|
||||
'any' => array(
|
||||
'unregisteredPaymentRQ' => array(
|
||||
'phoneNumber'=> '3193590918',
|
||||
'code' => 'NIT_1',
|
||||
'value' => '1000',
|
||||
'reference1' => 'Referencia numero 1',
|
||||
'reference2' => 'Referencia numero 2',
|
||||
'reference3' => 'Referencia numero 3'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
$request1 = Requests::post($endpoint1, $headers1, $body1, $options);
|
||||
|
||||
|
||||
if (
|
||||
isset($request1->status_code) && $request1->status_code == 200
|
||||
&& isset($request1->body) && !empty($request1->body)
|
||||
) {
|
||||
dd($request1);
|
||||
|
||||
try {
|
||||
$response1 = json_decode($request->body);
|
||||
|
||||
$status = $response1->ResponseMessage->ResponseHeader->Status;
|
||||
$statusCode = isset($status) ? $status->StatusCode : '';
|
||||
$statusDesc = isset($status) ? $status->StatusDesc : '';
|
||||
|
||||
if ($statusCode == Constan::NEQUI_STATUS_CODE_SUCCESS) {
|
||||
|
||||
$payment = $response1->ResponseMessage->ResponseBody->any->unregisteredPaymentRS;
|
||||
$trnId = isset($payment) ? trim($payment->transactionId) : '';
|
||||
} else {
|
||||
throw new Exception('Error ' . $statusCode . ' = ' . $statusDesc);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
throw new Exception('Unable to connect to Nequi, please check the information sent.');
|
||||
}
|
||||
|
||||
|
||||
// $auth_basic = base64_encode("5ml5b35ijjk13f4q99utnsm97e:1b3703aq0o6t1rrfti13q7uf7f42glik3gsf81s0d783shblmt8l");
|
||||
|
||||
// $curl = curl_init();
|
||||
|
||||
// curl_setopt_array($curl, array(
|
||||
// CURLOPT_URL => "https://oauth.sandbox.nequi.com/oauth2/token?grant_type=client_credentials",
|
||||
// CURLOPT_RETURNTRANSFER => true,
|
||||
// CURLOPT_ENCODING => "",
|
||||
// CURLOPT_MAXREDIRS => 10,
|
||||
// CURLOPT_TIMEOUT => 30,
|
||||
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
// CURLOPT_CUSTOMREQUEST => "POST",
|
||||
// //CURLOPT_POSTFIELDS => '{"message":"Text of the SMS message", "tpoa":"Sender","recipient":[{"msisdn":"573168950803"},{"msisdn":"573022548060"}]}',
|
||||
// CURLOPT_HTTPHEADER => array(
|
||||
// "Authorization: Basic ".$auth_basic,
|
||||
// "Cache-Control: no-cache",
|
||||
// "Content-Type: application/x-www-form-urlencoded"
|
||||
// ),
|
||||
// ));
|
||||
|
||||
// $response = curl_exec($curl);
|
||||
// $err = curl_error($curl);
|
||||
|
||||
// curl_close($curl);
|
||||
|
||||
// if ($err) {
|
||||
// echo "cURL Error #:" . $err;
|
||||
// } else {
|
||||
// echo $response;
|
||||
// $AccessToken=json_decode($response)->access_token;
|
||||
// //dd($AccessToken);
|
||||
|
||||
// $receiverNumber = "RECEIVER_NUMBER";
|
||||
// $message = "All About Laravel";
|
||||
|
||||
// try {
|
||||
|
||||
// $auth_basic = base64_encode(getenv("USER_LABSMOBILE").':'.getenv("PASS_LABSMOBILE"));
|
||||
|
||||
// $curl = curl_init();
|
||||
|
||||
// curl_setopt_array($curl, array(
|
||||
// CURLOPT_URL => "https://api.labsmobile.com/json/send",
|
||||
// CURLOPT_RETURNTRANSFER => true,
|
||||
// CURLOPT_ENCODING => "",
|
||||
// CURLOPT_MAXREDIRS => 10,
|
||||
// CURLOPT_TIMEOUT => 30,
|
||||
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
// CURLOPT_CUSTOMREQUEST => "POST",
|
||||
// CURLOPT_POSTFIELDS => '{"message":"Text of the SMS message", "tpoa":"Sender","recipient":[{"msisdn":"573168950803"},{"msisdn":"573022548060"}]}',
|
||||
// CURLOPT_HTTPHEADER => array(
|
||||
// "Authorization: Basic ".$auth_basic,
|
||||
// "Cache-Control: no-cache",
|
||||
// "Content-Type: application/json"
|
||||
// ),
|
||||
// ));
|
||||
|
||||
// $response = curl_exec($curl);
|
||||
// $err = curl_error($curl);
|
||||
|
||||
// curl_close($curl);
|
||||
|
||||
// if ($err) {
|
||||
// echo "cURL Error #:" . $err;
|
||||
// } else {
|
||||
// echo $response;
|
||||
// }
|
||||
|
||||
//$account_sid = getenv("TWILIO_SID");
|
||||
//$auth_token = getenv("TWILIO_TOKEN");
|
||||
//$twilio_number = getenv("TWILIO_FROM");
|
||||
|
||||
//$client = new Client($account_sid, $auth_token);
|
||||
//$client->messages->create('+573168950803', [
|
||||
// 'from' => $twilio_number,
|
||||
// 'body' => $message]);
|
||||
|
||||
//dd('SMS Sent Successfully.');
|
||||
|
||||
// } catch (Exception $e) {
|
||||
// dd("Error: ". $e->getMessage());
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user