mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
957ac9f5d8
* Remove unnecessary save() on invoice * Update copyright * Working on Credit Repository * Implement credits as a paymentable entity * Add credit_id to transformer * fix rules for update payment * Fix random deleted_at keys in transformers * Fix for password_protect check
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?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\Helpers\Mail;
|
|
|
|
use App\Libraries\MultiDB;
|
|
use App\Mail\SupportMessageSent;
|
|
use App\Models\User;
|
|
use App\Providers\MailServiceProvider;
|
|
use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Laravel\Socialite\Facades\Socialite;
|
|
|
|
/**
|
|
* GmailTransportConfig
|
|
*/
|
|
class GmailTransportConfig
|
|
{
|
|
public function test()
|
|
{
|
|
/********************* We may need to fetch a new token on behalf of the client ******************************/
|
|
$query = [
|
|
'email' => 'david@invoiceninja.com',
|
|
];
|
|
|
|
$user = MultiDB::hasUser($query);
|
|
// $oauth_user = Socialite::driver('google')->stateless()->userFromToken($user->oauth_user_token);
|
|
|
|
// $user->oauth_user_token = $oauth_user->refreshToken;
|
|
// $user->save();
|
|
|
|
Config::set('mail.driver', 'gmail');
|
|
Config::set('services.gmail.token', $user->oauth_user_token);
|
|
(new MailServiceProvider(app()))->register();
|
|
|
|
|
|
Mail::to('david@romulus.com.au')
|
|
->send(new SupportMessageSent('a cool message'));
|
|
}
|
|
}
|