updated commit
This commit is contained in:
@@ -1,121 +1,102 @@
|
||||
<?php namespace App\Http\Controllers\Guest;
|
||||
|
||||
use App\Http\Requests;
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/* include help topic model */
|
||||
use App\Model\Manage\Help_topic;
|
||||
|
||||
use App\Model\Form\Form_details;
|
||||
/* Include form_name model */
|
||||
use App\Model\Form\Form_name;
|
||||
|
||||
/*include form_detals model*/
|
||||
use App\Model\Form\Form_details;
|
||||
|
||||
/* include form_detals model */
|
||||
/* Include form_value model */
|
||||
use App\Model\Form\Form_value;
|
||||
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\User;
|
||||
|
||||
use Form;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
/* Validate form TicketForm using */
|
||||
use Input;
|
||||
|
||||
use DB;
|
||||
|
||||
/* Validate form TicketForm using */
|
||||
use App\Http\Requests\TicketForm;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
/* constructor for authentication */
|
||||
|
||||
|
||||
|
||||
/* function for crate form */
|
||||
|
||||
|
||||
/* This Function to get the form for the ticket */
|
||||
|
||||
public function getForm(Form_name $name, Form_details $details, Help_topic $topics)
|
||||
{
|
||||
/**
|
||||
* 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(Form_name $name, Form_details $details, Help_topic $topics) {
|
||||
// name of the form where status==1
|
||||
$name = $name->where('status',1)->get();
|
||||
|
||||
$name = $name->where('status', 1)->get();
|
||||
//get label and the type from form_detail table where form_name_id of form_detail
|
||||
// equal to form_name table's id
|
||||
$ids = $name->where('id',2);
|
||||
foreach($ids as $i)
|
||||
{
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
}
|
||||
|
||||
|
||||
//get form_name_id from form_detail and save to detail_form_name_id
|
||||
$detail_form_name_id = $details->where('form_name_id',$id)->get();
|
||||
$detail_form_name_id = $details->where('form_name_id', $id)->get();
|
||||
$count = count($detail_form_name_id);
|
||||
// foreach($detail_form_name_id as $details)
|
||||
// {
|
||||
// echo $details->label;
|
||||
// }
|
||||
return view('themes.default1.client.guest-user.form',compact('name','detail_form_name_id','topics'));
|
||||
// echo $details->label;
|
||||
// }
|
||||
return view('themes.default1.client.guest-user.form', compact('name', 'detail_form_name_id', 'topics'));
|
||||
}
|
||||
|
||||
/* This Function to post the form for the ticket */
|
||||
|
||||
public function postForm(Form_name $name, Form_details $details)
|
||||
{
|
||||
|
||||
$name = $name->where('status',1)->get();
|
||||
$ids = $name->where('id',2);
|
||||
foreach($ids as $i)
|
||||
{
|
||||
/**
|
||||
* 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(Form_name $name, Form_details $details) {
|
||||
$name = $name->where('status', 1)->get();
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
//echo $id;
|
||||
}
|
||||
|
||||
$field=$details->where('form_name_id',$id)->get();
|
||||
|
||||
$var=" ";
|
||||
|
||||
foreach ($field as $key) {
|
||||
$type=$key->type;
|
||||
$label=$key->label;
|
||||
$var.=",".$type."-".$label;
|
||||
}
|
||||
return $var;
|
||||
|
||||
|
||||
// foreach($outs as $out)
|
||||
// {
|
||||
// return $out;
|
||||
// }
|
||||
|
||||
// $var=" ";
|
||||
|
||||
// foreach ($field as $key) {
|
||||
// $field=$key->field_name;
|
||||
// $id=$key->form_id;
|
||||
// $var.=",".$field;
|
||||
// }
|
||||
// return $var;
|
||||
// // $var=$field.$id;
|
||||
// // return
|
||||
// // return Response::json(array(
|
||||
// // 'field' => $field,
|
||||
// // 'id' => $id
|
||||
// // ));
|
||||
|
||||
$field = $details->where('form_name_id', $id)->get();
|
||||
$var = " ";
|
||||
foreach ($field as $key) {
|
||||
$type = $key->type;
|
||||
$label = $key->label;
|
||||
$var .= "," . $type . "-" . $label;
|
||||
}
|
||||
return $var;
|
||||
// foreach($outs as $out)
|
||||
// {
|
||||
// return $out;
|
||||
// }
|
||||
// $var=" ";
|
||||
// foreach ($field as $key) {
|
||||
// $field=$key->field_name;
|
||||
// $id=$key->form_id;
|
||||
// $var.=",".$field;
|
||||
// }
|
||||
// return $var;
|
||||
// // $var=$field.$id;
|
||||
// // return
|
||||
// // return Response::json(array(
|
||||
// // 'field' => $field,
|
||||
// // 'id' => $id
|
||||
// // ));
|
||||
}
|
||||
public function postedForm(Request $request, User $user)
|
||||
{
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(Request $request, User $user) {
|
||||
$user->name = $request->input('Name');
|
||||
$user->email = $request->input('Email');
|
||||
$user->save();
|
||||
$user->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,140 +1,149 @@
|
||||
<?php namespace App\Http\Controllers\Guest;
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CheckTicket;
|
||||
use App\Http\Requests\ProfilePassword;
|
||||
|
||||
/* include guest_note model */
|
||||
use App\Http\Requests\ProfileRequest;
|
||||
|
||||
/* include User Model */
|
||||
use App\Http\Requests\TicketRequest;
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\Model\Ticket\Tickets;
|
||||
/* include Help_topic Model */
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
|
||||
/* Profile validator */
|
||||
use App\User;
|
||||
|
||||
/* Profile Password validator */
|
||||
use Auth;
|
||||
|
||||
/* include ticket_thred model */
|
||||
use Hash;
|
||||
|
||||
/* include tickets model */
|
||||
|
||||
/* TicketRequest to validate the ticket response */
|
||||
use Input;
|
||||
|
||||
/* Validate post check ticket */
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
/* Define constructor for Authentication Checking */
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.client.guest-user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile($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 = 'dist/img';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'dist/img';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
|
||||
$destinationPath = '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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.guest-user.form', compact('topics'));
|
||||
}
|
||||
|
||||
/*Get my ticket*/
|
||||
/**
|
||||
* Get my ticket
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket(Tickets $tickets, Ticket_Thread $thread, User $user) {
|
||||
$id = Auth::user()->id;
|
||||
/* Get the user where id == $id */
|
||||
$user = $user->whereId($id)->first();
|
||||
|
||||
/* Get the all tickets which belongs to the current user */
|
||||
$tickets = $tickets->where('user_id', $user->id)->get();
|
||||
//dd($tickets);
|
||||
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
$ticket = $tickets->where('user_id', $user->id)->first();
|
||||
|
||||
/* get the thread of the selected ticket */
|
||||
$thread = $thread->where('ticket_id', $ticket->id)->first();
|
||||
|
||||
return view('themes.default1.agent.ticket.ticket', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/*Get ticket-thread*/
|
||||
/**
|
||||
* 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.agent.ticket.timeline', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/* ticket Edit */
|
||||
/**
|
||||
* ticket Edit
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($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();
|
||||
@@ -144,11 +153,13 @@ class GuestController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
//============================================
|
||||
// Ticket reply | Incomplete
|
||||
//============================================
|
||||
/**
|
||||
* 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;
|
||||
@@ -161,31 +172,39 @@ class GuestController extends Controller {
|
||||
// return 'success';
|
||||
return Redirect("thread/" . $ticket_id);
|
||||
}
|
||||
public function getCheckTicket(Tickets $ticket, User $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.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(CheckTicket $request, User $user, Tickets $ticket, Ticket_Thread $thread) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
$user = $user->where('email', $request->input('email'))->first();
|
||||
$tickets = $ticket->where('ticket_number', $request->input('ticket_number'))->first();
|
||||
|
||||
if ($user && $tickets) {
|
||||
//$user = $user->where('email',$request->input('email'))->first();
|
||||
$user_id = $user->id;
|
||||
|
||||
//$ticket = $ticket->where('user_id',$user_id)->first();
|
||||
//$ticket_number = $ticket->ticket_number;
|
||||
|
||||
$thread = $thread->where('user_id', $user_id)->first();
|
||||
return view('themes.default1.client.guest-user.checkticket', compact('user', 'tickets', 'thread'));
|
||||
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('checkticket')->with('fails', 'Enter valid Inputs');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Guest;
|
||||
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\Settings\System;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user