Beispiel #1
0
 /**
  * Update tickets from built plan
  *
  * @param $planId
  * @param $ticketsData
  * @return bool
  */
 public function updateBuiltTickets($planId, $ticketsData)
 {
     $redirect = false;
     $errorMsg = '';
     // Start transaction
     DB::beginTransaction();
     // Start tickets update
     try {
         $ticket = $this->model->where('plan_id', '=', $planId);
         $ticket->update(['tickets' => serialize($ticketsData)]);
     } catch (\Exception $e) {
         $errorMsg = $e->getMessage();
         $redirect = true;
     } catch (QueryException $e) {
         $errorMsg = $e->getErrors();
         $redirect = true;
     } catch (ModelNotFoundException $e) {
         $errorMsg = $e->getErrors();
         $redirect = true;
     }
     // Redirect if errors
     if ($redirect) {
         // Rollback
         DB::rollback();
         // Log to system
         Tools::log($errorMsg, $ticketsData);
         return false;
     }
     // Commit all changes
     DB::commit();
     return true;
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $ticket = Tickets::where('tk_id', $id)->first();
     return View('ticket.show', compact('ticket'));
 }