help desk admin
This commit is contained in:
parent
9ebb4b1944
commit
ed0d7b0e2f
|
|
@ -745,7 +745,7 @@ class EventAttendeesController extends MyBaseController
|
|||
'email_logo' => $attendee->event->organiser->full_logo_path,
|
||||
];
|
||||
|
||||
if ($request->get('notify_attendee') == '1') {
|
||||
if ($request->get('notify_attendee') == '1') {//todo queue this mail
|
||||
Mail::send('Emails.notifyCancelledAttendee', $data, function ($message) use ($attendee) {
|
||||
$message->to($attendee->email, $attendee->full_name)
|
||||
->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ use App\Http\Requests\HelpTicketRequest;
|
|||
use App\Models\HelpTicket;
|
||||
use App\Models\HelpTicketComment;
|
||||
use App\Models\HelpTopic;
|
||||
use App\Notifications\TicketReceived;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
class HelpDeskController extends Controller
|
||||
{
|
||||
|
|
@ -37,7 +39,7 @@ class HelpDeskController extends Controller
|
|||
|
||||
try{
|
||||
|
||||
$ticekt = HelpTicket::create([
|
||||
$ticket = HelpTicket::create([
|
||||
'name' => $request->get('name'),
|
||||
'email' => $request->get('email'),
|
||||
'text' => $request->get('text'),
|
||||
|
|
@ -46,8 +48,21 @@ class HelpDeskController extends Controller
|
|||
'ticket_category_id' => $request->get('topic'),
|
||||
'attachment' => $request->file('attachment')
|
||||
]);
|
||||
//todo fire event notify admin by mail, attachment
|
||||
return redirect()->route('help.show',['code' => $ticekt->code]);
|
||||
|
||||
|
||||
/**
|
||||
* Notify customer that ticket is received;
|
||||
*/
|
||||
$ticket->notify(new TicketReceived($ticket));
|
||||
|
||||
/**
|
||||
* Notify administrators that ticket is arrived;
|
||||
*/
|
||||
$administrators = User::where('is_admin',1)->get(['id','email']);
|
||||
|
||||
Notification::send($administrators, new TicketReceived($ticket));
|
||||
|
||||
return redirect()->route('help.show',['code' => $ticket->code]);
|
||||
}
|
||||
catch (\Exception $exception){
|
||||
Log::error($exception);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\CrudTrait;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class HelpTicket extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
|
||||
use Notifiable;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|
|
@ -55,6 +56,9 @@ class HelpTicket extends Model
|
|||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public function getOwnerAttribute(){
|
||||
return $this->name ?? $this->email;
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ class HelpTicketComment extends Model
|
|||
public function ticket(){
|
||||
return $this->belongsTo(HelpTicket::class);
|
||||
}
|
||||
|
||||
public function user(){
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|
|
@ -51,6 +55,9 @@ class HelpTicketComment extends Model
|
|||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public function getOwnerAttribute(){
|
||||
return $this->user->full_name ?? $this->name;
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\HelpTicket;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class TicketReceived extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected $ticket;
|
||||
|
||||
public function __construct(HelpTicket $ticket)
|
||||
{
|
||||
$this->ticket = $ticket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return $notifiable instanceof HelpTicket ? ['mail'] : ['mail','database'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
if($notifiable instanceof HelpTicket){
|
||||
return (new MailMessage)
|
||||
->line('The introduction to the notification.')
|
||||
->action('Notification Action', route('help.show',['code' => $this->ticket->code]))
|
||||
->line('Thank you for using our application!');
|
||||
}
|
||||
else
|
||||
return (new MailMessage)
|
||||
->line('You have new ticket')
|
||||
->action('Notification Action', route('ticket.replay',['id'=>$this->ticket->id]))
|
||||
->line('Thank you for using our application!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toDatabase($notifiable)
|
||||
{
|
||||
return $this->ticket->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ use Illuminate\Notifications\Notification;
|
|||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class UserResetPassword extends Notification
|
||||
class UserResetPassword extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8">
|
||||
<div class="alert alert-info" role="alert">
|
||||
<p>{{$entry->text}}</p>
|
||||
<p><strong>{{$entry->owner}} : </strong>{{$entry->text}}</p>
|
||||
<br>
|
||||
@if($entry->attachment)
|
||||
<span><strong>Attachment:</strong> <a href="{{asset('user_content/'.$entry->attachment)}}">{{$entry->attachment}}</a></span>
|
||||
|
|
@ -72,18 +72,37 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@foreach($entry->comments as $comment)
|
||||
<div class="row">
|
||||
<div class="col-lg-offset-4 col-md-offset-4 col-lg-8 col-md-8">
|
||||
<div class="@if($comment->user_id)col-lg-offset-4 col-md-offset-4 @endif col-lg-8 col-md-8">
|
||||
<div class="alert alert-success" role="alert">
|
||||
<p>{{$entry->text}}</p><br>
|
||||
@if($entry->attachment)
|
||||
<span><strong>Attachment:</strong> <a href="{{asset('user_content/'.$entry->attachment)}}">{{$entry->attachment}}</a></span>
|
||||
<p><strong>{{$comment->name}} : </strong>{{$comment->text}}</p><br>
|
||||
@if($comment->attachment)
|
||||
<span><strong>Attachment:</strong> <a href="{{asset('user_content/'.$comment->attachment)}}">{{$comment->attachment}}</a></span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<form action="{{route('',['id' => $entry->getKey()])}}" method="post">
|
||||
@csrf
|
||||
<div class="form-group custom-theme {{ ($errors->has('text')) ? 'has-error' : '' }}">
|
||||
{!! Form::label('text', trans("ClientSide.text"), array('class'=>'control-label required')) !!}
|
||||
{!! Form::textarea('text', old('text'),
|
||||
array(
|
||||
'class'=>'form-control editable',
|
||||
'rows' => 5
|
||||
)) !!}
|
||||
@if($errors->has('text'))
|
||||
<p class="help-block">{{ $errors->first('text') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
{!! Form::submit(trans("ClientSide.create_ticket"), ['class'=>"btn btn-success"]) !!}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -51,11 +51,12 @@
|
|||
<div class="form-group {{ ($errors->has('attachment')) ? 'has-error' : '' }}">
|
||||
{!! Form::label('attachment', trans("ClientSide.attachment"), array('class'=>'control-label')) !!}
|
||||
{!! Form::file('attachment') !!}
|
||||
@if($errors->has('attachment'))
|
||||
<p class="help-block">{{ $errors->first('attachment') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
{!! Form::submit(trans("ClientSide.create_ticket"), ['class'=>"btn btn-success"]) !!}
|
||||
@if($errors->has('attachment'))
|
||||
<p class="help-block">{{ $errors->first('attachment') }}</p>
|
||||
@endif
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue