mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Websockets
This commit is contained in:
parent
1076f44fb3
commit
3bb60bdefd
@ -13,15 +13,21 @@ namespace App\Events\Client;
|
|||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use League\Fractal\Manager;
|
||||||
|
use League\Fractal\Resource\Item;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use App\Transformers\ArraySerializer;
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Transformers\ClientTransformer;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ClientWasArchived.
|
* Class ClientWasArchived.
|
||||||
*/
|
*/
|
||||||
class ClientWasArchived
|
class ClientWasArchived implements ShouldBroadcast
|
||||||
{
|
{
|
||||||
use Dispatchable;
|
use Dispatchable;
|
||||||
use InteractsWithSockets;
|
use InteractsWithSockets;
|
||||||
@ -50,13 +56,34 @@ class ClientWasArchived
|
|||||||
$this->event_vars = $event_vars;
|
$this->event_vars = $event_vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
public function broadcastWith()
|
||||||
// * Get the channels the event should broadcast on.
|
{
|
||||||
// *
|
|
||||||
// * @return Channel|array
|
$manager = new Manager();
|
||||||
// */
|
$manager->setSerializer(new ArraySerializer());
|
||||||
|
$class = sprintf('App\\Transformers\\%sTransformer', class_basename($this->client));
|
||||||
|
|
||||||
|
$transformer = new $class();
|
||||||
|
|
||||||
|
$resource = new Item($this->client, $transformer, $this->client->getEntityType());
|
||||||
|
$data = $manager->createData($resource)->toArray();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the channels the event should broadcast on.
|
||||||
|
*
|
||||||
|
* @return Channel|array
|
||||||
|
*/
|
||||||
public function broadcastOn()
|
public function broadcastOn()
|
||||||
{
|
{
|
||||||
return [];
|
|
||||||
|
return [
|
||||||
|
new PrivateChannel("company-{$this->company->company_key}"),
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ use Illuminate\Contracts\Translation\HasLocalePreference;
|
|||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Laracasts\Presenter\PresentableTrait;
|
use Laracasts\Presenter\PresentableTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
|
"ext-curl": "*",
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-curl": "*",
|
|
||||||
"afosto/yaac": "^1.4",
|
"afosto/yaac": "^1.4",
|
||||||
"asm/php-ansible": "dev-main",
|
"asm/php-ansible": "dev-main",
|
||||||
"authorizenet/authorizenet": "^2.0",
|
"authorizenet/authorizenet": "^2.0",
|
||||||
@ -61,7 +61,6 @@
|
|||||||
"hyvor/php-json-exporter": "^0.0.3",
|
"hyvor/php-json-exporter": "^0.0.3",
|
||||||
"imdhemy/laravel-purchases": "^1.7",
|
"imdhemy/laravel-purchases": "^1.7",
|
||||||
"intervention/image": "^2.5",
|
"intervention/image": "^2.5",
|
||||||
"invoiceninja/inspector": "^3.0",
|
|
||||||
"invoiceninja/einvoice": "dev-main",
|
"invoiceninja/einvoice": "dev-main",
|
||||||
"invoiceninja/ubl_invoice": "^2",
|
"invoiceninja/ubl_invoice": "^2",
|
||||||
"josemmo/facturae-php": "^1.7",
|
"josemmo/facturae-php": "^1.7",
|
||||||
|
72
composer.lock
generated
72
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "edc6905124cb32fef6a13befb3d5a4e1",
|
"content-hash": "8fdb8245fbc563f8c09da161876f52a7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adrienrn/php-mimetyper",
|
"name": "adrienrn/php-mimetyper",
|
||||||
@ -2585,7 +2585,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "google/apiclient-services",
|
"name": "google/apiclient-services",
|
||||||
"version": "v0.365.0",
|
"version": "v0.366.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/googleapis/google-api-php-client-services.git",
|
"url": "https://github.com/googleapis/google-api-php-client-services.git",
|
||||||
@ -2623,7 +2623,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
|
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
|
||||||
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.365.0"
|
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.366.0"
|
||||||
},
|
},
|
||||||
"time": "2024-07-11T01:08:44+00:00"
|
"time": "2024-07-11T01:08:44+00:00"
|
||||||
},
|
},
|
||||||
@ -4111,68 +4111,6 @@
|
|||||||
},
|
},
|
||||||
"time": "2024-07-22T02:40:27+00:00"
|
"time": "2024-07-22T02:40:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "invoiceninja/inspector",
|
|
||||||
"version": "v3.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/invoiceninja/inspector.git",
|
|
||||||
"reference": "29bc1ee7ae9d967287ecbd3485a2fee41a13e65f"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/invoiceninja/inspector/zipball/29bc1ee7ae9d967287ecbd3485a2fee41a13e65f",
|
|
||||||
"reference": "29bc1ee7ae9d967287ecbd3485a2fee41a13e65f",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"doctrine/dbal": "^4.0",
|
|
||||||
"illuminate/support": "^11.0",
|
|
||||||
"php": "^8.2"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"orchestra/testbench": "^9.1",
|
|
||||||
"phpunit/phpunit": "^11.1"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"laravel": {
|
|
||||||
"providers": [
|
|
||||||
"InvoiceNinja\\Inspector\\InspectorServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {
|
|
||||||
"Inspector": "InvoiceNinja\\Inspector\\InspectorFacade"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"InvoiceNinja\\Inspector\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Benjamin Beganović",
|
|
||||||
"email": "benjamin.beganovic4@outlook.com",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Simplified database records management",
|
|
||||||
"homepage": "https://github.com/invoiceninja/inspector",
|
|
||||||
"keywords": [
|
|
||||||
"inspector",
|
|
||||||
"invoiceninja"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/invoiceninja/inspector/issues",
|
|
||||||
"source": "https://github.com/invoiceninja/inspector/tree/v3.0"
|
|
||||||
},
|
|
||||||
"time": "2024-06-04T12:31:47+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "invoiceninja/ubl_invoice",
|
"name": "invoiceninja/ubl_invoice",
|
||||||
"version": "v2.2.2",
|
"version": "v2.2.2",
|
||||||
@ -19598,10 +19536,10 @@
|
|||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
|
"ext-curl": "*",
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*"
|
||||||
"ext-curl": "*"
|
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
|
@ -193,7 +193,7 @@ return [
|
|||||||
*/
|
*/
|
||||||
App\Providers\AppServiceProvider::class,
|
App\Providers\AppServiceProvider::class,
|
||||||
App\Providers\AuthServiceProvider::class,
|
App\Providers\AuthServiceProvider::class,
|
||||||
// App\Providers\BroadcastServiceProvider::class,
|
App\Providers\BroadcastServiceProvider::class,
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
App\Providers\RouteServiceProvider::class,
|
App\Providers\RouteServiceProvider::class,
|
||||||
App\Providers\ComposerServiceProvider::class,
|
App\Providers\ComposerServiceProvider::class,
|
||||||
|
@ -39,7 +39,7 @@ return [
|
|||||||
'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
|
'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
|
||||||
'port' => env('PUSHER_PORT', 443),
|
'port' => env('PUSHER_PORT', 443),
|
||||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||||
'encrypted' => true,
|
'encrypted' => false,
|
||||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||||
],
|
],
|
||||||
'client_options' => [
|
'client_options' => [
|
||||||
|
1
public/build/assets/app-039bd735.css
vendored
Normal file
1
public/build/assets/app-039bd735.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -11,6 +11,13 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Broadcast::channel('App.User.{id}', function ($user, $id) {
|
// Broadcast::channel('App.User.{id}', function ($user, $id) {
|
||||||
return (int) $user->id === (int) $id;
|
// nlog($id);
|
||||||
|
|
||||||
|
// return false;
|
||||||
|
// // return (int) $user->id === (int) $id;
|
||||||
|
// });
|
||||||
|
|
||||||
|
Broadcast::channel('company-{company_key}', function (\App\Models\User $user, string $company_key) {
|
||||||
|
return $user->company()->company_key === $company_key;
|
||||||
});
|
});
|
@ -49,3 +49,5 @@ Route::get('checkout/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [C
|
|||||||
Route::get('mollie/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [Mollie3dsController::class, 'index'])->middleware('domain_db')->name('mollie.3ds_redirect');
|
Route::get('mollie/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [Mollie3dsController::class, 'index'])->middleware('domain_db')->name('mollie.3ds_redirect');
|
||||||
Route::get('gocardless/ibp_redirect/{company_key}/{company_gateway_id}/{hash}', [GoCardlessController::class, 'ibpRedirect'])->middleware('domain_db')->name('gocardless.ibp_redirect');
|
Route::get('gocardless/ibp_redirect/{company_key}/{company_gateway_id}/{hash}', [GoCardlessController::class, 'ibpRedirect'])->middleware('domain_db')->name('gocardless.ibp_redirect');
|
||||||
Route::get('.well-known/apple-developer-merchantid-domain-association', [ApplePayDomainController::class, 'showAppleMerchantId']);
|
Route::get('.well-known/apple-developer-merchantid-domain-association', [ApplePayDomainController::class, 'showAppleMerchantId']);
|
||||||
|
|
||||||
|
Broadcast::routes(['middleware' => ['token_auth']]);
|
||||||
|
Loading…
Reference in New Issue
Block a user