/** * Loads ticket selected with page slug */ public function onRun() { $hash = $this->property('slug'); $creator = \Auth::getUser(); $ticket = Ticket::where('hash_id', $hash)->where('creator_id', $creator->id)->first(); $ticketFiles = TicketAttachment::where('ticket_id', $ticket->id)->get(); $this->page['ticket'] = $ticket; $this->page['ticket_files'] = $ticketFiles; }
/** * Controller index */ public function index() { $user = BackendAuth::getUser(); if (isset($user) && !empty($user)) { $uid = $user->id; } else { $uid = 0; } $file = new TicketAttachment(); if (!$this->user->hasAnyAccess(['keios.support.attachments'])) { $this->vars['total'] = $file->where('user_id', $uid)->count(); } else { $this->vars['total'] = TicketAttachment::count(); } $this->asExtension('ListController')->index(); }