public static function getName($cid) { $record = ConsoleUser::findOrFail($cid); $name = $record->name; return $name; }
public function post_guestreopenticket() { //Get our data $ticketid = Input::get('ticketid'); $hash = Input::get('hash'); //Fetch our ticket $ticket = Ticket::where('id', '=', $ticketid)->where('hash', '=', $hash)->first(); if (!empty($ticket)) { //Reopen our ticket $ticket->status = 1; //Update our ticket $ticket->save(); //Hell, let's just pull new replies in case something was updated $status = '<span style="margin-right: 10px;" class="badge badge-success">OPEN</span>'; $response = '<div id="ticketreceived" data-tickethash="' . $ticket->hash . '" data-ticketid="' . $ticket->id . '" class="well"><div style="margin-top: 20px; margin-bottom: 40px;" class="row-fluid"><div style="border-bottom: 1px solid #e5e5e5;" class="span10 offset2"><h4>' . $status . ' ' . $ticket->subject . '</h4></div><div class="span2"><strong>' . $ticket->name . '</strong><br /><small>' . $ticket->created_at . '</small></div><div style="padding-top: 3px; padding-left: 3px; margin-left: 0px; border-left: 1px solid #e5e5e5;" class="span8">' . $ticket->description . '</div></div></div>'; //Get our replies $replies = $ticket->replies()->get(); foreach ($replies as $reply) { //Figure out if this is a staff reply if ($reply->staff == 0) { $author = '<strong>' . $ticket->name . '</strong>'; } else { //Alright. It is a staff reply. Let's fetch the name of the auditor $author = '<span class="label label-important"><i class="fa fa-bookmark fa-fw"></i>' . ConsoleUser::getName($reply->author) . '</span>'; } $response .= '<div style="margin-top: 15px; margin-bottom: 15px;"><hr style="border-bottom: 0;" /></div><div class="well"><div style="margin-top: 20px; margin-bottom: 40px;" class="row-fluid"><div class="span2">' . $author . '<br /><small>' . $reply->created_at . '</small></div><div style="padding-top: 3px; padding-left: 3px; margin-left: 0px; border-left: 1px solid #e5e5e5;" class="span8">' . $reply->content . '</div></div></div>'; } echo $response; } }
public function post_profilesave() { //Get our inputs $name = Input::get('inputName'); $email = Input::get('inputEmail'); $ticketnotifications = Input::get('inputTicketNotifications'); //Start the validator $validator = Validator::make(array('name' => $name, 'email' => $email, 'ticketnotifications' => $ticketnotifications), array('name' => 'required', 'email' => 'required|email', 'ticketnotifications' => 'required|in:0,1')); if ($validator->fails()) { return Redirect::route('consoleprofile')->withErrors($validator); } //Great validation passed. Now let's push these updates $auditor = ConsoleUser::findOrFail(Auth::consoleuser()->get()->cid); $auditor->name = $name; $auditor->email = $email; $auditor->ticketnotifications = $ticketnotifications; //Save $auditor->save(); //Redirect back with message return Redirect::route('consoleprofile')->with('message', 'Profile Updated Successfully.'); }