Merge pull request #3975 from turbo124/v2

Reworking mail handling
This commit is contained in:
David Bomba 2020-08-11 07:32:49 +10:00 committed by GitHub
commit 00a3288dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 290 additions and 164 deletions

View File

@ -19,6 +19,7 @@ use App\Jobs\Account\CreateAccount;
use App\Libraries\MultiDB;
use App\Libraries\OAuth\OAuth;
use App\Libraries\OAuth\Providers\Google;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Transformers\CompanyUserTransformer;
@ -181,7 +182,6 @@ class LoginController extends BaseController
$user->setCompany($user->company_user->account->default_company);
// $ct = CompanyUser::whereUserId($user->id)->with('company');
$ct = CompanyUser::whereUserId($user->id);
return $this->listResponse($ct);
@ -242,8 +242,11 @@ class LoginController extends BaseController
*/
public function refresh(Request $request)
{
$ct = CompanyUser::whereUserId(auth()->user()->id);
return $this->refreshResponse($ct);
$company_token = CompanyToken::whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])
->first();
//$ct = CompanyUser::whereUserId(auth()->user()->id);
return $this->refreshResponse($company_token->company_user());
}
/**

View File

@ -36,7 +36,7 @@ class EmailCredit extends BaseMailerJob implements ShouldQueue
public $message_array = [];
public $settings;
/**
* Create a new job instance.
*
@ -45,6 +45,8 @@ class EmailCredit extends BaseMailerJob implements ShouldQueue
public function __construct(Credit $credit)
{
$this->credit = $credit;
$this->settings = $credit->client->getMergedSettings();
}
/**
@ -59,7 +61,7 @@ class EmailCredit extends BaseMailerJob implements ShouldQueue
$template_style = $this->credit->client->getSetting('email_style');
$this->setMailDriver($this->credit->client->getSetting('email_sending_method'));
$this->setMailDriver();
$this->credit->invitations->each(function ($invitation) use ($template_style) {
@ -76,7 +78,8 @@ class EmailCredit extends BaseMailerJob implements ShouldQueue
if (count(Mail::failures()) > 0) {
event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures(), Ninja::eventVars()));
return $this->logMailError($errors);
return $this->logMailError(Mail::failures(), $this->credit->client);
}
//fire any events

View File

@ -41,6 +41,8 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
public $email_builder;
public $company;
public $settings;
/**
*
* EmailInvoice constructor.
@ -55,6 +57,9 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
$this->invoice_invitation = $invoice_invitation;
$this->email_builder = $email_builder;
$this->settings = $invoice_invitation->contact->client->getMergedSettings();
}
/**
@ -68,7 +73,7 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
{
MultiDB::setDB($this->company->db);
$this->setMailDriver($this->invoice_invitation->invoice->client->getSetting('email_sending_method'));
$this->setMailDriver();
Mail::to($this->invoice_invitation->contact->email, $this->invoice_invitation->contact->present()->name())
->send(
@ -80,18 +85,9 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
);
if (count(Mail::failures()) > 0) {
return $this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->invoice->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->invoice->client
);
}
}

View File

@ -11,6 +11,7 @@
namespace App\Jobs\Invoice;
use App\Jobs\Mail\BaseMailerJob;
use App\Jobs\Util\UnlinkFile;
use App\Libraries\MultiDB;
use App\Mail\DownloadInvoices;
@ -27,7 +28,7 @@ use Illuminate\Support\Facades\Storage;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
class ZipInvoices implements ShouldQueue
class ZipInvoices extends BaseMailerJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@ -37,6 +38,7 @@ class ZipInvoices implements ShouldQueue
private $email;
public $settings;
/**
* @deprecated confirm to be deleted
* Create a new job instance.
@ -50,6 +52,8 @@ class ZipInvoices implements ShouldQueue
$this->company = $company;
$this->email = $email;
$this->settings = $company->settings;
}
/**
@ -82,6 +86,8 @@ class ZipInvoices implements ShouldQueue
fclose($tempStream);
$this->setMailDriver();
Mail::to($this->email)
->send(new DownloadInvoices(Storage::disk(config('filesystems.default'))->url($path . $file_name), $this->company));

View File

@ -29,9 +29,9 @@ class BaseMailerJob implements ShouldQueue
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function setMailDriver(string $driver)
public function setMailDriver()
{
switch ($driver) {
switch ($this->settings->email_sending_method) {
case 'default':
break;
case 'gmail':
@ -45,7 +45,7 @@ class BaseMailerJob implements ShouldQueue
public function setGmailMailer()
{
$sending_user = $this->entity->client->getSetting('gmail_sending_user_id');
$sending_user = $this->settings->gmail_sending_user_id;
$user = User::find($sending_user);
@ -69,4 +69,15 @@ class BaseMailerJob implements ShouldQueue
}
public function logMailError($errors, $recipient_object)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$recipient_object
);
}
}

View File

@ -43,6 +43,8 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
public $entity_type;
public $entity;
public $settings;
/**
* Create a new job instance.
*
@ -55,6 +57,9 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
$this->user = $user;
$this->payment = $payment;
$this->settings = $payment->client->getMergedSettings();
}
/**
@ -72,7 +77,7 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
return true;
//if we need to set an email driver do it now
$this->setMailDriver($this->payment->client->getSetting('email_sending_method'));
$this->setMailDriver();
$mail_obj = (new EntityPaidObject($this->payment))->build();
$mail_obj->from = [$this->payment->user->email, $this->payment->user->present()->name()];
@ -83,21 +88,12 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->payment->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->payment->client
);
}
}

View File

@ -42,6 +42,9 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
public $entity_type;
public $entity;
public $settings;
/**
* Create a new job instance.
*
@ -58,6 +61,8 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
$this->entity = $invitation->{$entity_type};
$this->entity_type = $entity_type;
$this->settings = $invitation->contact->client->getMergedSettings();
}
/**
@ -71,7 +76,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
MultiDB::setDb($this->company->db);
//if we need to set an email driver do it now
$this->setMailDriver($this->entity->client->getSetting('email_sending_method'));
$this->setMailDriver();
$mail_obj = (new EntitySentObject($this->invitation, $this->entity_type))->build();
$mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
@ -82,21 +87,11 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->entity->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->entity->client
);
}
}

View File

@ -42,6 +42,8 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
public $entity_type;
public $entity;
public $settings;
/**
* Create a new job instance.
*
@ -58,6 +60,9 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
$this->entity = $invitation->{$entity_type};
$this->entity_type = $entity_type;
$this->settings = $invitation->contact->client->getMergedSettings();
}
/**
@ -72,7 +77,7 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
MultiDB::setDb($this->company->db);
//if we need to set an email driver do it now
$this->setMailDriver($this->entity->client->getSetting('email_sending_method'));
$this->setMailDriver();
$mail_obj = (new EntityViewedObject($this->invitation, $this->entity_type))->build();
$mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
@ -83,21 +88,11 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->invoice->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->invoice->client
);
}
}

View File

@ -0,0 +1,83 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Jobs\Mail;
use App\Jobs\Mail\BaseMailerJob;
use App\Jobs\Util\SystemLogger;
use App\Libraries\Google\Google;
use App\Libraries\MultiDB;
use App\Mail\Admin\EntityNotificationMailer;
use App\Mail\Admin\EntitySentObject;
use App\Models\ClientContact;
use App\Models\Company;
use App\Models\SystemLog;
use App\Models\User;
use App\Providers\MailServiceProvider;
use Dacastro4\LaravelGmail\Services\Message\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
/*Multi Mailer Router implemented*/
class MailRouter extends BaseMailerJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $mailable;
public $company;
public $to_user; //User or ClientContact
public $sending_method;
public $settings;
public function __construct(Mailable $mailable, Company $company, $to_user, string $sending_method)
{
$this->mailable = $mailable;
$this->company = $company;
$this->to_user = $to_user;
$this->sending_method = $sending_method;
if($to_user instanceof ClientContact)
$this->settings = $to_user->client->getMergedSettings();
else
$this->settings = $this->company->settings;
}
public function handle()
{
MultiDB::setDb($this->company->db);
//if we need to set an email driver do it now
$this->setMailDriver();
//send email
Mail::to($this->to_user->email)
->send($this->mailable);
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures(), $this->to_user);
}
}
}

View File

@ -44,6 +44,8 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
public $amount;
public $settings;
/**
* Create a new job instance.
*
@ -58,6 +60,8 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
$this->client = $client;
$this->amount = $amount;
$this->settings = $client->getMergedSettings();
}
/**
@ -72,7 +76,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
MultiDB::setDb($this->company->db);
//if we need to set an email driver do it now
$this->setMailDriver($this->client->getSetting('email_sending_method'));
$this->setMailDriver();
//iterate through company_users
$this->company->company_users->each(function ($company_user){
@ -93,7 +97,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->client);
}
}
@ -102,16 +106,5 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->client
);
}
}

View File

@ -34,6 +34,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
protected $company;
public $settings;
/**
* Create a new job instance.
*
@ -45,6 +46,8 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
$this->new_email = $new_email;
$this->old_email = $old_email;
$this->company = $company;
$this->settings = $this->company->settings;
}
public function handle()
@ -53,7 +56,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
MultiDB::setDb($this->company->db);
//If we need to set an email driver do it now
$this->setMailDriver($this->company->settings->email_sending_method);
$this->setMailDriver();
/*Build the object*/
$mail_obj = new \stdClass;
@ -72,7 +75,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
//Catch errors and report.
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->company);
}
}
@ -94,15 +97,4 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
];
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->company
);
}
}

View File

@ -49,4 +49,12 @@ class CompanyToken extends BaseModel
{
return $this->belongsTo(Company::class);
}
public function company_user()
{
return $this->hasOne(CompanyUser::class,'user_id','user_id')
->where('company_id', $this->company_id)
->where('user_id', $this->user_id);
}
}

160
composer.lock generated
View File

@ -107,16 +107,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.147.8",
"version": "3.147.14",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "b121ee1d69d3a1200ebc22d937cd40043b96a940"
"reference": "2ac5757aee4333c382c222880a51bd56930dafc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b121ee1d69d3a1200ebc22d937cd40043b96a940",
"reference": "b121ee1d69d3a1200ebc22d937cd40043b96a940",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2ac5757aee4333c382c222880a51bd56930dafc4",
"reference": "2ac5757aee4333c382c222880a51bd56930dafc4",
"shasum": ""
},
"require": {
@ -188,7 +188,7 @@
"s3",
"sdk"
],
"time": "2020-07-29T18:16:33+00:00"
"time": "2020-08-06T18:18:37+00:00"
},
{
"name": "checkout/checkout-sdk-php",
@ -420,16 +420,16 @@
},
{
"name": "composer/composer",
"version": "1.10.9",
"version": "1.10.10",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
"reference": "83c3250093d5491600a822e176b107a945baf95a"
"reference": "32966a3b1d48bc01472a8321fd6472b44fad033a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/composer/zipball/83c3250093d5491600a822e176b107a945baf95a",
"reference": "83c3250093d5491600a822e176b107a945baf95a",
"url": "https://api.github.com/repos/composer/composer/zipball/32966a3b1d48bc01472a8321fd6472b44fad033a",
"reference": "32966a3b1d48bc01472a8321fd6472b44fad033a",
"shasum": ""
},
"require": {
@ -510,7 +510,7 @@
"type": "tidelift"
}
],
"time": "2020-07-16T10:57:00+00:00"
"time": "2020-08-03T09:35:19+00:00"
},
{
"name": "composer/package-versions-deprecated",
@ -1103,38 +1103,24 @@
"sqlserver",
"sqlsrv"
],
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2020-04-20T17:19:26+00:00"
},
{
"name": "doctrine/event-manager",
"version": "1.1.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "629572819973f13486371cb611386eb17851e85c"
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c",
"reference": "629572819973f13486371cb611386eb17851e85c",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/common": "<2.9@dev"
@ -1193,7 +1179,21 @@
"event system",
"events"
],
"time": "2019-11-10T09:48:07+00:00"
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
"type": "tidelift"
}
],
"time": "2020-05-29T18:28:51+00:00"
},
{
"name": "doctrine/inflector",
@ -1747,16 +1747,16 @@
},
{
"name": "google/apiclient-services",
"version": "v0.141",
"version": "v0.142",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "4ba7279b0a56366e4f19b9d1a1b5456f99353b6f"
"reference": "3baf0a665cd08975314214b075f28765c97282ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/4ba7279b0a56366e4f19b9d1a1b5456f99353b6f",
"reference": "4ba7279b0a56366e4f19b9d1a1b5456f99353b6f",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/3baf0a665cd08975314214b075f28765c97282ae",
"reference": "3baf0a665cd08975314214b075f28765c97282ae",
"shasum": ""
},
"require": {
@ -1780,7 +1780,7 @@
"keywords": [
"google"
],
"time": "2020-07-27T00:25:27+00:00"
"time": "2020-07-28T00:24:58+00:00"
},
{
"name": "google/auth",
@ -2464,16 +2464,16 @@
},
{
"name": "laravel/framework",
"version": "v6.18.31",
"version": "v6.18.35",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "a731824421f9ebc586728ea9c7cff231a249aaa9"
"reference": "baec6c2d7f433594cb858c35c2a2946df7ecac13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/a731824421f9ebc586728ea9c7cff231a249aaa9",
"reference": "a731824421f9ebc586728ea9c7cff231a249aaa9",
"url": "https://api.github.com/repos/laravel/framework/zipball/baec6c2d7f433594cb858c35c2a2946df7ecac13",
"reference": "baec6c2d7f433594cb858c35c2a2946df7ecac13",
"shasum": ""
},
"require": {
@ -2608,7 +2608,7 @@
"framework",
"laravel"
],
"time": "2020-07-27T18:23:18+00:00"
"time": "2020-08-07T15:06:09+00:00"
},
{
"name": "laravel/slack-notification-channel",
@ -3613,25 +3613,25 @@
},
{
"name": "mtdowling/jmespath.php",
"version": "2.5.0",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/jmespath/jmespath.php.git",
"reference": "52168cb9472de06979613d365c7f1ab8798be895"
"reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895",
"reference": "52168cb9472de06979613d365c7f1ab8798be895",
"url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb",
"reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"symfony/polyfill-mbstring": "^1.4"
"php": "^5.4 || ^7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.17"
},
"require-dev": {
"composer/xdebug-handler": "^1.2",
"phpunit/phpunit": "^4.8.36|^7.5.15"
"composer/xdebug-handler": "^1.4",
"phpunit/phpunit": "^4.8.36 || ^7.5.15"
},
"bin": [
"bin/jp.php"
@ -3639,7 +3639,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
"dev-master": "2.6-dev"
}
},
"autoload": {
@ -3666,7 +3666,7 @@
"json",
"jsonpath"
],
"time": "2019-12-30T18:03:34+00:00"
"time": "2020-07-31T21:01:56+00:00"
},
{
"name": "myclabs/php-enum",
@ -3716,16 +3716,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.37.0",
"version": "2.38.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "1f61206de973d67f36ce50f041c792ddac663c3e"
"reference": "d8f6a6a91d1eb9304527b040500f61923e97674b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e",
"reference": "1f61206de973d67f36ce50f041c792ddac663c3e",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d8f6a6a91d1eb9304527b040500f61923e97674b",
"reference": "d8f6a6a91d1eb9304527b040500f61923e97674b",
"shasum": ""
},
"require": {
@ -3740,7 +3740,7 @@
"kylekatarnls/multi-tester": "^2.0",
"phpmd/phpmd": "^2.8",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.30",
"phpstan/phpstan": "^0.12.35",
"phpunit/phpunit": "^7.5 || ^8.0",
"squizlabs/php_codesniffer": "^3.4"
},
@ -3801,7 +3801,7 @@
"type": "tidelift"
}
],
"time": "2020-07-28T06:04:54+00:00"
"time": "2020-08-04T19:12:46+00:00"
},
{
"name": "nikic/php-parser",
@ -6111,16 +6111,16 @@
},
{
"name": "stripe/stripe-php",
"version": "v7.45.0",
"version": "v7.46.1",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058"
"reference": "fd57205d3e3a1dccab80538654128d5c46a1f5ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/21e5001f5e0d787e4755c8bfc00e578dce9ae058",
"reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/fd57205d3e3a1dccab80538654128d5c46a1f5ac",
"reference": "fd57205d3e3a1dccab80538654128d5c46a1f5ac",
"shasum": ""
},
"require": {
@ -6164,7 +6164,7 @@
"payment processing",
"stripe"
],
"time": "2020-07-29T04:29:52+00:00"
"time": "2020-08-07T22:11:58+00:00"
},
{
"name": "swiftmailer/swiftmailer",
@ -7202,7 +7202,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@ -7278,7 +7278,7 @@
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
@ -7355,16 +7355,16 @@
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe"
"reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/5dcab1bc7146cf8c1beaa4502a3d9be344334251",
"reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251",
"shasum": ""
},
"require": {
@ -7436,11 +7436,11 @@
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
"time": "2020-08-04T06:02:08+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -7521,7 +7521,7 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@ -7598,7 +7598,7 @@
},
{
"name": "symfony/polyfill-php70",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
@ -7675,7 +7675,7 @@
},
{
"name": "symfony/polyfill-php72",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
@ -7748,7 +7748,7 @@
},
{
"name": "symfony/polyfill-php73",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
@ -7824,7 +7824,7 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
@ -7904,7 +7904,7 @@
},
{
"name": "symfony/polyfill-uuid",
"version": "v1.18.0",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-uuid.git",
@ -10937,16 +10937,16 @@
},
{
"name": "swagger-api/swagger-ui",
"version": "v3.30.2",
"version": "v3.31.1",
"source": {
"type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "d8521c1bc067cfa57108ecf8f1a513db039ff1da"
"reference": "752488edf7ff5b3f98fde2d069e4cd5eff150cd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/d8521c1bc067cfa57108ecf8f1a513db039ff1da",
"reference": "d8521c1bc067cfa57108ecf8f1a513db039ff1da",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/752488edf7ff5b3f98fde2d069e4cd5eff150cd0",
"reference": "752488edf7ff5b3f98fde2d069e4cd5eff150cd0",
"shasum": ""
},
"type": "library",
@ -10990,7 +10990,7 @@
"swagger",
"ui"
],
"time": "2020-07-22T20:37:48+00:00"
"time": "2020-07-30T18:09:18+00:00"
},
{
"name": "symfony/yaml",

View File

@ -0,0 +1,45 @@
<?php
namespace Tests\Integration;
use App\Models\Company;
use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Cache;
use Tests\MockAccountData;
use Tests\TestCase;
/**
* @test
*/
class ContainerTest extends TestCase
{
use MockAccountData;
public function setUp() :void
{
parent::setUp();
$this->makeTestData();
app()->instance(Company::class, $this->company);
}
public function testBindingWorks()
{
$resolved_company = resolve(Company::class);
$this->assertNotNull($resolved_company);
$this->assertEquals($this->account->id, $resolved_company->account_id);
}
}