Update CRM API v1 to V2

This commit is contained in:
Vincent BRIDIER 2021-08-13 11:48:06 +02:00
parent 670fd61d26
commit 46d24cc98f
12 changed files with 760 additions and 32 deletions

View file

@ -27,4 +27,3 @@ MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
CRM_ENDPOINT=
CRM_API_TOKEN=

View file

@ -14,7 +14,7 @@ use App\Traits\CouponTrait;
use App\Traits\GenerateBR;
use PDF;
use App\Lib\LDCCRM\ApiV1;
use LDC\LDCCRM\CrmApiV2;
class CouponsController extends Controller
{
@ -25,7 +25,7 @@ class CouponsController extends Controller
{
$datas = $request->validated();
$campagne = Campagne::find($datas['refcamp']);
$customer = Customers::find($datas['crm_id']);
$customer = Customers::find($datas['hashcode']);
$couponsToPrint = explode(",", $datas['coupons']);
if ($campagne->site->crm_token === null) {
@ -36,11 +36,16 @@ class CouponsController extends Controller
return new StatusResource(['status' => 'KO', 'code' => 422, 'message' => 'Coupons not found.']);
}
$crm = new ApiV1(config('crm.CRM_ENDPOINT'), $campagne->site->crm_token);
$crmInfos = $crm->getCustomer($customer->crm_id);
if ($crmInfos->status === "OK") {
$crmInfos = $crmInfos->user;
} else {
$crm = new CrmApiV2(config('crm.CRM_ENDPOINT'), $campagne->site->crm_token, $campagne->site->crm_password);
try {
/**
* @var \LDC\LDCCRM\Models\Customer
*/
$crmInfos = $crm->getCustomer($customer->hashcode);
}catch (\Exception $e) {
// TODO : Update error message
return new StatusResource(['status' => 'KO', 'code' => 422, 'message' => 'Customer not found.']);
}

View file

@ -50,7 +50,7 @@ class CustomerController extends Controller
$datas = $request->validated();
try {
$customer = Customers::where([
['crm_id', $datas['crm_id']],
['hashcode', $datas['hashcode']],
['email', $datas['email']]
])->firstOrNew();
$customer->fill($datas);
@ -111,7 +111,7 @@ class CustomerController extends Controller
{
$datas = $request->validated();
$customer = Customers::where('crm_id', $datas['crm_id'])->first();
$customer = Customers::where('hashcode', $datas['hashcode'])->first();
$campagne = Campagne::find($datas['refcamp']);
if ($campagne->camp_published === 0) {
return new StatusResource(['status' => 'KO', 'code' => 404, 'message' => 'Campaign not found.']);

View file

@ -28,8 +28,8 @@ class PrintRequest extends FormRequest
{
// TODO : Validate coupons formats
return [
'refcamp' => 'exists:campagne,camp_id|required',
'crm_id' => 'exists:customers,crm_id|required',
'refcamp' => 'string|exists:campagne,camp_id|required',
'hashcode' => 'string|exists:customers,hashcode|required',
'coupons' => 'required'
];
}

View file

@ -27,8 +27,8 @@ class MurRequest extends FormRequest
public function rules()
{
return [
'refcamp' => 'exists:campagne,camp_id|required',
'crm_id' => 'exists:customers,crm_id|required'
'refcamp' => 'string|exists:campagne,camp_id|required',
'hashcode' => 'string|exists:customers,hashcode|required'
];
}

View file

@ -27,7 +27,7 @@ class StoreRequest extends FormRequest
public function rules()
{
return [
'crm_id' => 'numeric|required',
'hashcode' => 'string|required',
'email' => 'email|required',
'country' => 'string|required'
];

View file

@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Customers extends Model
{
protected $primaryKey = 'crm_id';
protected $primaryKey = 'hashcode';
protected $fillable = ['crm_id', 'email', 'country'];
protected $fillable = ['hashcode', 'email', 'country'];
protected static function booted()
{

View file

@ -15,24 +15,24 @@ class MesBR
$this->api_key = $api_key;
}
public function createCustomer(int $crmId, string $email, string $country)
public function createCustomer(string $hashcode, string $email, string $country)
{
return $this->callAPI("POST", '/customer', ['crm_id' => $crmId, 'email' => $email, 'country' => $country]);
return $this->callAPI("POST", '/customer', ['hashcode' => $hashcode, 'email' => $email, 'country' => $country]);
}
public function updateCustomer(int $crmId, string $email, string $country)
public function updateCustomer(string $hashcode, string $email, string $country)
{
return $this->callAPI("POST", '/customer', ['crm_id' => $crmId, 'email' => $email, 'country' => $country]);
return $this->callAPI("POST", '/customer', ['hashcode' => $hashcode, 'email' => $email, 'country' => $country]);
}
public function getMur(int $refCamp, int $crmId)
public function getMur(int $refCamp, string $hashcode)
{
return $this->callAPI("POST", '/mur', ['refcamp' => $refCamp, 'crm_id' => $crmId]);
return $this->callAPI("POST", '/mur', ['refcamp' => $refCamp, 'hashcode' => $hashcode]);
}
public function printCoupons(int $refCamp, int $crmId, array $coupons)
public function printCoupons(int $refCamp, string $hashcode, array $coupons)
{
return $this->callAPI("POST", '/coupons/print', ['refcamp' => $refCamp, 'crm_id' => $crmId, 'coupons' => implode(",", $coupons)]);
return $this->callAPI("POST", '/coupons/print', ['refcamp' => $refCamp, 'hashcode' => $hashcode, 'coupons' => implode(",", $coupons)]);
}
private function callAPI($method, $url, $data = [])

View file

@ -6,6 +6,8 @@
"type": "project",
"require": {
"php": "^7.3",
"ext-curl": "*",
"ext-json": "*",
"barryvdh/laravel-dompdf": "^0.9.0",
"doctrine/dbal": "^2.8",
"fideloper/proxy": "^4.0",
@ -13,11 +15,10 @@
"laravel/tinker": "^2.0",
"laravel/ui": "^3.0",
"laravelcollective/html": "6.*",
"ldc/ldccrmv2client": "^2.0",
"picqer/php-barcode-generator": "^0.3.0",
"szymach/c-pchart": "^3.0",
"uxweb/sweet-alert": "^2.0",
"ext-curl": "*",
"ext-json": "*"
"uxweb/sweet-alert": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
@ -30,6 +31,13 @@
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.3"
},
"repositories": [
{
"name": "ldc/ldccrmv2client",
"type": "vcs",
"url": "https://voight001.lesidc.com/crm-client"
}
],
"autoload": {
"classmap": [
"database/seeds",

689
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "294c501d3dece337ac5cc4c4ba4e14b8",
"content-hash": "b743f33bfa3e9e7f025419c4d140c37d",
"packages": [
{
"name": "barryvdh/laravel-dompdf",
@ -971,6 +971,299 @@
],
"time": "2020-04-13T13:17:36+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "7008573787b430c1c1f650e3722d9bba59967628"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628",
"reference": "7008573787b430c1c1f650e3722d9bba59967628",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.4",
"guzzlehttp/psr7": "^1.7 || ^2.0",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"ext-curl": "*",
"php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
"psr/log": "^1.1"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.3-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://github.com/alexeyshockov",
"type": "github"
},
{
"url": "https://github.com/gmponos",
"type": "github"
}
],
"time": "2021-03-23T11:33:13+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.4.1"
},
"time": "2021-03-07T09:25:29+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1dc8d9cba3897165e16d12bb13d813afb1eb3fe7",
"reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.0.0"
},
"time": "2021-06-30T20:03:07+00:00"
},
{
"name": "kwaadpepper/enum",
"version": "0.1.5",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/enum.git",
"reference": "1d4439d82b478696a7f759e9c55bf040bd848c59"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/1d4439d82b478696a7f759e9c55bf040bd848c59",
"reference": "1d4439d82b478696a7f759e9c55bf040bd848c59",
"shasum": ""
},
"require-dev": {
"orchestra/testbench": "^6.13",
"phpunit/phpunit": "~9.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Kwaadpepper\\Enum\\EnumServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Kwaadpepper\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jérémy Munsch",
"email": "github@jeremydev.ovh",
"homepage": "https://jeremydev.ovh"
}
],
"description": "Enums to use for any project",
"homepage": "https://github.com/kwaadpepper/enum",
"keywords": [
"enum",
"laravel"
],
"support": {
"issues": "https://github.com/Kwaadpepper/enum/issues",
"source": "https://github.com/Kwaadpepper/enum/tree/0.1.5"
},
"time": "2021-08-13T08:35:22+00:00"
},
{
"name": "laravel/framework",
"version": "v8.38.0",
@ -1337,6 +1630,66 @@
},
"time": "2020-12-15T20:20:05+00:00"
},
{
"name": "ldc/ldccrmv2client",
"version": "2.0.6",
"source": {
"type": "git",
"url": "https://voight001.lesidc.com/crm-client",
"reference": "f37a36d4fdab0543dea39e97b041bc0ec3b9c289"
},
"require": {
"ext-curl": "^7.3",
"guzzlehttp/guzzle": "^7.3",
"kwaadpepper/enum": "^0.1.5",
"php": "^7.3",
"respect/validation": "^2.2",
"vlucas/phpdotenv": "^5.3"
},
"require-dev": {
"orchestra/testbench": "^6.13",
"phpunit/phpunit": "~9.0",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"LDC\\LDCCRM\\Providers\\CrmClientV2Provider"
]
}
},
"autoload": {
"psr-4": {
"LDC\\LDCCRM\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LDC\\LDCCRM\\Tests\\": "tests"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Jérémy Munsch",
"email": "jeremy.munsch@ldc.fr",
"homepage": "https://jeremydev.ovh"
}
],
"description": "LDC CRM Client V2",
"homepage": "https://github.com/kwaadpepper",
"keywords": [
"CRM",
"Client",
"LDC",
"Laravel"
],
"time": "2021-08-13T09:12:56+00:00"
},
{
"name": "league/commonmark",
"version": "1.5.8",
@ -2224,6 +2577,166 @@
},
"time": "2019-01-08T18:20:26+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
},
"time": "2020-06-29T06:28:15+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.1.3",
@ -2400,6 +2913,50 @@
},
"time": "2021-04-10T16:23:39+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "ramsey/collection",
"version": "1.1.3",
@ -2569,6 +3126,130 @@
],
"time": "2020-08-18T17:17:46+00:00"
},
{
"name": "respect/stringifier",
"version": "0.2.0",
"source": {
"type": "git",
"url": "https://github.com/Respect/Stringifier.git",
"reference": "e55af3c8aeaeaa2abb5fa47a58a8e9688cc23b59"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Respect/Stringifier/zipball/e55af3c8aeaeaa2abb5fa47a58a8e9688cc23b59",
"reference": "e55af3c8aeaeaa2abb5fa47a58a8e9688cc23b59",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.8",
"malukenho/docheader": "^0.1.7",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Respect\\Stringifier\\": "src/"
},
"files": [
"src/stringify.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Respect/Stringifier Contributors",
"homepage": "https://github.com/Respect/Stringifier/graphs/contributors"
}
],
"description": "Converts any value to a string",
"homepage": "http://respect.github.io/Stringifier/",
"keywords": [
"respect",
"stringifier",
"stringify"
],
"support": {
"issues": "https://github.com/Respect/Stringifier/issues",
"source": "https://github.com/Respect/Stringifier/tree/0.2.0"
},
"time": "2017-12-29T19:39:25+00:00"
},
{
"name": "respect/validation",
"version": "2.2.3",
"source": {
"type": "git",
"url": "https://github.com/Respect/Validation.git",
"reference": "4c21a7ffc9a4915673cb2c2843963919e664e627"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Respect/Validation/zipball/4c21a7ffc9a4915673cb2c2843963919e664e627",
"reference": "4c21a7ffc9a4915673cb2c2843963919e664e627",
"shasum": ""
},
"require": {
"php": "^7.3 || ^8.0",
"respect/stringifier": "^0.2.0",
"symfony/polyfill-mbstring": "^1.2"
},
"require-dev": {
"egulias/email-validator": "^3.0",
"malukenho/docheader": "^0.1",
"mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^9.3",
"psr/http-message": "^1.0",
"respect/coding-standard": "^3.0",
"squizlabs/php_codesniffer": "^3.5",
"symfony/validator": "^3.0||^4.0",
"zendframework/zend-validator": "^2.1"
},
"suggest": {
"egulias/email-validator": "Strict (RFC compliant) email validation",
"ext-bcmath": "Arbitrary Precision Mathematics",
"ext-fileinfo": "File Information",
"ext-mbstring": "Multibyte String Functions",
"symfony/validator": "Use Symfony validator through Respect\\Validation",
"zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation"
},
"type": "library",
"autoload": {
"psr-4": {
"Respect\\Validation\\": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Respect/Validation Contributors",
"homepage": "https://github.com/Respect/Validation/graphs/contributors"
}
],
"description": "The most awesome validation engine ever created for PHP",
"homepage": "http://respect.github.io/Validation/",
"keywords": [
"respect",
"validation",
"validator"
],
"support": {
"issues": "https://github.com/Respect/Validation/issues",
"source": "https://github.com/Respect/Validation/tree/2.2.3"
},
"time": "2021-03-19T14:12:45+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "8.3.1",
@ -7952,8 +8633,10 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^7.3"
"php": "^7.3",
"ext-curl": "*",
"ext-json": "*"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}

View file

@ -3,6 +3,5 @@
return [
'CRM_ENDPOINT' => env('CRM_ENDPOINT'),
'CRM_API_TOKEN' => env('CRM_API_TOKEN'),
];

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('hashcode', 36)->unique();
$table->string('email')->unique();
$table->integer('country')->default('250');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('customers');
}
}