1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Integrate twilio

This commit is contained in:
David Bomba 2022-07-27 11:21:12 +10:00
parent ab4d80f247
commit 438562ab8f
13 changed files with 304 additions and 75 deletions

View File

@ -507,6 +507,9 @@ class CreditController extends BaseController
$ids = request()->input('ids');
if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
$credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $credits) {

View File

@ -128,6 +128,9 @@ class EmailController extends BaseController
'body' => $body,
];
if(Ninja::isHosted() && !$entity_obj->company->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
if($entity == 'purchaseOrder' || $template == 'purchase_order'){
return $this->sendPurchaseOrder($entity_obj, $data);
}

View File

@ -551,6 +551,9 @@ class InvoiceController extends BaseController
$ids = request()->input('ids');
if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
$invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $invoices) {

View File

@ -489,6 +489,9 @@ class PurchaseOrderController extends BaseController
$ids = request()->input('ids');
if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
$purchase_orders = PurchaseOrder::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $purchase_orders) {

View File

@ -518,6 +518,9 @@ class QuoteController extends BaseController
$ids = request()->input('ids');
if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
$quotes = Quote::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $quotes) {

View File

@ -0,0 +1,96 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Controllers;
use App\Http\Requests\Twilio\ConfirmSmsRequest;
use App\Http\Requests\Twilio\GenerateSmsRequest;
use App\Libraries\MultiDB;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Http\Response;
use Twilio\Rest\Client;
class TwilioController extends BaseController
{
public function __construct()
{
parent::__construct();
}
/**
* Display a listing of the resource.
*
* @return void
*/
public function generate(GenerateSmsRequest $request)
{
$account = auth()->user()->company()->account;
if(MultiDB::hasPhoneNumber($request->phone))
return response()->json(['message' => 'This phone number has already been verified with another account'], 400);
$sid = config('ninja.twilio_account_sid');
$token = config('ninja.twilio_auth_token');
$twilio = new Client($sid, $token);
$verification = $twilio->verify->v2->services(config('ninja.twilio_verify_sid'))
->verifications
->create($request->phone, "sms");
$account->account_sms_verification_code = $verification->sid;
$account->account_sms_verification_number = $request->phone;
$account->save();
return response()->json(['message' => 'Code sent.'], 200);
}
/**
* Show the form for creating a new resource.
*
* @return void
*/
public function confirm(ConfirmSmsRequest $request)
{
$account = auth()->user()->company()->account;
$sid = config('ninja.twilio_account_sid');
$token = config('ninja.twilio_auth_token');
$twilio = new Client($sid, $token);
$verification_check = $twilio->verify
->v2
->services(config('ninja.twilio_verify_sid'))
->verificationChecks
->create([
"to" => $account->account_sms_verification_number,
"code" => $request->code
]);
if($verification_check->status == 'approved'){
$account->account_sms_verified = true;
$account->save();
return response()->json(['message' => 'SMS verified'], 200);
}
return response()->json(['message' => 'SMS not verified'], 400);
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Requests\Twilio;
use App\Http\Requests\Request;
class ConfirmSmsRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
public function rules()
{
return [
'code' => 'required',
];
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Requests\Twilio;
use App\Http\Requests\Request;
class GenerateSmsRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
public function rules()
{
return [
'phone' => 'required|regex:^\+[1-9]\d{1,14}$',
];
}
}

View File

@ -108,6 +108,9 @@ class EmailEntity implements ShouldQueue
/* Set DB */
MultiDB::setDB($this->company->db);
if(Ninja::isHosted() && !$this->company->account->account_sms_verified)
return;
App::forgetInstance('translator');
$t = app('translator');
App::setLocale($this->invitation->contact->preferredLocale());

View File

@ -88,6 +88,7 @@ class AccountTransformer extends EntityTransformer
'is_hosted' => (bool) Ninja::isHosted(),
'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap,
'trial_days_left' => Ninja::isHosted() ? (int) $account->getTrialDays() : 0,
'account_sms_verified' => (bool) $account->account_sms_verified,
];
}

148
composer.lock generated
View File

@ -378,16 +378,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.231.10",
"version": "3.231.14",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "e46b7c5fcb70fadf38079755982cc1d3f0583c41"
"reference": "6b79b9c8204813d9674ffa7badcd567d7f608165"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e46b7c5fcb70fadf38079755982cc1d3f0583c41",
"reference": "e46b7c5fcb70fadf38079755982cc1d3f0583c41",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6b79b9c8204813d9674ffa7badcd567d7f608165",
"reference": "6b79b9c8204813d9674ffa7badcd567d7f608165",
"shasum": ""
},
"require": {
@ -464,9 +464,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.231.10"
"source": "https://github.com/aws/aws-sdk-php/tree/3.231.14"
},
"time": "2022-07-20T18:17:18+00:00"
"time": "2022-07-26T18:20:14+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -576,16 +576,16 @@
},
{
"name": "braintree/braintree_php",
"version": "6.8.0",
"version": "6.9.0",
"source": {
"type": "git",
"url": "https://github.com/braintree/braintree_php.git",
"reference": "d5d92080d67ed247b72378e4f47e8c4d0048bddd"
"reference": "096984f01c03e47e053703fb159721cb77793587"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/d5d92080d67ed247b72378e4f47e8c4d0048bddd",
"reference": "d5d92080d67ed247b72378e4f47e8c4d0048bddd",
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/096984f01c03e47e053703fb159721cb77793587",
"reference": "096984f01c03e47e053703fb159721cb77793587",
"shasum": ""
},
"require": {
@ -619,9 +619,9 @@
"description": "Braintree PHP Client Library",
"support": {
"issues": "https://github.com/braintree/braintree_php/issues",
"source": "https://github.com/braintree/braintree_php/tree/6.8.0"
"source": "https://github.com/braintree/braintree_php/tree/6.9.0"
},
"time": "2022-04-01T18:37:18+00:00"
"time": "2022-07-25T14:01:57+00:00"
},
{
"name": "brick/math",
@ -2044,16 +2044,16 @@
},
{
"name": "gocardless/gocardless-pro",
"version": "4.19.0",
"version": "4.20.0",
"source": {
"type": "git",
"url": "https://github.com/gocardless/gocardless-pro-php.git",
"reference": "ed88cd22b6a790ee37758afa8bf7c9d43caa796c"
"reference": "3df49bbc748900fba6cb3de428c21e488b058940"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/ed88cd22b6a790ee37758afa8bf7c9d43caa796c",
"reference": "ed88cd22b6a790ee37758afa8bf7c9d43caa796c",
"url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/3df49bbc748900fba6cb3de428c21e488b058940",
"reference": "3df49bbc748900fba6cb3de428c21e488b058940",
"shasum": ""
},
"require": {
@ -2093,9 +2093,9 @@
],
"support": {
"issues": "https://github.com/gocardless/gocardless-pro-php/issues",
"source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.19.0"
"source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.20.0"
},
"time": "2022-07-13T14:44:43+00:00"
"time": "2022-07-25T09:57:58+00:00"
},
{
"name": "google/apiclient",
@ -2169,16 +2169,16 @@
},
{
"name": "google/apiclient-services",
"version": "v0.258.0",
"version": "v0.259.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "71eb32534aba05e373fe317c1373a9645065881c"
"reference": "3f68a8b8f825974bc0318b8f7268a09216d5fee1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/71eb32534aba05e373fe317c1373a9645065881c",
"reference": "71eb32534aba05e373fe317c1373a9645065881c",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/3f68a8b8f825974bc0318b8f7268a09216d5fee1",
"reference": "3f68a8b8f825974bc0318b8f7268a09216d5fee1",
"shasum": ""
},
"require": {
@ -2207,9 +2207,9 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.258.0"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.259.0"
},
"time": "2022-07-18T01:10:11+00:00"
"time": "2022-07-24T01:26:12+00:00"
},
{
"name": "google/auth",
@ -3478,16 +3478,16 @@
},
{
"name": "laravel/framework",
"version": "v9.21.3",
"version": "v9.22.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "66bfa61e61ffceddb6370b57306c76ead7667622"
"reference": "b3b3dd43b9899f23df6d1d3e5390bd4662947a46"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/66bfa61e61ffceddb6370b57306c76ead7667622",
"reference": "66bfa61e61ffceddb6370b57306c76ead7667622",
"url": "https://api.github.com/repos/laravel/framework/zipball/b3b3dd43b9899f23df6d1d3e5390bd4662947a46",
"reference": "b3b3dd43b9899f23df6d1d3e5390bd4662947a46",
"shasum": ""
},
"require": {
@ -3654,7 +3654,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-07-20T18:00:32+00:00"
"time": "2022-07-26T16:16:33+00:00"
},
{
"name": "laravel/serializable-closure",
@ -3778,28 +3778,28 @@
},
{
"name": "laravel/socialite",
"version": "v5.5.2",
"version": "v5.5.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/socialite.git",
"reference": "68afb03259b82d898c68196cbcacd48596a9dd72"
"reference": "9dfc76b31ee041c45a7cae86f23339784abde46d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/socialite/zipball/68afb03259b82d898c68196cbcacd48596a9dd72",
"reference": "68afb03259b82d898c68196cbcacd48596a9dd72",
"url": "https://api.github.com/repos/laravel/socialite/zipball/9dfc76b31ee041c45a7cae86f23339784abde46d",
"reference": "9dfc76b31ee041c45a7cae86f23339784abde46d",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/guzzle": "^6.0|^7.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0",
"illuminate/http": "^6.0|^7.0|^8.0|^9.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0",
"league/oauth1-client": "^1.0",
"league/oauth1-client": "^1.10.1",
"php": "^7.2|^8.0"
},
"require-dev": {
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
"phpunit/phpunit": "^8.0|^9.3"
@ -3843,7 +3843,7 @@
"issues": "https://github.com/laravel/socialite/issues",
"source": "https://github.com/laravel/socialite"
},
"time": "2022-03-10T15:26:19+00:00"
"time": "2022-07-18T13:51:19+00:00"
},
{
"name": "laravel/tinker",
@ -4383,16 +4383,16 @@
},
{
"name": "league/flysystem",
"version": "3.1.1",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "1a941703dfb649f9b821e7bc425e782f576a805e"
"reference": "ed0ecc7f9b5c2f4a9872185846974a808a3b052a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1a941703dfb649f9b821e7bc425e782f576a805e",
"reference": "1a941703dfb649f9b821e7bc425e782f576a805e",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/ed0ecc7f9b5c2f4a9872185846974a808a3b052a",
"reference": "ed0ecc7f9b5c2f4a9872185846974a808a3b052a",
"shasum": ""
},
"require": {
@ -4453,7 +4453,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.1.1"
"source": "https://github.com/thephpleague/flysystem/tree/3.2.0"
},
"funding": [
{
@ -4469,20 +4469,20 @@
"type": "tidelift"
}
],
"time": "2022-07-18T09:59:40+00:00"
"time": "2022-07-26T07:26:36+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
"version": "3.1.1",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b"
"reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b",
"reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/257893ef7398b3c9255b26dff8b0118bb93fc5ff",
"reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff",
"shasum": ""
},
"require": {
@ -4523,7 +4523,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues",
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.1.1"
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.2.0"
},
"funding": [
{
@ -4539,7 +4539,7 @@
"type": "tidelift"
}
],
"time": "2022-07-18T09:31:34+00:00"
"time": "2022-07-26T07:22:40+00:00"
},
{
"name": "league/fractal",
@ -5110,16 +5110,16 @@
},
{
"name": "monolog/monolog",
"version": "2.7.0",
"version": "2.8.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "5579edf28aee1190a798bfa5be8bc16c563bd524"
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524",
"reference": "5579edf28aee1190a798bfa5be8bc16c563bd524",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50",
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50",
"shasum": ""
},
"require": {
@ -5139,11 +5139,10 @@
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"php-console/php-console": "^3.1.3",
"phpspec/prophecy": "^1.15",
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5.14",
"predis/predis": "^1.1",
"predis/predis": "^1.1 || ^2.0",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": "^7",
"swiftmailer/swiftmailer": "^5.3|^6.0",
@ -5163,7 +5162,6 @@
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
@ -5198,7 +5196,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.7.0"
"source": "https://github.com/Seldaek/monolog/tree/2.8.0"
},
"funding": [
{
@ -5210,7 +5208,7 @@
"type": "tidelift"
}
],
"time": "2022-06-09T08:59:12+00:00"
"time": "2022-07-24T11:55:47+00:00"
},
{
"name": "mtdowling/jmespath.php",
@ -7801,16 +7799,16 @@
},
{
"name": "rmccue/requests",
"version": "v2.0.3",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/WordPress/Requests.git",
"reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff"
"reference": "62bf29e0f1080b4f0f499d30adb6a382e70e9686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/WordPress/Requests/zipball/b290dd974051bf1ead51d1947a5a56357e5b80ff",
"reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff",
"url": "https://api.github.com/repos/WordPress/Requests/zipball/62bf29e0f1080b4f0f499d30adb6a382e70e9686",
"reference": "62bf29e0f1080b4f0f499d30adb6a382e70e9686",
"shasum": ""
},
"require": {
@ -7878,7 +7876,7 @@
"issues": "https://github.com/WordPress/Requests/issues",
"source": "https://github.com/WordPress/Requests"
},
"time": "2022-05-10T08:42:27+00:00"
"time": "2022-07-25T09:01:09+00:00"
},
{
"name": "sabre/uri",
@ -12757,16 +12755,16 @@
},
{
"name": "brianium/paratest",
"version": "v6.6.0",
"version": "v6.6.1",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "bce7b965a5fe5028a53c3151042ca12777600acd"
"reference": "ae5803ce4558f855c7d955baa2d90b93ec40c4b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/bce7b965a5fe5028a53c3151042ca12777600acd",
"reference": "bce7b965a5fe5028a53c3151042ca12777600acd",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/ae5803ce4558f855c7d955baa2d90b93ec40c4b7",
"reference": "ae5803ce4558f855c7d955baa2d90b93ec40c4b7",
"shasum": ""
},
"require": {
@ -12833,7 +12831,7 @@
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v6.6.0"
"source": "https://github.com/paratestphp/paratest/tree/v6.6.1"
},
"funding": [
{
@ -12845,7 +12843,7 @@
"type": "paypal"
}
],
"time": "2022-07-12T07:15:58+00:00"
"time": "2022-07-22T14:07:17+00:00"
},
{
"name": "composer/package-versions-deprecated",
@ -13675,16 +13673,16 @@
},
{
"name": "laravel/dusk",
"version": "v6.25.0",
"version": "v6.25.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/dusk.git",
"reference": "b4632b7493a187d31afc5c9ddec437c81b16421a"
"reference": "cd93e41d610965842e4b61f4691a0a0889737790"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/dusk/zipball/b4632b7493a187d31afc5c9ddec437c81b16421a",
"reference": "b4632b7493a187d31afc5c9ddec437c81b16421a",
"url": "https://api.github.com/repos/laravel/dusk/zipball/cd93e41d610965842e4b61f4691a0a0889737790",
"reference": "cd93e41d610965842e4b61f4691a0a0889737790",
"shasum": ""
},
"require": {
@ -13742,9 +13740,9 @@
],
"support": {
"issues": "https://github.com/laravel/dusk/issues",
"source": "https://github.com/laravel/dusk/tree/v6.25.0"
"source": "https://github.com/laravel/dusk/tree/v6.25.1"
},
"time": "2022-07-11T11:38:43+00:00"
"time": "2022-07-25T13:51:51+00:00"
},
{
"name": "maximebf/debugbar",
@ -16652,5 +16650,5 @@
"platform-dev": {
"php": "^7.4|^8.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.3.0"
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSmsVerificationToHostedAccount extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function (Blueprint $table) {
$table->text('account_sms_verification_code')->nullable();
$table->text('account_sms_verification_number')->nullable();
$table->boolean('account_sms_verified')->default(0);
});
App\Models\Account::query()->update(['account_sms_verified' => true]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -86,6 +86,7 @@ use App\Http\Controllers\TaskStatusController;
use App\Http\Controllers\TaxRateController;
use App\Http\Controllers\TemplateController;
use App\Http\Controllers\TokenController;
use App\Http\Controllers\TwilioController;
use App\Http\Controllers\TwoFactorController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VendorController;
@ -285,6 +286,10 @@ Route::group(['middleware' => ['throttle:100,1', 'api_db', 'token_auth', 'locale
Route::post('settings/enable_two_factor', [TwoFactorController::class, 'enableTwoFactor']);
Route::post('settings/disable_two_factor', [TwoFactorController::class, 'disableTwoFactor']);
Route::post('verify', [TwilioController::class, 'generate'])->name('verify.generate');
Route::post('verify/confirm', [TwilioController::class, 'confirm'])->name('verify.confirm');
Route::resource('vendors', VendorController::class); // name = (vendors. index / create / show / update / destroy / edit
Route::post('vendors/bulk', [VendorController::class, 'bulk'])->name('vendors.bulk');
Route::put('vendors/{vendor}/upload', [VendorController::class, 'upload']);