first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-04-23 00:14:33 +06:00
commit 356f56eebd
197 changed files with 21536 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Notifications;
use App\Models\Document;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ApprovalRequestNotification extends Notification
{
use Queueable;
protected $document;
protected $requester;
/**
* Create a new notification instance.
*/
public function __construct(Document $document, User $requester)
{
$this->document = $document;
$this->requester = $requester;
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail', 'database'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Solicitud de aprobación de documento')
->greeting('Hola ' . $notifiable->name . '!')
->line($this->requester->name . ' ha solicitado tu aprobación para el documento:')
->line('**Documento:** ' . $this->document->name)
->action('Revisar Documento', route('documents.show', $this->document))
->line('Fecha límite: ' . $this->document->due_date->format('d/m/Y'))
->line('Gracias por usar nuestro sistema!');
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
'type' => 'approval-request',
'document_id' => $this->document->id,
'requester_id' => $this->requester->id,
'message' => 'Nueva solicitud de aprobación para: ' . $this->document->name,
'link' => route('documents.show', $this->document)
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DocumentStatusChanged extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(public Document $document, public string $action)
{
//
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['database', 'mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject("Document status changed: {$this->document->name}")
->line("The document '{$this->document->name}' has been {$this->action}.")
->action('View Document', route('documents.show', $this->document));
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Notifications;
use App\Models\Document;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DocumentUpdatedNotification extends Notification implements ShouldQueue
{
use Queueable;
protected $document;
/**
* Create a new notification instance.
*/
public function __construct(Document $document)
{
$this->document = $document;
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail', 'database'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Nueva versión de documento: ' . $this->document->name)
->line('Se ha subido una nueva versión del documento.')
->action('Ver Documento', route('documents.show', $this->document))
->line('Gracias por usar nuestro sistema!');
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
'document_id' => $this->document->id,
'message' => 'Nueva versión del documento: ' . $this->document->name,
'url' => route('documents.show', $this->document)
];
}
}