/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($ticket)
 {
     $ticket = Ticket::where('id', $ticket)->first();
     $responses = $ticket->responses()->orderBy('created_at')->get();
     $statusList = StatusList::orderBy('id')->get();
     return view('layouts.ticket_responses.index', ['ticket' => $ticket, 'responses' => $responses, 'statusList' => $statusList, 'my_permissions' => $this->my_permissions]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request, $status = 1, $group = '')
 {
     $my_groups = Customer::where('id', $this->my_customer_id)->first()->groups()->where('active', '1')->get();
     if ($group !== '') {
         $tickets = Ticket::where('group_id', $group)->where('status_id', $status)->get();
     } else {
         //$tickets = Ticket::where('user_id', $request->user()->id)->where('status_id', $status)->get();
         $_groups = [];
         foreach ($my_groups as $_group) {
             $_groups[] = $_group->id;
         }
         $tickets = Ticket::whereRaw('group_id in (' . implode(', ', $_groups) . ') and status_id = ' . $status)->orderBy('created_at')->get();
     }
     $statusList = StatusList::orderBy('id')->get();
     return view('layouts.ticket.index', ['tickets' => $tickets, 'my_groups' => $my_groups, 'sel_group' => $group, 'statusList' => $statusList, 'sel_status' => $status]);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['name' => 'required|max:255', 'description' => 'required', 'color' => 'required']);
     StatusList::where('id', $id)->update(['name' => $request->name, 'description' => $request->description, 'color' => $request->color]);
     return redirect('/status');
 }