/**
  * Create a new ticket
  * @param TicketRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function store(TicketRequest $request)
 {
     try {
         $ticket = new Ticket(['account_id' => get_user()->account_id, 'email_address' => get_user()->email_address, 'subject' => $request->input('subject'), 'description' => $request->input('description'), 'ticket_group_id' => Config::get("customer_portal.ticket_group_id"), 'user_id' => Config::get("customer_portal.ticket_user_id"), 'priority' => Config::get("customer_portal.ticket_priority"), 'inbound_email_account_id' => Config::get("customer_portal.inbound_email_account_id")]);
     } catch (Exception $e) {
         Log::error($e->getMessage());
         return redirect()->back()->withErrors(trans("errors.failedToCreateTicket"))->withInput();
     }
     $accountTicketController = new AccountTicketController();
     try {
         $accountTicketController->createTicket($ticket, get_user()->contact_name, get_user()->email_address);
     } catch (Exception $e) {
         Log::error($e->getMessage());
         return redirect()->back()->withErrors(trans("errors.failedToCreateTicket"))->withInput();
     }
     $this->clearTicketCache();
     return redirect()->action("TicketController@index")->with('success', trans("tickets.ticketCreated"));
 }
 /**
  * Actual process of storing Ticket
  *
  * @param TicketRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(TicketRequest $request)
 {
     $input = $request->all();
     Ticket::create($input);
     return redirect('/tickets')->with(['flash_message' => 'You have successfully updated the ticket', 'flash_message_important' => true]);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @param TicketRequest $request
  * @return Response
  */
 public function update($id, TicketRequest $request)
 {
     $ticket = Ticket::findOrFail($id);
     $ticket->update($request->all());
     // update users in pivot table
     $this->syncUsers($ticket, $request['user_list']);
     return redirect("tickets/{$id}");
 }
 /**
  * Actual process of storing Ticket
  *
  * @param TicketRequest $request
  * @return Redirector
  */
 public function store(TicketRequest $request)
 {
     $input = $request->all();
     $this->ticket->create($input);
     return redirect('/user/profile')->with(['flash_message' => 'You have successfully created a ticket', 'flash_message_important' => true]);
 }
示例#5
0
 public function update(TicketRequest $request, Ticket $ticket)
 {
     if (!Entrust::can('edit_ticket')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $data = $request->except('user_id');
     $ticket->fill($data)->save();
     $service_time = Helper::getServiceTime($ticket->ticket_priority);
     if ($service_time['resolution_time_type'] == 'business_hour') {
         $ticket->resolution_due_time = Helper::calculateDueTime($service_time['resolution_time'], $ticket->created_at);
     } else {
         $ticket->resolution_due_time = date('Y-m-d H:i', $service_time['resolution_time'] * 60 + strtotime($ticket->created_at));
     }
     if ($service_time['response_time_type'] == 'business_hour') {
         $ticket->response_due_time = Helper::calculateDueTime($service_time['response_time'], $ticket->created_at);
     } else {
         $ticket->response_due_time = date('Y-m-d H:i', $service_time['response_time'] * 60 + strtotime($ticket->created_at));
     }
     $ticket->save();
     Helper::updateCustomField($this->form, $ticket->id, $data);
     $ticket->assignedUser()->sync($request->input('user_id') ?: []);
     return redirect()->back()->withSuccess(config('constants.ADDED'));
 }