-
app/Notifications/TicketReplied.php
Open in GitHubuse App\Models\Ticket; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class TicketReplied extends Notification { use Queueable; public $ticket; public function __construct(Ticket $ticket) { $this->ticket = $ticket; } public function via($notifiable) { return ['mail', 'database']; } public function toMail($notifiable) { return (new MailMessage) ->line('The introduction to the notification.') ->action('Notification Action', url('/')) ->line('Thank you for using our application!'); } public function toArray($notifiable) { return [ 'title' => __('bap.new_ticket_replied') . $this->ticket->id, 'url' => route('panel.support.ticket.view', [$this->ticket->id]), ]; } }
-
app/Http/Livewire/Admin/Support/Ticket/View.php
Open in GitHubuse App\Models\TicketReplay; use App\Notifications\TicketReplied; use Livewire\Component; class View extends Component { // public $ticket; public function replay() { // $this->ticket->user->notify(new TicketReplied($this->ticket)); // } public function mount(Ticket $ticket) { $this->ticket = $ticket; $this->replays = TicketReplay::with(['user', 'files'])->where('ticket_id', $this->ticket->id)->latest()->get(); } // }