mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Document events
This commit is contained in:
parent
822c814914
commit
74450727b1
54
app/Events/Document/DocumentWasArchived.php
Normal file
54
app/Events/Document/DocumentWasArchived.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?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\Events\Document;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
|
||||
/**
|
||||
* Class DocumentWasArchived.
|
||||
*/
|
||||
class DocumentWasArchived
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
*/
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return \Illuminate\Broadcasting\Channel|array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
}
|
38
app/Events/Document/DocumentWasCreated.php
Normal file
38
app/Events/Document/DocumentWasCreated.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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\Events\Document;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class DocumentWasCreated.
|
||||
*/
|
||||
class DocumentWasCreated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
*/
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
}
|
38
app/Events/Document/DocumentWasDeleted.php
Normal file
38
app/Events/Document/DocumentWasDeleted.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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\Events\Document;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class DocumentWasDeleted.
|
||||
*/
|
||||
class DocumentWasDeleted
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
*/
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
}
|
38
app/Events/Document/DocumentWasRestored.php
Normal file
38
app/Events/Document/DocumentWasRestored.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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\Events\Document;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class DocumentWasRestored.
|
||||
*/
|
||||
class DocumentWasRestored
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
*/
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
}
|
38
app/Events/Document/DocumentWasUpdated.php
Normal file
38
app/Events/Document/DocumentWasUpdated.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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\Events\Document;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class DocumentWasUpdated.
|
||||
*/
|
||||
class DocumentWasUpdated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
*/
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
}
|
@ -111,6 +111,17 @@ class EventServiceProvider extends ServiceProvider
|
||||
],
|
||||
ClientWasRestored::class =>[
|
||||
],
|
||||
// Documents
|
||||
DocumentWasCreated::class =>[
|
||||
],
|
||||
DocumentWasArchived::class =>[
|
||||
],
|
||||
DocumentWasUpdated::class =>[
|
||||
],
|
||||
DocumentWasDeleted::class =>[
|
||||
],
|
||||
DocumentWasRestored::class =>[
|
||||
],
|
||||
CreditWasMarkedSent::class => [
|
||||
],
|
||||
//Designs
|
||||
|
42
app/Repositories/DocumentRepository.php
Normal file
42
app/Repositories/DocumentRepository.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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\Repositories;
|
||||
|
||||
use App\Models\Document;
|
||||
|
||||
/**
|
||||
* Class for document repository.
|
||||
*/
|
||||
class DocumentRepository extends BaseRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Document::class;
|
||||
}
|
||||
|
||||
public function delete($document)
|
||||
{
|
||||
$document->deleteFile();
|
||||
$document->forceDelete();
|
||||
}
|
||||
|
||||
public function restore()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
<title>Invoice Ninja</title>
|
||||
<meta name="report_errors" content="{{ $report_errors }}">
|
||||
<meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
|
||||
<meta name="minimum_client_version" content="{{ config('ninja.minimum_client_version') }}">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body style="background-color:#888888;">
|
||||
|
Loading…
x
Reference in New Issue
Block a user