Esempio n. 1
0
 public function putCreate(TicketFormRequest $request)
 {
     $ticket = new \App\Ticket();
     $ticket->put($request->all());
     $newClient = trim($request->client_new);
     if (!empty($newClient)) {
         $client = new \App\Client();
         $client->put(['name' => $newClient]);
         $ticket->patch(['client_id' => $client->id]);
     }
     \Flash::success('Ticket saved.');
     return redirect('tickets');
 }
Esempio n. 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = \Faker\Factory::create();
     //User
     $userEmail = '*****@*****.**';
     $user = \App\User::where('email', $userEmail)->first();
     if (!$user) {
         $user = new \App\User();
         $user->email = $userEmail;
         $user->save();
     }
     //Clients
     $clients = [];
     $client_ids = [];
     for ($i = 0; $i < 10; $i++) {
         $client = new \App\Client();
         $client->name = $faker->company;
         $client->save();
         $client_ids[] = $client->id;
     }
     //Tickets
     for ($i = 0; $i < 50; $i++) {
         $ticket = new \App\Ticket();
         $ticket->user_id = $user->id;
         $ticket->client_id = $client_ids[array_rand($client_ids)];
         $ticket->status_id = \App\Status::orderByRaw('RAND()')->first()->id;
         $ticket->priority = rand(1, 10);
         $ticket->title = $faker->sentence;
         $ticket->description = $faker->paragraph;
         $ticket->save();
     }
     $statuses = [['name' => 'New', 'weight' => '0'], ['name' => 'Pending', 'weight' => '10'], ['name' => 'Resolved', 'weight' => '20', 'billable' => true], ['name' => 'Archived', 'weight' => '30', 'billable' => true, 'archivable' => true]];
     foreach ($statuses as $statusData) {
         $status = \App\Status::where('name', $statusData['name'])->first();
         if (!$status) {
             $status = new \App\Status();
             $status->put($statusData);
         }
     }
 }
Esempio n. 3
0
<?php

Route::bind('slug', function ($slug) {
    return App\Ticket::whereSlug($slug)->firstOrFail();
});
get('/', 'PagesController@home');
get('home', 'PagesController@home');
//INSERTING STATUS & NOTES
post('HomePageContent', 'PagesController@store');
//PROJECT BRIEF/DESCRIPTION
get('HomePageProjectDescription', 'PagesController@project_description');
//UPDATING USER ROLE
get('updateUserRole/{id?}', 'PagesController@updateUserRole');
//NEW APPLICATION
post('applications', 'PagesController@newApplication');
//SHOW PENDING TICKETS
get('tickets', 'TicketsController@index');
//resource('tickets', 'TicketsController');
//SHOW ONLY COMPLETED TICKETS
get('tickets/tickets-completed', 'TicketsController@completedTickets');
//TICKETS WITH COMMENTS
get('tickets/tickets-with-comments', 'TicketsController@ticketsWithComments');
//SHOW ONLY MY OPEN TICKETS
get('tickets/my-open-tickets/{name}', 'TicketsController@myOpenTickets');
//SHOW ONLY MY CLOSED TICKETS
get('tickets/my-closed-tickets/{name}', 'TicketsController@myClosedTickets');
//SHOW ONLY TICKETS BY BUSINESS UNITS
get('tickets/tickets-by-business-units', 'TicketsController@ticketsByBusinessUnits');
//SHOW ONLY TICKETS BY SUBMITTER
get('tickets/tickets-by-submitter', 'TicketsController@ticketsBySubmitter');
post('tickets', 'TicketsController@store');
Esempio n. 4
0
 private function generateTickets(\App\Order $order, $payuResponse)
 {
     $order->data = json_encode($payuResponse);
     $order->status = 'success';
     $order->save();
     $carts = $this->user()->carts()->get();
     foreach ($carts as $cart) {
         $ticket = new \App\Ticket();
         $ticket->order_id = $order->id;
         $ticket->event_id = $cart->price->event->id;
         $ticket->price = $cart->price->value;
         $ticket->description = $cart->price->description;
         $ticket->quantity = $cart->quantity;
         $ticket->unique = '871fd7278c6b07b7a9777c42ab3a1a55' . md5($order->id) . md5($cart->price->event->id) . md5($cart->price->id);
         $ticket->save();
         \QrCode::format('png')->size(250)->generate($ticket->unique, public_path('qrcodes/' . $ticket->unique . '.png'));
     }
     $this->user()->carts()->delete();
     return true;
 }