Merge branch 'v5-develop' into v5-develop

Signed-off-by: David Bomba <turbo124@gmail.com>
This commit is contained in:
David Bomba 2024-09-22 06:37:16 +10:00 committed by GitHub
commit b1b301cc0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 58 additions and 14 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@ -14,14 +15,16 @@ namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use App\Models\Payment;
use App\Utils\Traits\Invoice\Broadcasting\DefaultInvoiceBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
/**
* Class InvoiceWasPaid.
*/
class InvoiceWasPaid
class InvoiceWasPaid implements ShouldBroadcast
{
use SerializesModels;
use SerializesModels, DefaultInvoiceBroadcast;
/**
* @var Invoice

View File

@ -0,0 +1,42 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Utils\Traits\Invoice\Broadcasting;
use App\Transformers\ArraySerializer;
use Illuminate\Broadcasting\PrivateChannel;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
trait DefaultInvoiceBroadcast
{
public function broadcastOn(): array
{
return [
new PrivateChannel("company-{$this->company->company_key}"),
];
}
public function broadcastWith(): array
{
$manager = new Manager();
$manager->setSerializer(new ArraySerializer());
$class = sprintf('App\\Transformers\\%sTransformer', class_basename($this->invoice));
$transformer = new $class();
$resource = new Item($this->invoice, $transformer, $this->invoice->getEntityType());
$data = $manager->createData($resource)->toArray();
return $data;
}
}

View File

@ -32,18 +32,15 @@ return [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY', ''),
'secret' => env('PUSHER_APP_SECRET', ''),
'app_id' => env('PUSHER_APP_ID', ''),
'key' => env('PUSHER_APP_KEY', 'app-key'),
'secret' => env('PUSHER_APP_SECRET', 'app-secret'),
'app_id' => env('PUSHER_APP_ID', 'app-id'),
'options' => [
'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => false,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
'host' => env('PUSHER_HOST', '127.0.0.1'),
'port' => env('PUSHER_PORT', 6001),
'scheme' => env('PUSHER_SCHEME', 'http'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME') === 'https',
],
],

View File

@ -5334,6 +5334,8 @@ $lang = array(
'country_Ceuta' => 'Ceuta',
'country_Canary Islands' => 'Canary Islands',
'lang_Vietnamese' => 'Vietnamese',
'invoice_status_changed' => 'Please note that the status of your invoice has been updated. We recommend refreshing the page to view the most current version.',
'no_unread_notifications' => 'Youre all caught up! No new notifications.',
);
return $lang;