update v1.0.3.3
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientTicketController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
// $this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$threads->user_id = Auth::user()->id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->body = $comment;
|
||||
$threads->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
82
app/Http/Controllers/Client/helpdesk/EmailController.php
Normal file
82
app/Http/Controllers/Client/helpdesk/EmailController.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
|
||||
|
||||
/**
|
||||
* EmailController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
/**
|
||||
* post port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id','=','1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
|
||||
return $portvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post host
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host()
|
||||
{
|
||||
$host=Option::where('option_name','=','host')->first();
|
||||
$hostvalue=$host->option_value;
|
||||
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username()
|
||||
{
|
||||
$username=Option::where('option_name','=','username')->first();
|
||||
$uservalue=$username->option_value;
|
||||
|
||||
return $uservalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post passowrd
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password()
|
||||
{
|
||||
$password=Option::where('option_name','=','password')->first();
|
||||
$passvalue=$password->option_value;
|
||||
|
||||
return $passvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post encryption
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption=Option::where('option_name','=','encryption')->first();
|
||||
$encryptvalue=$encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
|
||||
}
|
198
app/Http/Controllers/Client/helpdesk/FormController.php
Normal file
198
app/Http/Controllers/Client/helpdesk/FormController.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
// models
|
||||
/* include help topic model */
|
||||
use App\Model\helpdesk\Form\Form_details;
|
||||
/* Include form_name model */
|
||||
use App\Model\helpdesk\Form\Form_name;
|
||||
/* include form_detals model */
|
||||
/* Include form_value model */
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
/* Validate form TicketForm using */
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\User;
|
||||
// classes
|
||||
use Form;
|
||||
use Input;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Redirect;
|
||||
use Config;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Form_value;
|
||||
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
public function __construct(TicketController $TicketController) {
|
||||
SettingsController::smtp();
|
||||
$this->TicketController = $TicketController;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * This Function to get the form for the ticket
|
||||
// * @param type Form_name $name
|
||||
// * @param type Form_details $details
|
||||
// * @param type Help_topic $topics
|
||||
// * @return type Response
|
||||
// */
|
||||
// public function getForm() {
|
||||
// if(Config::get('database.install') == '%0%') {
|
||||
// return Redirect::route('license');
|
||||
// }
|
||||
// if(System::first()->status == 1) {
|
||||
// return view('themes.default1.client.helpdesk.guest-user.form');
|
||||
// } else {
|
||||
// return "hello";
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* getform
|
||||
* @param type Help_topic $topic
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function to post the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id,Form_name $name, Form_details $details, Help_topic $topic) {
|
||||
// dd($id);
|
||||
if($id != 0 ){
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if(!$values) {
|
||||
} if($values) {
|
||||
foreach($values as $value){
|
||||
if($value->type == "select") {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach($value as $option){
|
||||
echo '<option>'.$option.'</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == "radio" ) {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
} elseif($value->type == "textarea" ) {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
if(array_key_exists(1, $v)){
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif($value->type == "checkbox" ) {
|
||||
$type4 = $value->value;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source) {
|
||||
|
||||
$form_extras = $request->except('Name','Phone','Email','Subject','Details','helptopic','_wysihtml5_mode','_token');
|
||||
|
||||
$name = $request->input('Name');
|
||||
$phone = $request->input('Phone');
|
||||
$email = $request->input('Email');
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
|
||||
$System = System::where('id','=',1)->first();
|
||||
$departments = Department::where('id','=',$System->department)->first();
|
||||
$department = $departments->id;
|
||||
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $ticket_settings->first()->help_topic;
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
$source = $ticket_source->where('name','=','web')->first();
|
||||
|
||||
$collaborator = null;
|
||||
|
||||
if($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department,$assignto = "", $form_extras)) {
|
||||
return Redirect::route('guest.getform')->with('success','Ticket Created Successfully');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$threads->user_id = $tickets->user_id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->body = $comment;
|
||||
$threads->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
278
app/Http/Controllers/Client/helpdesk/GuestController.php
Normal file
278
app/Http/Controllers/Client/helpdesk/GuestController.php
Normal file
@@ -0,0 +1,278 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
$user = User::where('id','=',Auth::user()->id)->first();
|
||||
$user->gender = $request->get('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.tickets.form', compact('topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* getform
|
||||
* @param type Help_topic $topic
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get my ticket
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket() {
|
||||
return view('themes.default1.client.helpdesk.mytickets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ticket-thread
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) {
|
||||
$user_id = Auth::user()->id;
|
||||
//dd($user_id);
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
$tickets = $tickets->where('user_id', '=', $user_id)->first();
|
||||
//dd($ticket);
|
||||
$thread = $thread->where('ticket_id', $tickets->id)->first();
|
||||
//dd($thread);
|
||||
// $tickets = $tickets->whereId($id)->first();
|
||||
return view('themes.default1.client.guest-user.view_ticket', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket Edit
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword(ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticekt reply
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->title = $request->input('To');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->poster = 'user';
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
return Redirect("thread/" . $ticket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Check ticket
|
||||
* @param type CheckTicket $request
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket() {
|
||||
|
||||
$Email = \Input::get('email');
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
$ticket = Tickets::where('ticket_number', '=', $Ticket_number)->first();
|
||||
if($ticket == null) {
|
||||
return \Redirect::route('form')->with('fails', 'There is no such Ticket Number');
|
||||
} else {
|
||||
$userId = $ticket->user_id;
|
||||
$user = User::where('id', '=', $userId)->first();
|
||||
|
||||
if($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name." ".$user->last_name;
|
||||
}
|
||||
|
||||
if($user->email != $Email) {
|
||||
return \Redirect::route('form')->with('fails', "Email didn't match with Ticket Number");
|
||||
} else {
|
||||
$code = $ticket->id;
|
||||
$code = \Crypt::encrypt($code);
|
||||
|
||||
$company = $this->company();
|
||||
|
||||
\Mail::send('emails.check_ticket',
|
||||
array('link'=>\URL::route('check_ticket',$code),'user'=>$username, 'from'=>$company),
|
||||
function($message) use($user, $username, $Ticket_number) {
|
||||
$message->to($user->email, $username)->subject('Ticket link Request ['.$Ticket_number.']');
|
||||
}
|
||||
);
|
||||
return \Redirect::back()
|
||||
->with('success','We have sent you a link by Email. Please click on that link to view ticket');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket email
|
||||
* @param type $id
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id) {
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
return view('themes.default1.client.helpdesk.ckeckticket',compact('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket status
|
||||
* @param type Tickets $ticket
|
||||
* @return type
|
||||
*/
|
||||
public function getTicketStat(Tickets $ticket) {
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get company
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
if($company->company_name == null){
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
// classes
|
||||
use Config;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomepageController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
$notes = $note->get();
|
||||
foreach ($notes as $note) {
|
||||
$content = $note->content;
|
||||
}
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
public function index() {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
}
|
297
app/Http/Controllers/Client/kb/UserController.php
Normal file
297
app/Http/Controllers/Client/kb/UserController.php
Normal file
@@ -0,0 +1,297 @@
|
||||
<?php namespace App\Http\Controllers\Client\kb;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\kb\CommentRequest;
|
||||
use App\Http\Requests\kb\ContactRequest;
|
||||
use App\Http\Requests\kb\SearchRequest;
|
||||
use App\Http\Requests\kb\ProfilePassword;
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Contact;
|
||||
use App\Model\kb\Faq;
|
||||
use App\Model\kb\Page;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use Config;
|
||||
// use Creativeorange\Gravatar\Gravatar;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Redirect;
|
||||
use Hash;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
//$this->middleware('auth');
|
||||
//SettingsController::language();
|
||||
// $this->port();
|
||||
// $this->host();
|
||||
// $this->password();
|
||||
// $this->encryption();
|
||||
// $this->email();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param
|
||||
* @return response
|
||||
* @package default
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
// $article = $article->where('status', '1');
|
||||
// $article = $article->where('type', '1');
|
||||
$article = $article->paginate($pagination);
|
||||
// dd($article);
|
||||
$article->setPath('article-list');
|
||||
$categorys = $category->get();
|
||||
// $time = $this->timezone($utc);
|
||||
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get excerpt from string
|
||||
*
|
||||
* @param String $str String to get an excerpt from
|
||||
* @param Integer $startPos Position int string to start excerpt from
|
||||
* @param Integer $maxLength Maximum length the excerpt may be
|
||||
* @return String excerpt
|
||||
*/
|
||||
static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
|
||||
if (strlen($str) > $maxLength) {
|
||||
$excerpt = substr($str, $startPos, $maxLength - 3);
|
||||
$lastSpace = strrpos($excerpt, ' ');
|
||||
$excerpt = substr($excerpt, 0, $lastSpace);
|
||||
$excerpt .= '...';
|
||||
} else {
|
||||
$excerpt = $str;
|
||||
}
|
||||
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
$search = $request->input('s');
|
||||
$result = $article->search($search)->paginate($pagination);
|
||||
$result->setPath('search');
|
||||
//dd($result);
|
||||
$categorys = $category->get();
|
||||
return view('themes.default1.client.kb.article-list.search', compact('categorys', 'result'));
|
||||
}
|
||||
|
||||
/**
|
||||
* to show the seleted article
|
||||
* @return response
|
||||
*/
|
||||
public function show($slug, Article $article, Category $category) {
|
||||
//ArticleController::timezone();
|
||||
$arti = $article->where('slug', $slug)->where('status','1')->where('type','1')->first();
|
||||
|
||||
// dd($arti);
|
||||
//$categorys = $category->get();
|
||||
//$avatar->get('vijaycodename47@gmail.com');
|
||||
return view('themes.default1.client.kb.article-list.show', compact('arti'));
|
||||
}
|
||||
|
||||
public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
|
||||
/* get the article_id where category_id == current category */
|
||||
$catid = $category->where('slug', $slug)->first();
|
||||
$id = $catid->id;
|
||||
$all = $relation->where('category_id', $id)->get();
|
||||
// $all->setPath('');
|
||||
/* from whole attribute pick the article_id */
|
||||
$article_id = $all->lists('article_id');
|
||||
$categorys = $category->get();
|
||||
/* direct to view with $article_id */
|
||||
return view('themes.default1.client.kb.article-list.category', compact('all','id', 'categorys', 'article_id'));
|
||||
}
|
||||
|
||||
public function home(Article $article, Category $category, Relationship $relation) {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return redirect('step1');
|
||||
}
|
||||
else
|
||||
{
|
||||
//$categorys = $category->get();
|
||||
$categorys = $category->get();
|
||||
// $categorys->setPath('home');
|
||||
/* direct to view with $article_id */
|
||||
return view('themes.default1.client.kb.article-list.home', compact('categorys', 'article_id'));
|
||||
}
|
||||
}
|
||||
|
||||
public function Faq(Faq $faq, Category $category) {
|
||||
$faq = $faq->where('id', '1')->first();
|
||||
$categorys = $category->get();
|
||||
return view('themes.default1.client.kb.article-list.faq', compact('categorys', 'faq'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get the contact page for user
|
||||
* @return response
|
||||
*/
|
||||
public function contact(Category $category, Settings $settings) {
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$categorys = $category->get();
|
||||
return view('themes.default1.client.kb.article-list.contact', compact('settings', 'categorys'));
|
||||
}
|
||||
|
||||
/**
|
||||
* send message to the mail adderess that define in the system
|
||||
* @return response
|
||||
*/
|
||||
public function postContact(ContactRequest $request, Contact $contact) {
|
||||
$this->port();
|
||||
$this->host();
|
||||
$this->encryption();
|
||||
$this->email();
|
||||
$this->password();
|
||||
//return Config::get('mail');
|
||||
$contact->fill($request->input())->save();
|
||||
$name = $request->input('name');
|
||||
//echo $name;
|
||||
$email = $request->input('email');
|
||||
//echo $email;
|
||||
$subject = $request->input('subject');
|
||||
//echo $subject;
|
||||
$details = $request->input('message');
|
||||
//echo $message;
|
||||
//echo $contact->email;
|
||||
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', array('name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details), function ($message) use ($contact) {
|
||||
$message->to($contact->email, $contact->name)->subject('Contact');
|
||||
});
|
||||
if ($mail) {
|
||||
return redirect('contact')->with('success', 'Your details send to System');
|
||||
} else {
|
||||
return redirect('contact')->with('fails', 'Your details can not send to System');
|
||||
}
|
||||
}
|
||||
|
||||
public function contactDetails() {
|
||||
return view('themes.default1.client.kb.article-list.contact-details');
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert the values to the comment table
|
||||
* @param type Article $article
|
||||
* @param type Request $request
|
||||
* @param type Comment $comment
|
||||
* @param type Id $id
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
|
||||
$article = $article->where('slug',$slug)->first();
|
||||
$id = $article->id;
|
||||
$comment->article_id = $id;
|
||||
if ($comment->fill($request->input())->save()) {
|
||||
return Redirect::back()->with('success', 'Your comment posted');
|
||||
} else {
|
||||
return Redirect::back()->with('fails', 'Sorry not processed');
|
||||
}
|
||||
}
|
||||
|
||||
public function getPage($name, Page $page) {
|
||||
$page = $page->where('slug', $name)->first();
|
||||
//$this->timezone($page->created_at);
|
||||
return view('themes.default1.client.kb.article-list.pages', compact('page'));
|
||||
}
|
||||
static function port() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
static function host() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
static function encryption() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
static function email() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
|
||||
//dd(Config::get('mail'));
|
||||
}
|
||||
static function password() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
|
||||
}
|
||||
|
||||
public function getCategoryList(Article $article, Category $category, Relationship $relation) {
|
||||
//$categorys = $category->get();
|
||||
$categorys = $category->get();
|
||||
// $categorys->setPath('home');
|
||||
/* direct to view with $article_id */
|
||||
return view('themes.default1.client.kb.article-list.categoryList', compact('categorys', 'article_id'));
|
||||
|
||||
}
|
||||
|
||||
// static function timezone($utc) {
|
||||
// $set = Settings::whereId('1')->first();
|
||||
// $tz = $set->timezone;
|
||||
// $format = $set->dateformat;
|
||||
// //$utc = date('M d Y h:i:s A');
|
||||
// //echo 'UTC : ' . $utc;
|
||||
// date_default_timezone_set($tz);
|
||||
|
||||
// $offset = date('Z', strtotime($utc));
|
||||
// //print "offset: $offset \n";
|
||||
// $date = date($format, strtotime($utc) + $offset);
|
||||
// return $date;
|
||||
// //return substr($date, 0, -6);
|
||||
// }
|
||||
|
||||
public function clientProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.client.kb.article-list.profile', compact('user'));
|
||||
}
|
||||
|
||||
public function postClientProfile($id, ProfileRequest $request) {
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
}
|
||||
|
||||
public function postClientProfilePassword($id, ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect()->back()->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect()->back()->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user