コード例 #1
0
ファイル: UploadController.php プロジェクト: extjac/qops01
 /**
  * upload New Tickets
  *
  * @return Response
  */
 public function postUploadTickets(Request $request)
 {
     $file = $request->file;
     // your file upload input field in the form should be named 'file'
     //validate the upload
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         return redirect('/tickets/upload?error')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
     }
     if (($handle = fopen($file, 'r')) !== FALSE) {
         while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) {
             $ticket = new Ticket();
             $ticket->requester = $row[0];
             $ticket->ref_number = $row[1];
             $ticket->open_date = $row[2];
             $ticket->service = $row[3];
             $ticket->priority = $row[4];
             $ticket->sla_breached = $row[5];
             $ticket->customer = $row[6];
             $ticket->location = $row[7];
             $ticket->reporting_method = $row[8];
             $ticket->resolver_group = $row[9];
             $ticket->resolution_code = $row[10];
             $ticket->cause_code = $row[11];
             $ticket->responsible_party = $row[12];
             $ticket->reported_by = $row[13];
             //$ticket->closed_by          = $row[14] ;
             $ticket->save();
         }
     }
     return redirect('/tickets/upload?done=1');
 }
コード例 #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TicketFormRequest $request)
 {
     $slug = uniqid();
     $ticket = new Ticket(array('title' => $request->get('title'), 'content' => $request->get('content'), 'slug' => $slug, 'user_id' => 0));
     $ticket->save();
     return redirect('/contact')->with('status', 'Your ticket has been created! Its unique id is: ' . $slug);
 }
 public function composeNav()
 {
     view()->composer(['layouts._leftnav', 'layouts._filternav'], function ($view) {
         $view->with('backlogs', Backlog::all('id', 'name'));
         $view->with('open_tickets_count', Ticket::where('status', 'open')->count());
         $view->with('close_tickets_count', Ticket::where('status', 'close')->count());
         $view->with('bug_tickets_count', Ticket::where('type', 'bug')->count());
         $view->with('task_tickets_count', Ticket::where('type', 'task')->count());
         $view->with('high_prio_tickets_count', Ticket::where('priority', 'high')->count());
         $view->with('low_prio_tickets_count', Ticket::where('priority', 'low')->count());
         $view->with('medium_prio_tickets_count', Ticket::where('priority', 'medium')->count());
     });
     view()->composer(['tickets.create', 'tickets.show', 'tickets.edit'], function ($view) {
         $ticket = new Ticket();
         $view->with('ticket_types', $ticket->displayTypes());
         $view->with('ticket_priorities', $ticket->displayPriorities());
         $view->with('backlogs', Backlog::all('id', 'name'));
         $view->with('users', User::all('id', 'name'));
     });
     view()->composer(['user.profile'], function ($view) {
         $view->with('user_all_tickets', Auth::user()->tickets()->paginate(10));
     });
     view()->composer(['tickets.index', 'layouts._leftnav', 'layouts._filternav'], function ($view) {
         $view->with('all_tickets_count', Ticket::all()->count());
     });
 }
コード例 #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $validator = Validator::make($request->all(), ["terminal_id" => "required", "ticket_type" => "required"]);
     if ($validator->fails()) {
         if ($request->ajax()) {
             return response()->json($validator->messages());
         } else {
             return \Redirect::back()->withErrors($validator)->withInput();
         }
     }
     $input = $request->all();
     $stack = new Ticketstack();
     $stack->batch_code = Ticket::stackCode();
     $stack->created_at = date("Y-m-d H:i:s");
     $stack->save();
     $ticket = new Ticket();
     $terminal = Busstop::where("short_name", "=", trim($input['terminal_id']))->first();
     $count = $input['qty'];
     for ($k = 1; $k <= $count; $k++) {
         $time = time();
         DB::table('ticketseed')->insert(['code' => $time]);
         $mid = DB::table("ticketseed")->max("id");
         $amount = $input['ticket_type'] == 1 ? $terminal->one_way_to_fare : $terminal->one_way_from_fare;
         Ticket::insert(array("code" => $ticket->ticketCode($mid), "serial_no" => $ticket->uniqueID($mid), "terminal_id" => $terminal->id, "stack_id" => $stack->id, "route_id" => $terminal->id, "amount" => $amount, "ticket_type" => $input['ticket_type']));
     }
 }
コード例 #5
0
 public function compose(View $view, Ticket $ticket)
 {
     $tickets_c = $ticket->latest()->completed()->get();
     $tickets_p = $ticket->latest()->pending()->get();
     $tickets_cmt = DB::table('tickets')->join('comments', 'tickets.id', '=', 'comments.post_id')->select('tickets.*')->distinct()->get();
     //		$view->with(['tickets_c', $tickets_c, 'tickets_p', $tickets_p, 'tickets_cmt', $tickets_cmt]);
     $view->with(['tickets_c' => $tickets_c, 'tickets_p' => $tickets_p, 'tickets_cmt' => $tickets_cmt]);
 }
コード例 #6
0
ファイル: Ticket.php プロジェクト: juans05/rimacSeguros
 public static function registrarHIjo($nroTicket, $ticketPadre, $usucrea)
 {
     $ticket = new Ticket();
     $ticket->nroticket = $nroTicket;
     $ticket->usucrea = $usucrea;
     $ticket->ticket_padre = $ticketPadre;
     $ticket->save();
     return $ticket->id;
 }
コード例 #7
0
 /**
  * Store a new ticket
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function newTicket(Request $request)
 {
     $messages = ['required' => 'The :attribute is mandatory', 'phone_number.regex' => 'The phone number must be in E.164 format'];
     $this->validate($request, ['name' => 'required', 'phone_number' => 'required|regex:/^\\+[1-9]\\d{1,14}$/', 'description' => 'required'], $messages);
     $newTicket = new Ticket($request->all());
     $newTicket->save();
     $request->session()->flash('status', "We've received your support ticket. We'll be in touch soon!");
     return redirect()->route('home');
 }
コード例 #8
0
 /**
  * Add a new public contact.
  *
  * @param Ticket $ticket
  * @param PublicMessageRequest $request
  * @param PublicContactRequest $contactRequest
  */
 public function addNewPublicContact(Ticket $ticket, PublicMessageRequest $request, PublicContactRequest $contactRequest)
 {
     // add a new (or update) public contact
     if ($request['public_notify'] || $request['notify']) {
         $contact = PublicContact::firstOrNew(['ticket_id' => $ticket->id, 'email' => $contactRequest['email']]);
         // create an unsubscribe slug if there isn't one
         if (is_null($contact->unsubscribe_slug)) {
             $contactRequest['unsubscribe_slug'] = rand(1000000000, 9999999999);
         }
         $contact->fill($contactRequest->all());
         $ticket->publicContacts()->save($contact);
     }
 }
コード例 #9
0
 /**
  * Delete Ticket
  *
  * @param $id
  * @return RedirectResponse
  */
 public function destroy($id)
 {
     $ticket = $this->ticket->findOrFail($id);
     $this->authorize('delete-post', $ticket);
     $ticket->delete();
     return redirect('/tickets')->with('flash_message', 'You have successfully deleted the ticket');
 }
コード例 #10
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $client = false;
     if ($this->method() == 'PATCH') {
         $routeAction = $this->route()->getAction();
         $routeParameters = $this->route()->parameters();
         $tid = false;
         if (isset($routeParameters['ticketId'])) {
             $tid = $routeParameters['ticketId'];
         } else {
             if (isset($routeParameters['one'])) {
                 $tid = $routeParameters['one'];
             }
         }
         $ticket = \App\Ticket::find($tid);
         if (!$ticket) {
             dd('error');
         }
     }
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'PUT':
             return ['title' => 'required', 'status_id' => 'required', 'priority' => 'required'];
         case 'PATCH':
             return ['title' => 'required', 'status_id' => 'required', 'priority' => 'required'];
         default:
             return [];
             break;
     }
 }
コード例 #11
0
 public function home(Content $content, Ticket $ticket, User $user, Application $application, BusinessUnit $businessUnit)
 {
     //FIND USERS WITH SUBMITTED TICKETS
     $users_with_tickets = User::has('tickets')->get();
     //USERS WHO ARE NOT ADMIN
     $non_admin_users = $user->notAdmin()->get();
     $admin_users = $user->admins()->get();
     $tickets_all = $ticket->all()->count();
     $tickets_c = $ticket->completed()->get()->count();
     $prj_brief_records = $content->latest()->brief()->get();
     $prj_notes_records = $content->latest()->notes()->get();
     $status_records = $content->latest()->status()->get();
     $applications = $application->get();
     $users = $user->get();
     return view('pages.home', compact('prj_notes_records', 'status_records', 'tickets_c', 'tickets_all', 'users_with_tickets', 'applications', 'non_admin_users', 'admin_users', 'users'));
 }
コード例 #12
0
ファイル: ChartController.php プロジェクト: extjac/qops01
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $date = date('Y-m-');
     $compliance = TicketItem::select(\DB::raw("  IFNULL( Sum(`tickets_items`.`weight` * `tickets_items`.`score` ) ,0)  AS score "))->join('ticket', 'ticket.id', '=', 'tickets_items.id')->groupBy('requester')->get();
     $tickets = Ticket::select('requester', \DB::raw("count(ticket.requester) AS requesters "))->groupBy('requester')->get();
     return \Response::json(["legends" => $tickets->lists('requester'), "set1" => $tickets->lists('requesters'), "set2" => $compliance->lists('score')], 200, [], JSON_NUMERIC_CHECK);
 }
コード例 #13
0
 public function create(Request $request)
 {
     $ticket = new Ticket();
     $ticket->customer_name = $request->get('customer_name');
     $ticket->customer_address = $request->get('customer_address');
     $ticket->customer_tel = $request->get('customer_tel');
     $ticket->customer_email = $request->get('customer_email');
     $ticket->type = $request->get('type');
     $ticket->category_id = $request->get('category_id');
     $ticket->post_serial = $request->get('post_serial');
     $ticket->description = $request->get('description');
     $ticket->user_created = Auth::user()->id;
     if (!$ticket->save()) {
         return 'There was an error';
     }
     return 'Ticket created';
 }
コード例 #14
0
 /**
  * Store a newly created resource in storage.
  *
  * @param PublicMessageRequest $request
  * @param PublicContactRequest $contactRequest
  * @return Response
  */
 public function store(PublicMessageRequest $request, PublicContactRequest $contactRequest)
 {
     // get ticket
     $ticket = Ticket::whereId($request['ticket_id'])->whereSlug($request['ticket_slug'])->firstOrFail();
     // add new message
     $message = $this->addNewPublicMessage($ticket, $request, $contactRequest);
     return redirect("x/{$ticket->id}/{$ticket->slug}#msg{$message->id}");
 }
コード例 #15
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     Ticket::create(['title' => 'Ticket 1', 'user_id' => 1, 'project_id' => 1, 'priority' => 0.5, 'progress' => 0.4, 'est_time' => 1.2, 'status_id' => 1, 'severity_id' => 1, 'ticket_type_id' => 1, 'description' => $faker->text, 'assignee_id' => 2]);
     Ticket::create(['title' => 'Ticket 2', 'user_id' => 2, 'project_id' => 1, 'priority' => 0.4, 'progress' => 0.4, 'est_time' => 1.2, 'status_id' => 1, 'severity_id' => 1, 'ticket_type_id' => 1, 'description' => $faker->text, 'assignee_id' => 2]);
     Ticket::create(['title' => 'Ticket 3', 'user_id' => 2, 'project_id' => 1, 'priority' => 0.3, 'progress' => 0.4, 'est_time' => 1.2, 'status_id' => 1, 'severity_id' => 1, 'ticket_type_id' => 1, 'description' => $faker->text, 'assignee_id' => 2]);
     Ticket::create(['title' => 'Ticket 4', 'user_id' => 1, 'project_id' => 1, 'priority' => 0.3, 'progress' => 0.4, 'est_time' => 1.2, 'status_id' => 1, 'severity_id' => 1, 'ticket_type_id' => 1, 'description' => $faker->text, 'assignee_id' => 3]);
 }
コード例 #16
0
ファイル: TicketsComposer.php プロジェクト: vik0803/ticketl4
 public function compose($view)
 {
     $view->with('is_staff', $this->app['auth']->user()->staff ? true : false);
     // $view->with('staff', Staff::all()->lists('display_name', 'id'));
     $view->with('open_count', Ticket::getOpenCount(!$this->app['auth']->user()->staff ? $this->app['auth']->user()->id : null));
     $view->with('close_count', Ticket::getClosedCount(!$this->app['auth']->user()->staff ? $this->app['auth']->user()->id : null));
     $view->with('assigned_count', !$this->app['auth']->user()->staff ? 0 : Ticket::getAssignedCount($this->app['auth']->user()->staff->id));
     $view->with('priorities', ['1' => '1 - Business is stopped', '2' => '2 - User is stopped', '3' => '3 - Business is hendered', '4' => '4 - User is hendered', '5' => '5 - Increase productivity/savings']);
 }
コード例 #17
0
ファイル: TicketSeeder.php プロジェクト: TheJokersThief/Eve
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Add Admin ticket
     Ticket::firstOrCreate(['user_id' => '1', 'event_id' => '1']);
     // Add staff user ticket
     Ticket::firstOrCreate(['user_id' => '3', 'event_id' => '1']);
     // Add normal user ticket
     Ticket::firstOrCreate(['user_id' => '5', 'event_id' => '1']);
 }
コード例 #18
0
 public function store($data)
 {
     $ticketId = $data['ticketId'];
     $name = $data['name'];
     $description = $data['description'];
     $newTicketInformation = new TicketInformation(['name' => $name, 'description' => $description]);
     $ticket = Ticket::findOrFail($ticketId);
     return $ticket->information()->save($newTicketInformation);
 }
コード例 #19
0
ファイル: ValidationRules.php プロジェクト: vik0803/ticketl4
 public function validateCanReply($attribute, $value)
 {
     if (Auth::user()->staff) {
         return true;
     }
     if (Ticket::checkUserTicket($value, Auth::user()->id)) {
         return true;
     }
     return false;
 }
コード例 #20
0
ファイル: TimeEntry.php プロジェクト: pruthvi-k/timesheet
 public function timeEntryForTicket($string)
 {
     $string = trim($string);
     $string = str_replace('#', '', $string);
     $ticket = Ticket::find($string);
     if ($ticket) {
         return $ticket;
     }
     return false;
 }
コード例 #21
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $ticket = Ticket::whereId($id)->first();
     if (!$ticket) {
         return $this->responseNoteFound();
     }
     $this->dispatch(new SolveTicket($ticket, $this->sendesk));
     $ticket->delete();
     return $this->respondSuccess();
 }
コード例 #22
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Ticket::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
コード例 #23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $groups = Customer::where('id', $this->my_customer_id)->first()->groups()->get();
     $my_groups = [];
     foreach ($groups as $group) {
         $my_groups[] = $group->id;
     }
     //$tickets = Ticket::whereRaw('group_id in (' . implode(', ', $my_groups) . ')')->orderBy('updated_at', 'desc')->take(5)->get();
     $tickets = Ticket::whereIn('group_id', $my_groups)->where('status_id', '1')->orderBy('updated_at', 'desc')->take(5)->get();
     return view('layouts.dashboard.index', ['my_permissions' => $this->my_permissions, 'tickets' => $tickets]);
 }
コード例 #24
0
ファイル: MicroserviceTest.php プロジェクト: AramAnd/tickets
 public function testIndividualTicket()
 {
     $ticketId = factory(Ticket::class)->create()->id;
     //create new ticket
     $this->assertEquals(200, $this->call('get', 'v1/tickets/' . $ticketId)->status());
     //find created ticket
     Ticket::destroy($ticketId);
     //delet created ticket
     $this->assertEquals(404, $this->call('get', 'v1/tickets/' . $ticketId)->status());
     //find deleted one
 }
コード例 #25
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(SendMailInterface $mail)
 {
     $ticketObj = new Ticket();
     $ticket = $ticketObj->getTicketById($this->ticket->id);
     $select = ['u.name', 'u.email'];
     $followers = DB::table('ticket_followers as tf')->select($select)->join('users as u', 'u.id', '=', 'tf.user_id')->where('tf.ticket_id', $this->ticket->id)->get();
     // \Log::info(print_r($ticket, 1));
     // send email to user who was assigned the ticket
     $mail->mail(['from' => '*****@*****.**', 'fromName' => 'Amitav Roy', 'to' => $ticket->users[0]->email, 'toName' => 'Amitav Roy', 'subject' => '[New ticket] #' . $ticket->id . ' - ' . $ticket->title, 'mailBody' => view('mails.ticket-assigned', compact('ticket'))]);
     // sending mail to all the followers
     if ($followers) {
         foreach ($followers as $follower) {
             // user who is assigned should not get the email again if he is
             // also in the followers list
             if ($ticket->users[0]->email != $follower->email) {
                 $mail->mail(['from' => '*****@*****.**', 'fromName' => 'Amitav Roy', 'to' => $follower->email, 'toName' => $follower->name, 'subject' => '[New ticket to follow] #' . $ticket->id . ' - ' . $ticket->title, 'mailBody' => view('mails.ticket-assigned', compact('ticket'))]);
             }
         }
     }
 }
コード例 #26
0
 public function update($project_id, $ticket_id)
 {
     $input = \Input::all();
     $v = \Validator::make($input['ticket'], \App\Ticket::$updateRules);
     if ($v->fails()) {
         return \Redirect::route('projects.tickets.edit', ['project_id' => $project_id, 'ticket_id' => $ticket_id])->withErrors($v->errors())->withInput();
     }
     $ticket = \App\Ticket::find($ticket_id);
     $ticket->update($input['ticket']);
     return \Redirect::route('projects.tickets.show', ['project_id' => $project_id, 'ticket_id' => $ticket_id]);
 }
コード例 #27
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Cache $cache)
 {
     $this->info('Calculating stats >>>>>');
     $expiresAt = Carbon::now()->addMinutes(10);
     $tickets = Ticket::withTrashed()->get();
     $openTickets = $tickets->filter(function ($ticket) {
         return !$ticket->trashed();
     });
     $cache->put('tickets.open', $openTickets->count(), $expiresAt);
     $cache->put('tickets.total', $tickets->count(), $expiresAt);
     $this->info('Calculation done and results are cached');
 }
コード例 #28
0
 public function testPhoneNumberValidation()
 {
     // Given
     $this->startSession();
     $invalidPhoneNumber = '5558180';
     // When
     $response = $this->call('POST', route('new-ticket'), ['name' => 'Customer name', 'phone_number' => $invalidPhoneNumber, 'description' => 'I lost my ability to even', '_token' => csrf_token()]);
     // Then
     $flashMessage = $this->app['session']->get('errors')->getBag('default')->get('phone_number');
     $this->assertEquals(['The phone number must be in E.164 format'], $flashMessage);
     $this->assertCount(0, Ticket::all());
 }
コード例 #29
0
ファイル: TicketsComposer.php プロジェクト: vik0803/nuticket
 public function compose($view)
 {
     $view->with('is_staff', true);
     // $view->with('is_staff', ($this->app['auth']->user()->staff ? true : false));
     $view->with('open_count', Ticket::getOpenCount());
     // $view->with('open_count', 45);
     $view->with('close_count', Ticket::getClosedCount());
     // $view->with('close_count', 30);
     $view->with('assigned_count', Ticket::getAssignedCount($this->app['auth']->user()->staff->id));
     // $view->with('assigned_count', 15);
     $view->with('priorities', ['1' => '1 - Business is stopped', '2' => '2 - User is stopped', '3' => '3 - Business is hendered', '4' => '4 - User is hendered', '5' => '5 - Increase productivity/savings']);
 }
コード例 #30
0
 /**
  * Store a Comment for a given Ticket id
  *
  * @param $id
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store($id, Request $request)
 {
     // validate the comment first
     $this->validate($request, ['comment' => 'required']);
     $ticket = Ticket::findOrFail($id);
     $comment = new Comment();
     $comment->comment = $request->get('comment');
     $comment->user()->associate(Auth::user());
     $comment->ticket()->associate($ticket);
     $comment->save();
     session()->flash('flash_message', 'Comment added successfully');
     return redirect()->route('show_ticket', [$ticket]);
 }