Merge remote-tracking branch 'origin/master'
# Conflicts: # app/Http/Controllers/Api/v1/ApiController.php # app/Http/Controllers/Api/v1/TestController.php
This commit is contained in:
8
.env
8
.env
@@ -1,9 +1,9 @@
|
||||
APP_ENV=local
|
||||
APP_DEBUG=false
|
||||
APP_KEY=SomeRandomString
|
||||
DB_HOST=
|
||||
DB_DATABASE=
|
||||
DB_USERNAME=
|
||||
DB_HOST=localhost
|
||||
DB_DATABASE=faveocombine
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
@@ -13,5 +13,5 @@ MAIL_HOST=mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
DB_TYPE=
|
||||
DB_TYPE=mysql
|
||||
DB_PORT=
|
||||
|
2077
DB/demodatabase.sql
2077
DB/demodatabase.sql
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<h3>About Faveo</h3>
|
||||
<br><img src="https://travis-ci.org/ladybirdweb/faveo-helpdesk.svg?branch=master"> <img src="https://img.shields.io/badge/License-OSL-blue.svg"> <a href="https://gitter.im/ladybirdweb/faveo-helpdesk" target="_blank"><img src="https://badges.gitter.im/ladybirdweb/faveo-helpdesk.svg"></a></br>
|
||||
<h3>About Faveo</h3>
|
||||
<br><img src="https://travis-ci.org/ladybirdweb/faveo-helpdesk.svg?branch=master"> <img src="https://img.shields.io/badge/License-OSL-blue.svg"> <a href="https://gitter.im/ladybirdweb/faveo-helpdesk" target="_blank"><img src="https://badges.gitter.im/ladybirdweb/faveo-helpdesk.svg"></a><a href="https://styleci.io/repos/34716238"> <img src="https://styleci.io/repos/34716238/shield" alt="StyleCI"></a></br>
|
||||
<p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
|
||||
<br/><br/>
|
||||
The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions.
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<?php namespace App\Commands;
|
||||
<?php
|
||||
|
||||
abstract class Command {
|
||||
|
||||
//
|
||||
namespace App\Commands;
|
||||
|
||||
abstract class Command
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -1,32 +1,33 @@
|
||||
<?php namespace App\Console\Commands;
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
class Inspire extends Command {
|
||||
class Inspire extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'inspire';
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'inspire';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,38 @@
|
||||
<?php namespace App\Console;
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel {
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'App\Console\Commands\Inspire',
|
||||
];
|
||||
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'App\Console\Commands\Inspire',
|
||||
];
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('inspire')
|
||||
->hourly();
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('inspire')
|
||||
->hourly();
|
||||
|
||||
$schedule->call(function () {
|
||||
|
||||
$user = new User;
|
||||
$user->save();
|
||||
|
||||
})->everyFiveMinutes();
|
||||
$schedule->call(function () {
|
||||
|
||||
}
|
||||
$user = new User();
|
||||
$user->save();
|
||||
|
||||
})->everyFiveMinutes();
|
||||
}
|
||||
}
|
||||
|
@@ -1,27 +1,25 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ClientTicketForm extends Event {
|
||||
class ClientTicketForm extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
|
||||
}
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,28 +1,25 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ClientTicketFormPost extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
|
||||
}
|
||||
class ClientTicketFormPost extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
abstract class Event {
|
||||
|
||||
//
|
||||
namespace App\Events;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -1,31 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class FaveoAfterReply extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
class FaveoAfterReply extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,31 +1,30 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class FormRegisterEvent extends Event {
|
||||
class FormRegisterEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,31 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class LoginEvent extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
class LoginEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PostRegisterEvent extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
class PostRegisterEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,31 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ReadMailEvent extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
class ReadMailEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TicketBoxHeader extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
class TicketBoxHeader extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TicketDetailTable extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
class TicketDetailTable extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,29 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TimeLineFormEvent extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
class TimeLineFormEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,31 +1,30 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Timeline extends Event {
|
||||
class Timeline extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
public $para1;
|
||||
public $para2;
|
||||
public $para3;
|
||||
public $para4;
|
||||
public $para5;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
|
||||
{
|
||||
$this->para1 = $para1;
|
||||
$this->para2 = $para2;
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
}
|
||||
|
@@ -1,21 +1,20 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TopNavEvent extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
class TopNavEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@@ -8,19 +8,20 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
// use App\Http\Controllers\Common\SettingsController;
|
||||
//use App\Model\helpdesk\Email\Smtp;
|
||||
|
||||
class Handler extends ExceptionHandler {
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException'
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
// public function __construct() {
|
||||
@@ -32,26 +33,29 @@ class Handler extends ExceptionHandler {
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e) {
|
||||
public function report(Exception $e)
|
||||
{
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e) {
|
||||
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
|
||||
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
|
||||
//dd($e);
|
||||
} else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
|
||||
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
|
||||
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
|
||||
}
|
||||
|
||||
@@ -81,13 +85,13 @@ class Handler extends ExceptionHandler {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
protected function renderExceptionWithWhoops(Exception $e) {
|
||||
$whoops = new \Whoops\Run;
|
||||
protected function renderExceptionWithWhoops(Exception $e)
|
||||
{
|
||||
$whoops = new \Whoops\Run();
|
||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
|
||||
|
||||
return new \Illuminate\Http\Response(
|
||||
$whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,47 +3,47 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* AgentController
|
||||
* This controller is used to CRUD category
|
||||
* This controller is used to CRUD category.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentController extends Controller {
|
||||
|
||||
class AgentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
@@ -53,11 +53,14 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all agent list page
|
||||
* Get all agent list page.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.index');
|
||||
} catch (Exception $e) {
|
||||
@@ -66,21 +69,25 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* creating a new agent
|
||||
* creating a new agent.
|
||||
*
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team)
|
||||
{
|
||||
try {
|
||||
$team = $team->get();
|
||||
$timezones = $timezone->get();
|
||||
$groups = $group->get();
|
||||
$departments = $department->get();
|
||||
$teams = $team->lists('id', 'name');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -88,13 +95,16 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* store a new agent
|
||||
* @param type User $user
|
||||
* @param type AgentRequest $request
|
||||
* store a new agent.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type AgentRequest $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
|
||||
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent)
|
||||
{
|
||||
|
||||
// dd($this->system_mail());
|
||||
|
||||
@@ -120,6 +130,7 @@ class AgentController extends Controller {
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again');
|
||||
}
|
||||
|
||||
return redirect('agents')->with('success', 'Agent Created sucessfully');
|
||||
} else {
|
||||
return redirect('agents')->with('fails', 'Agent can not Create');
|
||||
@@ -127,17 +138,20 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Editing a selected agent
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* Editing a selected agent.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team)
|
||||
{
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$team = $team->get();
|
||||
@@ -148,6 +162,7 @@ class AgentController extends Controller {
|
||||
$table = $team_assign_agent->where('agent_id', $id)->first();
|
||||
$teams = $team->lists('id', 'name');
|
||||
$assign = $team_assign_agent->where('agent_id', $id)->lists('team_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fail', 'No such file');
|
||||
@@ -156,13 +171,16 @@ class AgentController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified agent in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type AgentUpdate $request
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type AgentUpdate $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
|
||||
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent)
|
||||
{
|
||||
|
||||
// storing all the details
|
||||
$user = $user->whereId($id)->first();
|
||||
@@ -181,20 +199,24 @@ class AgentController extends Controller {
|
||||
//Todo For success and failure conditions
|
||||
try {
|
||||
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
|
||||
|
||||
return redirect('agents')->with('success', 'Agent Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent did not update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified agent from storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent)
|
||||
{
|
||||
/* Becouse of foreign key we delete team_assign_agent first */
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
||||
@@ -205,43 +227,52 @@ class AgentController extends Controller {
|
||||
$user->id;
|
||||
$user->delete();
|
||||
throw new \Exception($error);
|
||||
|
||||
return redirect('agents')->with('success', 'Agent Deleted sucessfully');
|
||||
} catch (\Exception $e) {
|
||||
dd($e->errorInfo);
|
||||
|
||||
return redirect('agents')->with('fails', $error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* Generate a random string for password.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
public function generateRandomString($length = 10)
|
||||
{
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching comapny name to send mail
|
||||
* Fetching comapny name to send mail.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* System default email
|
||||
*/
|
||||
// public function system_mail() {
|
||||
|
@@ -8,29 +8,30 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\helpdesk\BanlistRequest;
|
||||
use App\Http\Requests\helpdesk\BanRequest;
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\User;
|
||||
//classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* BanlistController
|
||||
* In this controller in the CRUD function for all the banned emails
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* In this controller in the CRUD function for all the banned emails.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistController extends Controller {
|
||||
|
||||
class BanlistController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking admin roles
|
||||
@@ -39,12 +40,16 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Banlist $ban
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$bans = User::where('ban', '=', 1)->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -53,9 +58,11 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -65,12 +72,15 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type banlist $ban
|
||||
*
|
||||
* @param type banlist $ban
|
||||
* @param type BanRequest $request
|
||||
* @param type User $user
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(BanRequest $request, User $user) {
|
||||
public function store(BanRequest $request, User $user)
|
||||
{
|
||||
// dd($request);
|
||||
try {
|
||||
//adding field to user whether it is banned or not
|
||||
@@ -83,11 +93,12 @@ class BanlistController extends Controller {
|
||||
// $user->create($request->input())->save();
|
||||
return redirect('banlist')->with('success', 'Email Banned sucessfully');
|
||||
} else {
|
||||
$user = new User;
|
||||
$user = new User();
|
||||
$user->email = $adban;
|
||||
$user->ban = $request->input('ban');
|
||||
$user->internal_note = $request->input('internal_note');
|
||||
$user->save();
|
||||
|
||||
return redirect('banlist')->with('success', 'Email Banned sucessfully');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -98,22 +109,28 @@ class BanlistController extends Controller {
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $ban) {
|
||||
public function edit($id, User $ban)
|
||||
{
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -122,12 +139,15 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @param type BanlistRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $ban, BanlistRequest $request) {
|
||||
public function update($id, User $ban, BanlistRequest $request)
|
||||
{
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
$bans->internal_note = $request->input('internal_note');
|
||||
@@ -143,7 +163,7 @@ class BanlistController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
|
@@ -9,46 +9,50 @@ use App\Http\Requests\helpdesk\DepartmentRequest;
|
||||
use App\Http\Requests\helpdesk\DepartmentUpdate;
|
||||
// model
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* DepartmentController
|
||||
* DepartmentController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentController extends Controller {
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index page
|
||||
* Get index page.
|
||||
*
|
||||
* @param type Department $department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Department $department) {
|
||||
public function index(Department $department)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -57,16 +61,19 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Template $template
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Template $template
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) {
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group)
|
||||
{
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
@@ -74,6 +81,7 @@ class DepartmentController extends Controller {
|
||||
$templates = $template->get();
|
||||
$department = $department->get();
|
||||
$groups = $group->lists('id', 'name');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -82,11 +90,14 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Department $department
|
||||
*
|
||||
* @param type Department $department
|
||||
* @param type DepartmentRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
public function store(Department $department, DepartmentRequest $request)
|
||||
{
|
||||
try {
|
||||
$department->fill($request->except('group_id', 'manager'))->save();
|
||||
$requests = $request->input('group_id');
|
||||
@@ -113,18 +124,21 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Template $template
|
||||
* @param type Teams $team
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @param type Template $template
|
||||
* @param type Teams $team
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) {
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group)
|
||||
{
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
@@ -133,6 +147,7 @@ class DepartmentController extends Controller {
|
||||
$departments = $department->whereId($id)->first();
|
||||
$groups = $group->lists('id', 'name');
|
||||
$assign = $group_assign_department->where('department_id', $id)->lists('group_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -141,13 +156,16 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type DepartmentUpdate $request
|
||||
* @param type Department $department
|
||||
* @param type DepartmentUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request)
|
||||
{
|
||||
// dd($id);
|
||||
try {
|
||||
$table = $group_assign_department->where('department_id', $id);
|
||||
@@ -177,12 +195,15 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets)
|
||||
{
|
||||
// try {
|
||||
$system = $system->where('id', '=', '1')->first();
|
||||
if ($system->department == $id) {
|
||||
@@ -191,54 +212,53 @@ class DepartmentController extends Controller {
|
||||
$tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]);
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default department</li>';
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default department</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
$users = DB::table('users')->where('primary_dpt', '=', $id)->update(['primary_dpt' => $system->department]);
|
||||
if ($users > 0) {
|
||||
if ($users > 1) {
|
||||
$text_user = "Users";
|
||||
$text_user = 'Users';
|
||||
} else {
|
||||
$text_user = "User";
|
||||
$text_user = 'User';
|
||||
}
|
||||
$user = '<li>' . $users . ' ' . $text_user . ' have been moved to default department</li>';
|
||||
$user = '<li>'.$users.' '.$text_user.' have been moved to default department</li>';
|
||||
} else {
|
||||
$user = "";
|
||||
$user = '';
|
||||
}
|
||||
$emails = DB::table('emails')->where('department', '=', $id)->update(['department' => $system->department]);
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
$text_emails = 'Emails';
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default department</li>';
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default department</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
$email = '';
|
||||
}
|
||||
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
|
||||
if ($helptopic > 0) {
|
||||
$helptopic = '<li>The associated helptopic has been deactivated</li>';
|
||||
} else {
|
||||
$helptopic = "";
|
||||
$helptopic = '';
|
||||
}
|
||||
$message = $ticket . $user . $email . $helptopic;
|
||||
$message = $ticket.$user.$email.$helptopic;
|
||||
/* Becouse of foreign key we delete group_assign_department first */
|
||||
$group_assign_department = $group_assign_department->where('department_id', $id);
|
||||
$group_assign_department->delete();
|
||||
$departments = $department->whereId($id)->first();
|
||||
/* Check the function is Success or Fail */
|
||||
if ($departments->delete() == true) {
|
||||
return redirect('departments')->with('success', 'Department Deleted sucessfully' . $message);
|
||||
return redirect('departments')->with('success', 'Department Deleted sucessfully'.$message);
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,39 +11,43 @@ use App\Http\Requests\helpdesk\EmailsRequest;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
// classes
|
||||
use Crypt;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* EmailsController
|
||||
* EmailsController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsController extends Controller {
|
||||
|
||||
class EmailsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Emails $emails
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Emails $emails) {
|
||||
public function index(Emails $emails)
|
||||
{
|
||||
try {
|
||||
$emails = $emails->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -52,18 +56,22 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -72,11 +80,14 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @param type Emails $email
|
||||
* @param type EmailsRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Emails $email, EmailsRequest $request) {
|
||||
public function store(Emails $email, EmailsRequest $request)
|
||||
{
|
||||
try {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
@@ -115,30 +126,36 @@ class EmailsController extends Controller {
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Emails $email
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Emails $email
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -147,12 +164,15 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Emails $email
|
||||
* @param type EmailsEditRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Emails $email, EmailsEditRequest $request) {
|
||||
public function update($id, Emails $email, EmailsEditRequest $request)
|
||||
{
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
//echo $encrypted;
|
||||
@@ -179,6 +199,7 @@ class EmailsController extends Controller {
|
||||
}
|
||||
$emails->password = $encrypted;
|
||||
$emails->save();
|
||||
|
||||
return redirect('emails')->with('success', 'Email Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email not updated');
|
||||
@@ -187,11 +208,14 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Emails $email) {
|
||||
public function destroy($id, Emails $email)
|
||||
{
|
||||
$default_system_email = Email::where('id', '=', '1')->first();
|
||||
if ($default_system_email->id) {
|
||||
if ($id == $default_system_email->id) {
|
||||
@@ -209,5 +233,4 @@ class EmailsController extends Controller {
|
||||
return redirect('emails')->with('fails', 'Email can not Delete ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,58 +13,66 @@ use Illuminate\Http\Request;
|
||||
// Class
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
* This controller is used to CRUD Custom Forms
|
||||
* This controller is used to CRUD Custom Forms.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
private $fields;
|
||||
private $forms;
|
||||
|
||||
public function __construct(Fields $fields, Forms $forms) {
|
||||
public function __construct(Fields $fields, Forms $forms)
|
||||
{
|
||||
$this->fields = $fields;
|
||||
$this->forms = $forms;
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* home
|
||||
* home.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function home() {
|
||||
public function home()
|
||||
{
|
||||
return view('forms.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* list of forms
|
||||
* @param type Forms $forms
|
||||
* list of forms.
|
||||
*
|
||||
* @param type Forms $forms
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Forms $forms) {
|
||||
public function index(Forms $forms)
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param int $id
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id'));
|
||||
}
|
||||
|
||||
@@ -73,13 +81,14 @@ class FormController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Forms $forms) {
|
||||
public function store(Forms $forms)
|
||||
{
|
||||
if (!Input::get('formname')) {
|
||||
return Redirect::back()->with('fails', 'Please fill Form name');
|
||||
}
|
||||
$required = Input::get('required');
|
||||
$count = count($required);
|
||||
$require = array();
|
||||
$require = [];
|
||||
for ($i = 2; $i < $count + 2; $i++) {
|
||||
for ($j = 0; $j < 1; $j++) {
|
||||
array_push($require, $required[$i][$j]);
|
||||
@@ -88,24 +97,26 @@ class FormController extends Controller {
|
||||
$forms->formname = Input::get('formname');
|
||||
$forms->save();
|
||||
$count = count(Input::get('name'));
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
for ($i = 0; $i <= $count; $i++) {
|
||||
if (!empty(Input::get('name')[$i])) {
|
||||
array_push($fields, array(
|
||||
array_push($fields, [
|
||||
'forms_id' => $forms->id,
|
||||
'label' => Input::get('label')[$i],
|
||||
'name' => Input::get('name')[$i],
|
||||
'type' => Input::get('type')[$i],
|
||||
'value' => Input::get('value')[$i],
|
||||
'label' => Input::get('label')[$i],
|
||||
'name' => Input::get('name')[$i],
|
||||
'type' => Input::get('type')[$i],
|
||||
'value' => Input::get('value')[$i],
|
||||
'required' => $require[$i],
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
Fields::insert($fields);
|
||||
|
||||
return Redirect::back()->with('success', 'Successfully created Form');
|
||||
}
|
||||
|
||||
public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic) {
|
||||
public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic)
|
||||
{
|
||||
$fields = $field->where('forms_id', $id)->get();
|
||||
$help_topics = $help_topic->where('custom_form', '=', $id)->get();
|
||||
foreach ($help_topics as $help_topic) {
|
||||
@@ -117,7 +128,7 @@ class FormController extends Controller {
|
||||
}
|
||||
$forms = $forms->where('id', $id)->first();
|
||||
$forms->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,45 +6,49 @@ namespace App\Http\Controllers\Admin\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\GroupRequest;
|
||||
use Illuminate\Http\Request;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\User;
|
||||
// classes
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Exception;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
/**
|
||||
* GroupController
|
||||
* GroupController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupController extends Controller {
|
||||
|
||||
class GroupController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
*
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department)
|
||||
{
|
||||
try {
|
||||
$groups = $group->get();
|
||||
$departments = $department->lists('id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -53,9 +57,11 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -65,44 +71,55 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @param type Groups $group
|
||||
* @param type GroupRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Groups $group, GroupRequest $request) {
|
||||
public function store(Groups $group, GroupRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Check Whether function success or not */
|
||||
$group->fill($request->input())->save();
|
||||
|
||||
return redirect('groups')->with('success', 'Group Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Groups $group) {
|
||||
public function edit($id, Groups $group)
|
||||
{
|
||||
try {
|
||||
$groups = $group->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Groups $group, Request $request) {
|
||||
public function update($id, Groups $group, Request $request)
|
||||
{
|
||||
$var = $group->whereId($id)->first();
|
||||
//Updating Status
|
||||
$status = $request->Input('group_status');
|
||||
@@ -153,22 +170,26 @@ class GroupController extends Controller {
|
||||
return redirect('groups')->with('success', 'Group Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department)
|
||||
{
|
||||
$users = User::where('assign_group', '=', $id)->first();
|
||||
if ($users) {
|
||||
$user = '<li>There are agents assigned to this group. Please unassign them from this group to delete</li>';
|
||||
return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
|
||||
|
||||
return redirect('groups')->with('fails', 'Group cannot Delete '.$user);
|
||||
}
|
||||
$group_assign_department->where('group_id', $id)->delete();
|
||||
$groups = $group->whereId($id)->first();
|
||||
@@ -179,8 +200,7 @@ class GroupController extends Controller {
|
||||
return redirect('groups')->with('success', 'Group Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups cannot Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('groups')->with('fails', 'Groups cannot Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,39 +13,43 @@ use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* HelptopicController
|
||||
* HelptopicController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicController extends Controller {
|
||||
|
||||
class HelptopicController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type vodi
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Help_topic $topic) {
|
||||
public function index(Help_topic $topic)
|
||||
{
|
||||
try {
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -54,12 +58,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
/*
|
||||
@@ -72,7 +78,8 @@ class HelptopicController extends Controller {
|
||||
| 5.Forms Model
|
||||
================================================
|
||||
*/
|
||||
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla) {
|
||||
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$topics = $topic->get();
|
||||
@@ -80,6 +87,7 @@ class HelptopicController extends Controller {
|
||||
$agents = $agent->where('role', '=', 'agent')->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -88,11 +96,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
public function store(Help_topic $topic, HelptopicRequest $request)
|
||||
{
|
||||
try {
|
||||
if ($request->custom_form) {
|
||||
$custom_form = $request->custom_form;
|
||||
@@ -111,22 +122,25 @@ class HelptopicController extends Controller {
|
||||
return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) {
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
$agents = User::where('role', '=', 'agent')->get();
|
||||
$departments = $department->get();
|
||||
@@ -134,20 +148,24 @@ class HelptopicController extends Controller {
|
||||
$forms = $form->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('helptopic')->with('fails', '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request)
|
||||
{
|
||||
// dd($request);
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
@@ -170,61 +188,62 @@ class HelptopicController extends Controller {
|
||||
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting) {
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting)
|
||||
{
|
||||
$ticket_settings = $ticket_setting->where('id', '=', '1')->first();
|
||||
if ($ticket_settings->help_topic == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
} else {
|
||||
|
||||
$tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default Help Topic</li>';
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
|
||||
$emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
$text_emails = 'Emails';
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default Help Topic</li>';
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
$email = '';
|
||||
}
|
||||
|
||||
$message = $ticket . $email;
|
||||
$message = $ticket.$email;
|
||||
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
try {
|
||||
$topics->delete();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully' . $message);
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,17 +10,17 @@ namespace App\Http\Controllers\Admin\helpdesk;
|
||||
* are authenticated. Of course, you are free to change or remove the
|
||||
* controller as you wish. It is just here to get your app started!
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HomeController extends Controller {
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,55 +3,55 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App;
|
||||
// requests
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
//supports
|
||||
use App\Http\Requests;
|
||||
use Cache;
|
||||
use Config;
|
||||
//classes
|
||||
use File;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Collection;
|
||||
//classes
|
||||
use Input;
|
||||
use Config;
|
||||
use Validator;
|
||||
use Zipper;
|
||||
use App;
|
||||
use Lang;
|
||||
use Cache;
|
||||
use File;
|
||||
use Exception;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
* SlaController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class LanguageController extends Controller {
|
||||
|
||||
class LanguageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch language at runtime
|
||||
* Switch language at runtime.
|
||||
*
|
||||
* @param type "" $lang
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function switchLanguage($lang) {
|
||||
public function switchLanguage($lang)
|
||||
{
|
||||
//if(Cache::has('language'))
|
||||
//{
|
||||
// return Cache::get('language');
|
||||
//} else return 'false';
|
||||
// Cache::put('language',$)
|
||||
$path = '../resources/lang'; // Path to check available language packages
|
||||
$path = base_path('resources/lang'); // Path to check available language packages
|
||||
if (array_key_exists($lang, Config::get('languages')) && in_array($lang, scandir($path))) {
|
||||
// dd(array_key_exists($lang, Config::get('languages')));
|
||||
// app()->setLocale($lang);
|
||||
@@ -60,55 +60,63 @@ class LanguageController extends Controller {
|
||||
// dd(Cache::get('language'));
|
||||
// dd()
|
||||
} else {
|
||||
return Redirect::back()->with('fails', Lang::get("lang.language-error"));
|
||||
return Redirect::back()->with('fails', Lang::get('lang.language-error'));
|
||||
}
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows language page
|
||||
* Shows language page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.language.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows Language upload form
|
||||
* Shows Language upload form.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getForm() {
|
||||
public function getForm()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.language.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide language datatable to language page
|
||||
* @return type
|
||||
* Provide language datatable to language page.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getLanguages() {
|
||||
$path = '../resources/lang';
|
||||
public function getLanguages()
|
||||
{
|
||||
$path = base_path('resources/lang');
|
||||
$values = scandir($path); //Extracts names of directories present in lang directory
|
||||
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
|
||||
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
|
||||
return \Datatable::collection(new Collection($values))
|
||||
->addColumn('language', function($model) {
|
||||
return Config::get('languages.' . $model);
|
||||
->addColumn('language', function ($model) {
|
||||
return Config::get('languages.'.$model);
|
||||
})
|
||||
->addColumn('id', function($model) {
|
||||
->addColumn('id', function ($model) {
|
||||
return $model;
|
||||
})
|
||||
->addColumn('status', function($model) {
|
||||
->addColumn('status', function ($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<span style='color:green'>" . Lang::trans("lang.active") . "</span>";
|
||||
} else
|
||||
return "<span style='color:red'>" . Lang::trans("lang.inactive") . "</span>";
|
||||
})
|
||||
->addColumn('Action', function($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='" . Lang::trans("lang.disable") . "'/></a>
|
||||
<a href='change-language/" . $model . "' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>";
|
||||
return "<span style='color:green'>".Lang::trans('lang.active').'</span>';
|
||||
} else {
|
||||
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' value='" . Lang::trans("lang.enable") . "'/></a>
|
||||
<a href='delete-language/" . $model . "' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>";
|
||||
return "<span style='color:red'>".Lang::trans('lang.inactive').'</span>';
|
||||
}
|
||||
})
|
||||
->addColumn('Action', function ($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='".Lang::trans('lang.disable')."'/></a>
|
||||
<a href='change-language/".$model."' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> ".Lang::trans('lang.delete').'</a>';
|
||||
} else {
|
||||
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' value='".Lang::trans('lang.enable')."'/></a>
|
||||
<a href='delete-language/".$model."' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> ".Lang::trans('lang.delete').'</a>';
|
||||
}
|
||||
})
|
||||
->searchColumns('language', 'id')
|
||||
@@ -116,23 +124,25 @@ class LanguageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* handle language file uploading
|
||||
* @return response
|
||||
* handle language file uploading.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function postForm() {
|
||||
public function postForm()
|
||||
{
|
||||
// getting all of the post data
|
||||
$file = array(
|
||||
'File' => Input::file('File'),
|
||||
$file = [
|
||||
'File' => Input::file('File'),
|
||||
'language-name' => Input::input('language-name'),
|
||||
'iso-code' => Input::input('iso-code')
|
||||
);
|
||||
'iso-code' => Input::input('iso-code'),
|
||||
];
|
||||
|
||||
// setting up rules
|
||||
$rules = array(
|
||||
'File' => 'required|mimes:zip|max:30000',
|
||||
$rules = [
|
||||
'File' => 'required|mimes:zip|max:30000',
|
||||
'language-name' => 'required',
|
||||
'iso-code' => 'required|max:2'
|
||||
); // and for max size
|
||||
'iso-code' => 'required|max:2',
|
||||
]; // and for max size
|
||||
// doing the validation, passing post data, rules and the messages
|
||||
$validator = Validator::make($file, $rules);
|
||||
if ($validator->fails()) {
|
||||
@@ -141,18 +151,19 @@ class LanguageController extends Controller {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
} else {
|
||||
|
||||
|
||||
//Checking if package already exists or not in lang folder
|
||||
$path = '../resources/lang';
|
||||
$path = base_path('resources/lang');
|
||||
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
|
||||
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.package_exist'));
|
||||
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
|
||||
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
|
||||
|
||||
return Redirect::back()->withInput();
|
||||
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
|
||||
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.iso-code-error'));
|
||||
|
||||
return Redirect::back()->withInput();
|
||||
} else {
|
||||
|
||||
@@ -160,11 +171,11 @@ class LanguageController extends Controller {
|
||||
if (Input::file('File')->isValid()) {
|
||||
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
|
||||
$destinationPath = '../public/uploads/'; // defining uploading path
|
||||
$extractpath = '../resources/lang/' . strtolower(Input::get('iso-code')); //defining extracting path
|
||||
$extractpath = '../resources/lang/'.strtolower(Input::get('iso-code')); //defining extracting path
|
||||
mkdir($extractpath); //creating directroy for extracting uploadd file
|
||||
//mkdir($destinationPath);
|
||||
Input::file('File')->move($destinationPath, $name); // uploading file to given path
|
||||
\Zipper::make($destinationPath . '/' . $name)->extractTo($extractpath); //extracting file to give path
|
||||
\Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath); //extracting file to give path
|
||||
//check if Zip extract foldercontains any subfolder
|
||||
$directories = File::directories($extractpath);
|
||||
//$directories = glob($extractpath. '/*' , GLOB_ONLYDIR);
|
||||
@@ -174,18 +185,21 @@ class LanguageController extends Controller {
|
||||
if ($success) {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.zipp-error'));
|
||||
Session::flash('link2', "http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages");
|
||||
Session::flash('link2', 'http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages');
|
||||
|
||||
return Redirect::back()->withInput();
|
||||
}
|
||||
} else {
|
||||
// sending back with success message
|
||||
Session::flash('success', Lang::get("lang.upload-success"));
|
||||
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
|
||||
Session::flash('success', Lang::get('lang.upload-success'));
|
||||
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
|
||||
|
||||
return Redirect::route('LanguageController');
|
||||
}
|
||||
} else {
|
||||
// sending back with error message.
|
||||
Session::flash('fails', Lang::get("lang.file-error"));
|
||||
Session::flash('fails', Lang::get('lang.file-error'));
|
||||
|
||||
return Redirect::route('form');
|
||||
}
|
||||
}
|
||||
@@ -193,36 +207,43 @@ class LanguageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* allow user to download language template file
|
||||
* allow user to download language template file.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
Public function download() {
|
||||
public function download()
|
||||
{
|
||||
return response()->download('../public/downloads/en.zip');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to delete languages
|
||||
* @param type $lang
|
||||
* This function is used to delete languages.
|
||||
*
|
||||
* @param type $lang
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deleteLanguage($lang) {
|
||||
public function deleteLanguage($lang)
|
||||
{
|
||||
if ($lang !== App::getLocale()) {
|
||||
$deletePath = '../resources/lang/' . $lang; //define file path to delete
|
||||
$deletePath = base_path('resources/lang').$lang; //define file path to delete
|
||||
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
|
||||
if ($success) {
|
||||
//sending back with success message
|
||||
Session::flash('success', Lang::get('lang.delete-success'));
|
||||
|
||||
return Redirect::back();
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.active-lang-error'));
|
||||
|
||||
return redirect('languages');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,33 +11,35 @@ use App\Http\Requests\ProfileRequest;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ProfileController
|
||||
* ProfileController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ProfileController extends Controller {
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile page
|
||||
* Get profile page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
@@ -51,10 +53,12 @@ class ProfileController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile Edit page
|
||||
* Get profile Edit page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
@@ -68,12 +72,15 @@ class ProfileController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* @param type int $id
|
||||
* Post profile page.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile($id, ProfileRequest $request) {
|
||||
public function postProfile($id, ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -92,12 +99,13 @@ class ProfileController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$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()) {
|
||||
@@ -106,22 +114,25 @@ class ProfileController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Profile password page
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* Post Profile password page.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, User $user, ProfilePassword $request) {
|
||||
public function postProfilePassword($id, User $user, 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('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,51 +21,55 @@ use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\Responder;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Utility\Date_format;
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
* SettingsController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Settings Page
|
||||
* Main Settings Page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function settings() {
|
||||
public function settings()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.setting');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Response
|
||||
* @param $compant instance of company table
|
||||
*
|
||||
* get the form for company setting page
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getcompany(Company $company) {
|
||||
public function getcompany(Company $company)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$companys = $company->whereId('1')->first();
|
||||
@@ -78,18 +82,21 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Company $company
|
||||
* @param type CompanyRequest $request
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Company $company
|
||||
* @param type CompanyRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postcompany($id, Company $company, CompanyRequest $request) {
|
||||
public function postcompany($id, Company $company, CompanyRequest $request)
|
||||
{
|
||||
/* fetch the values of company request */
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/media/company/';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
}
|
||||
@@ -103,21 +110,24 @@ class SettingsController extends Controller {
|
||||
return redirect('getcompany')->with('success', 'Company Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for System setting page
|
||||
* @param type System $system
|
||||
* @param type Department $department
|
||||
* @param type Timezones $timezone
|
||||
* @param type Date_format $date
|
||||
* get the form for System setting page.
|
||||
*
|
||||
* @param type System $system
|
||||
* @param type Department $department
|
||||
* @param type Timezones $timezone
|
||||
* @param type Date_format $date
|
||||
* @param type Date_time_format $date_time
|
||||
* @param type Time_format $time
|
||||
* @param type Time_format $time
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) {
|
||||
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of system from system table */
|
||||
$systems = $system->whereId('1')->first();
|
||||
@@ -134,12 +144,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type System $system
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type System $system
|
||||
* @param type SystemRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postsystem($id, System $system, SystemRequest $request) {
|
||||
public function postsystem($id, System $system, SystemRequest $request)
|
||||
{
|
||||
try {
|
||||
// dd($request);
|
||||
/* fetch the values of system request */
|
||||
@@ -151,19 +164,22 @@ class SettingsController extends Controller {
|
||||
return redirect('getsystem')->with('success', 'System Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Ticket setting page
|
||||
* @param type Ticket $ticket
|
||||
* @param type Sla_plan $sla
|
||||
* get the form for Ticket setting page.
|
||||
*
|
||||
* @param type Ticket $ticket
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Help_topic $topic
|
||||
* @param type Priority $priority
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) {
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of ticket from ticket table */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -180,12 +196,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Ticket $ticket
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Ticket $ticket
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postticket($id, Ticket $ticket, Request $request) {
|
||||
public function postticket($id, Ticket $ticket, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of ticket request */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -206,18 +225,21 @@ class SettingsController extends Controller {
|
||||
return redirect('getticket')->with('success', 'Ticket Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Email setting page
|
||||
* @param type Email $email
|
||||
* get the form for Email setting page.
|
||||
*
|
||||
* @param type Email $email
|
||||
* @param type Template $template
|
||||
* @param type Emails $email1
|
||||
* @param type Emails $email1
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getemail(Email $email, Template $template, Emails $email1) {
|
||||
public function getemail(Email $email, Template $template, Emails $email1)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -234,12 +256,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Email $email
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Email $email
|
||||
* @param type EmailRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postemail($id, Email $email, EmailRequest $request) {
|
||||
public function postemail($id, Email $email, EmailRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email request */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -258,20 +283,22 @@ class SettingsController extends Controller {
|
||||
return redirect('getemail')->with('success', 'Email Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Access setting page
|
||||
* get the form for Access setting page.
|
||||
*
|
||||
* @param type Access $access
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
// public function getaccess(Access $access) {
|
||||
// try {
|
||||
// /* fetch the values of access from access table */
|
||||
// $accesses = $access->whereId('1')->first();
|
||||
// // Direct to Access Settings Page
|
||||
// // Direct to Access Settings Page
|
||||
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
|
||||
// } catch (Exception $e) {
|
||||
// return view('404');
|
||||
@@ -280,8 +307,10 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type Access $access
|
||||
*
|
||||
* @param type Access $access
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
// public function postaccess(Access $access, Request $request) {
|
||||
@@ -310,11 +339,14 @@ class SettingsController extends Controller {
|
||||
// }
|
||||
|
||||
/**
|
||||
* get the form for Responder setting page
|
||||
* get the form for Responder setting page.
|
||||
*
|
||||
* @param type Responder $responder
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getresponder(Responder $responder) {
|
||||
public function getresponder(Responder $responder)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder from responder table */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -327,11 +359,14 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type Responder $responder
|
||||
* @param type Request $request
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function postresponder(Responder $responder, Request $request) {
|
||||
public function postresponder(Responder $responder, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder request */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -348,16 +383,19 @@ class SettingsController extends Controller {
|
||||
return redirect('getresponder')->with('success', 'Responder Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Alert setting page
|
||||
* get the form for Alert setting page.
|
||||
*
|
||||
* @param type Alert $alert
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getalert(Alert $alert) {
|
||||
public function getalert(Alert $alert)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert from alert table */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -370,12 +408,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Alert $alert
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Alert $alert
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postalert($id, Alert $alert, Request $request) {
|
||||
public function postalert($id, Alert $alert, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert request */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -430,38 +471,46 @@ class SettingsController extends Controller {
|
||||
return redirect('getalert')->with('success', 'Alert Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To display the list of ratings in the system
|
||||
* To display the list of ratings in the system.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function RatingSettings() {
|
||||
public function RatingSettings()
|
||||
{
|
||||
$ratings = DB::table('settings_ratings')->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* To store rating data
|
||||
* To store rating data.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function PostRatingSettings($slug) {
|
||||
public function PostRatingSettings($slug)
|
||||
{
|
||||
$name = Input::get('rating_name');
|
||||
$publish = Input::get('publish');
|
||||
$modify = Input::get('modify');
|
||||
DB::table('settings_ratings')->whereSlug($slug)->update(array('rating_name' => $name, 'publish' => $publish, 'modify' => $modify));
|
||||
DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]);
|
||||
|
||||
return redirect()->back()->with('success', 'Successfully updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* To delete a type of rating
|
||||
* To delete a type of rating.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function RatingDelete($slug) {
|
||||
public function RatingDelete($slug)
|
||||
{
|
||||
DB::table('settings_ratings')->whereSlug($slug)->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Successfully Deleted');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,29 +15,32 @@ use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
* SlaController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SlaController extends Controller {
|
||||
|
||||
class SlaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Sla_plan $sla) {
|
||||
public function index(Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
/* Declare a Variable $slas to store all Values From Sla_plan Table */
|
||||
$slas = $sla->get();
|
||||
@@ -50,9 +53,11 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
/* Direct to Create Page */
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.create');
|
||||
@@ -63,11 +68,14 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Sla_plan $sla, SlaRequest $request) {
|
||||
public function store(Sla_plan $sla, SlaRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Fill the request values to Sla_plan Table */
|
||||
/* Check whether function success or not */
|
||||
@@ -76,21 +84,25 @@ class SlaController extends Controller {
|
||||
return redirect('sla')->with('success', 'SLA Plan Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Sla_plan $sla) {
|
||||
public function edit($id, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
/* Direct to edit page along values of perticular field using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -99,12 +111,15 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request) {
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request)
|
||||
{
|
||||
try {
|
||||
/* Fill values to selected field using Id except Check box */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
@@ -119,17 +134,20 @@ class SlaController extends Controller {
|
||||
return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Sla_plan $sla) {
|
||||
public function destroy($id, Sla_plan $sla)
|
||||
{
|
||||
$default_sla = Ticket::where('id', '=', '1')->first();
|
||||
if ($default_sla->sla == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
@@ -137,49 +155,48 @@ class SlaController extends Controller {
|
||||
$tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default SLA</li>';
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
$dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
|
||||
if ($dept > 0) {
|
||||
if ($dept > 1) {
|
||||
$text_dept = "Emails";
|
||||
$text_dept = 'Emails';
|
||||
} else {
|
||||
$text_dept = "Email";
|
||||
$text_dept = 'Email';
|
||||
}
|
||||
$dept = '<li>Associated department have been moved to default SLA</li>';
|
||||
} else {
|
||||
$dept = "";
|
||||
$dept = '';
|
||||
}
|
||||
$topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]);
|
||||
if ($topic > 0) {
|
||||
if ($topic > 1) {
|
||||
$text_topic = "Emails";
|
||||
$text_topic = 'Emails';
|
||||
} else {
|
||||
$text_topic = "Email";
|
||||
$text_topic = 'Email';
|
||||
}
|
||||
$topic = '<li>Associated Help Topic have been moved to default SLA</li>';
|
||||
} else {
|
||||
$topic = "";
|
||||
$topic = '';
|
||||
}
|
||||
$message = $ticket . $dept . $topic;
|
||||
$message = $ticket.$dept.$topic;
|
||||
/* Delete a perticular field from the database by delete() using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
try {
|
||||
$slas->delete();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully' . $message);
|
||||
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,35 +16,39 @@ use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* TeamController
|
||||
* TeamController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TeamController extends Controller {
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* get Index page
|
||||
* @param type Teams $team
|
||||
* get Index page.
|
||||
*
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent)
|
||||
{
|
||||
try {
|
||||
$teams = $team->get();
|
||||
/* find out the Number of Members in the Team */
|
||||
$id = $teams->lists('id');
|
||||
$assign_team_agent = $assign_team_agent->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -53,12 +57,16 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user) {
|
||||
public function create(User $user)
|
||||
{
|
||||
try {
|
||||
$user = $user->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -67,12 +75,14 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @param type Teams $team
|
||||
* @param type TeamRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Teams $team, TeamRequest $request) {
|
||||
|
||||
public function store(Teams $team, TeamRequest $request)
|
||||
{
|
||||
if ($request->team_lead) {
|
||||
$team_lead = $request->team_lead;
|
||||
} else {
|
||||
@@ -86,24 +96,28 @@ class TeamController extends Controller {
|
||||
return redirect('teams')->with('success', 'Teams Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @param type Teams $team
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team)
|
||||
{
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$teams = $team->whereId($id)->first();
|
||||
$agent_team = $assign_team_agent->where('team_id', $id)->get();
|
||||
$agent_id = $agent_team->lists('agent_id', 'agent_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -112,13 +126,15 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type TeamUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Teams $team, TeamUpdate $request) {
|
||||
|
||||
public function update($id, Teams $team, TeamUpdate $request)
|
||||
{
|
||||
$teams = $team->whereId($id)->first();
|
||||
//updating check box
|
||||
if ($request->team_lead) {
|
||||
@@ -140,18 +156,21 @@ class TeamController extends Controller {
|
||||
return redirect('teams')->with('success', 'Teams Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent)
|
||||
{
|
||||
try {
|
||||
$assign_team_agent->where('team_id', $id)->delete();
|
||||
$teams = $team->whereId($id)->first();
|
||||
@@ -162,8 +181,7 @@ class TeamController extends Controller {
|
||||
return redirect('teams')->with('success', 'Teams Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TemplateRequest;
|
||||
use App\Http\Requests\helpdesk\TemplateUdate;
|
||||
@@ -14,25 +14,25 @@ use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* TemplateController
|
||||
* TemplateController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TemplateController extends Controller {
|
||||
|
||||
class TemplateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
@@ -41,12 +41,16 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Template $template) {
|
||||
public function index(Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -55,14 +59,18 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type Languages $language
|
||||
* @param type Template $template
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Languages $language, Template $template) {
|
||||
public function create(Languages $language, Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->get();
|
||||
$languages = $language->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -71,11 +79,14 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Template $template
|
||||
*
|
||||
* @param type Template $template
|
||||
* @param type TemplateRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Template $template, TemplateRequest $request) {
|
||||
public function store(Template $template, TemplateRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($template->fill($request->input())->save() == true) {
|
||||
@@ -93,49 +104,60 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param int $id
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Template $template
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Template $template
|
||||
* @param type Languages $language
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function listdirectories() {
|
||||
public function listdirectories()
|
||||
{
|
||||
$path = '../resources/views/emails/';
|
||||
$directories = scandir($path);
|
||||
$directory = str_replace('/', '-', $path);
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory'));
|
||||
}
|
||||
|
||||
public function listtemplates($template, $path) {
|
||||
public function listtemplates($template, $path)
|
||||
{
|
||||
$paths = str_replace('-', '/', $path);
|
||||
$directory2 = $paths . $template;
|
||||
$directory2 = $paths.$template;
|
||||
|
||||
$templates = scandir($directory2);
|
||||
$directory = str_replace('/', '-', $directory2 . '/');
|
||||
$directory = str_replace('/', '-', $directory2.'/');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory'));
|
||||
}
|
||||
|
||||
public function readtemplate($template, $path) {
|
||||
public function readtemplate($template, $path)
|
||||
{
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$handle = fopen($directory . $template, "r");
|
||||
$contents = fread($handle, filesize($directory . $template));
|
||||
$handle = fopen($directory.$template, 'r');
|
||||
$contents = fread($handle, filesize($directory.$template));
|
||||
fclose($handle);
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path'));
|
||||
}
|
||||
|
||||
public function createtemplate() {
|
||||
public function createtemplate()
|
||||
{
|
||||
$directory = '../resources/views/emails/';
|
||||
$fname = Input::get('folder_name');
|
||||
$filename = $directory . $fname;
|
||||
$filename = $directory.$fname;
|
||||
|
||||
// images folder creation using php
|
||||
// $mydir = dirname( __FILE__ )."/html/images";
|
||||
@@ -147,32 +169,37 @@ class TemplateController extends Controller {
|
||||
if (!file_exists($filename)) {
|
||||
mkdir($filename, 0777);
|
||||
}
|
||||
$files = array_filter(scandir($directory . 'default'));
|
||||
$files = array_filter(scandir($directory.'default'));
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file === '.' or $file === '..')
|
||||
if ($file === '.' or $file === '..') {
|
||||
continue;
|
||||
}
|
||||
if (!is_dir($file)) {
|
||||
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
|
||||
$destination = $directory . $fname . '/';
|
||||
$destination = $directory.$fname.'/';
|
||||
|
||||
copy($directory . 'default/' . $file, $destination . $file);
|
||||
copy($directory.'default/'.$file, $destination.$file);
|
||||
}
|
||||
}
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully copied');
|
||||
}
|
||||
|
||||
public function writetemplate($template, $path) {
|
||||
public function writetemplate($template, $path)
|
||||
{
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$b = Input::get('templatedata');
|
||||
|
||||
file_put_contents($directory . $template, print_r($b, true));
|
||||
file_put_contents($directory.$template, print_r($b, true));
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully updated');
|
||||
}
|
||||
|
||||
public function deletetemplate($template, $path) {
|
||||
public function deletetemplate($template, $path)
|
||||
{
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$dir = $directory . $template;
|
||||
$dir = $directory.$template;
|
||||
$status = \DB::table('settings_email')->first();
|
||||
if ($template == 'default' or $template == $status->template) {
|
||||
return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!');
|
||||
@@ -180,26 +207,31 @@ class TemplateController extends Controller {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
unlink($dir . "/" . $object);
|
||||
if ($object != '.' && $object != '..') {
|
||||
unlink($dir.'/'.$object);
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
} else {
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully Deleted');
|
||||
}
|
||||
|
||||
public function activateset($setname) {
|
||||
\DB::table('settings_email')->update(array('template' => $setname));
|
||||
public function activateset($setname)
|
||||
{
|
||||
\DB::table('settings_email')->update(['template' => $setname]);
|
||||
|
||||
return \Redirect::back()->with('success', 'You have Successfully Activated this Set');
|
||||
}
|
||||
|
||||
public function edit($id, Template $template, Languages $language) {
|
||||
public function edit($id, Template $template, Languages $language)
|
||||
{
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
$languages = $language->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -208,12 +240,15 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @param type TemplateUdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Template $template, TemplateUdate $request) {
|
||||
public function update($id, Template $template, TemplateUdate $request)
|
||||
{
|
||||
try {
|
||||
//TODO validation
|
||||
$templates = $template->whereId($id)->first();
|
||||
@@ -233,11 +268,14 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Template $template) {
|
||||
public function destroy($id, Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
@@ -256,12 +294,16 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Form for Email connection checking.
|
||||
*
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function formDiagno(Emails $email) {
|
||||
public function formDiagno(Emails $email)
|
||||
{
|
||||
try {
|
||||
$emails = $email->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -269,11 +311,14 @@ class TemplateController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* function to send emails
|
||||
* function to send emails.
|
||||
*
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function postDiagno(Request $request) {
|
||||
public function postDiagno(Request $request)
|
||||
{
|
||||
$email = $request->input('to');
|
||||
if ($email == null) {
|
||||
return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
|
||||
@@ -283,5 +328,4 @@ class TemplateController extends Controller {
|
||||
|
||||
return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,21 +11,22 @@ use App\Model\helpdesk\Ticket_thread;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ThreadController
|
||||
* ThreadController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ThreadController extends Controller {
|
||||
|
||||
class ThreadController extends Controller
|
||||
{
|
||||
/**
|
||||
* get the values from ticket_thread Table and direct to view page
|
||||
* get the values from ticket_thread Table and direct to view page.
|
||||
*
|
||||
* @param type Ticket_thread $thread
|
||||
* @param type Priority $priority
|
||||
* @return type Response
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority) {
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority)
|
||||
{
|
||||
try {
|
||||
/* get the values of Ticket_thread from Ticket_thread Table */
|
||||
$threads = $thread->get();
|
||||
@@ -37,5 +38,4 @@ class ThreadController extends Controller {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,25 +14,25 @@ use App\User;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* CannedController
|
||||
* CannedController.
|
||||
*
|
||||
* This controller is for all the functionalities of Canned response for Agents in the Agent Panel
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedController extends Controller {
|
||||
|
||||
class CannedController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -41,27 +41,34 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the Canned Responses.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes.default1.agent.helpdesk.canned.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Canned Response
|
||||
* Show the form for creating a new Canned Response.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.agent.helpdesk.canned.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Canned Response.
|
||||
* @param type CannedRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type CannedRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(CannedRequest $request, Canned $canned) {
|
||||
public function store(CannedRequest $request, Canned $canned)
|
||||
{
|
||||
// fetching all the requested inputs
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
@@ -69,6 +76,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Added Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
@@ -77,24 +85,31 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the Canned Response.
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function edit($id, Canned $canned) {
|
||||
public function edit($id, Canned $canned)
|
||||
{
|
||||
// fetching requested canned response
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.canned.edit', compact('canned'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Canned Response in database.
|
||||
* @param type $id
|
||||
* @param type CannedUpdateRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type CannedUpdateRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned) {
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned)
|
||||
{
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
// fetching all the requested inputs
|
||||
@@ -104,6 +119,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
@@ -112,11 +128,14 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Delete the Canned Response from storage.
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Canned $canned) {
|
||||
public function destroy($id, Canned $canned)
|
||||
{
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->whereId($id)->first();
|
||||
/* delete the selected field */
|
||||
@@ -133,20 +152,22 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Fetch Canned Response in the ticket detail page.
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function get_canned($id) {
|
||||
public function get_canned($id)
|
||||
{
|
||||
// checking for the canned response with requested value
|
||||
if ($id != "zzz") {
|
||||
if ($id != 'zzz') {
|
||||
// fetching canned response
|
||||
$canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$msg = $canned->message;
|
||||
} else {
|
||||
$msg = "";
|
||||
$msg = '';
|
||||
}
|
||||
// returning the canned response in JSON format
|
||||
return \Response::json($msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,35 +5,32 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use View;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Exception;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* DashboardController
|
||||
* This controlleris used to fetch dashboard in the agent panel
|
||||
* This controlleris used to fetch dashboard in the agent panel.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DashboardController extends Controller {
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking for authentication
|
||||
$this->middleware('auth');
|
||||
// checking if the role is agent
|
||||
@@ -41,12 +38,14 @@ class DashboardController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dashboard page
|
||||
* Get the dashboard page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// if(Auth::user()->role == "user"){
|
||||
// return \Redirect::route('home');
|
||||
// return \Redirect::route('home');
|
||||
// }
|
||||
try {
|
||||
return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
|
||||
@@ -56,10 +55,12 @@ class DashboardController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching dashboard graph data to implement graph
|
||||
* Fetching dashboard graph data to implement graph.
|
||||
*
|
||||
* @return type Json
|
||||
*/
|
||||
public function ChartData($date111 = "", $date122 = "") {
|
||||
public function ChartData($date111 = '', $date122 = '')
|
||||
{
|
||||
$date11 = strtotime($date122);
|
||||
$date12 = strtotime($date111);
|
||||
if ($date11 && $date12) {
|
||||
@@ -67,29 +68,29 @@ class DashboardController extends Controller {
|
||||
$date1 = $date11;
|
||||
} else {
|
||||
// generating current date
|
||||
$date2 = strtotime(Date('Y-m-d'));
|
||||
$date3 = Date('Y-m-d');
|
||||
$date2 = strtotime(date('Y-m-d'));
|
||||
$date3 = date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
// generating a date range of 1 month
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
|
||||
}
|
||||
$return = "";
|
||||
$last = "";
|
||||
$return = '';
|
||||
$last = '';
|
||||
for ($i = $date1; $i <= $date2; $i = $i + 86400) {
|
||||
$thisDate = date('Y-m-d', $i);
|
||||
|
||||
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
|
||||
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
}
|
||||
$last = rtrim($return, ',');
|
||||
|
||||
return '[' . $last . ']';
|
||||
return '['.$last.']';
|
||||
|
||||
// $ticketlist = DB::table('tickets')
|
||||
// ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'),
|
||||
@@ -99,5 +100,4 @@ class DashboardController extends Controller {
|
||||
// ->get();
|
||||
// return $ticketlist;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,57 +3,50 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
// classes
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
use PhpImap\IncomingMail;
|
||||
use PhpImap\IncomingMailAttachment;
|
||||
use \ForceUTF8\Encoding;
|
||||
use App;
|
||||
use DB;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use Crypt;
|
||||
use Schedule;
|
||||
use File;
|
||||
use Artisan;
|
||||
use Exception;
|
||||
use ForceUTF8\Encoding;
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
|
||||
/**
|
||||
* MailController
|
||||
* MailController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller {
|
||||
|
||||
class MailController extends Controller
|
||||
{
|
||||
/**
|
||||
* constructor
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param type TicketController $TicketController
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
public function __construct(TicketController $TicketController)
|
||||
{
|
||||
$this->TicketController = $TicketController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reademails
|
||||
* Reademails.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) {
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket)
|
||||
{
|
||||
// $path_url = $system->first()->url;
|
||||
if ($settings_email->first()->email_fetching == 1) {
|
||||
if ($settings_email->first()->all_emails == 1) {
|
||||
@@ -86,11 +79,11 @@ class MailController extends Controller {
|
||||
$protocol = $e_mail->mailbox_protocol;
|
||||
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first();
|
||||
$protocol = $get_mailboxprotocol->value;
|
||||
$imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX';
|
||||
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
|
||||
$password = Crypt::decrypt($e_mail->password);
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
|
||||
$mails = array();
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime("-1 day")));
|
||||
$mails = [];
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
|
||||
if (!$mailsIds) {
|
||||
die('Mailbox is empty');
|
||||
}
|
||||
@@ -112,15 +105,15 @@ class MailController extends Controller {
|
||||
}
|
||||
$date = $mail->date;
|
||||
$datetime = $overview[0]->date;
|
||||
$date_time = explode(" ", $datetime);
|
||||
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
|
||||
$date_time = explode(' ', $datetime);
|
||||
$date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
// dd($date);
|
||||
|
||||
if (isset($mail->subject)) {
|
||||
$subject = $mail->subject;
|
||||
} else {
|
||||
$subject = "No Subject";
|
||||
$subject = 'No Subject';
|
||||
}
|
||||
|
||||
// dd($subject);
|
||||
@@ -128,7 +121,7 @@ class MailController extends Controller {
|
||||
$fromaddress = $mail->fromAddress;
|
||||
$ticket_source = Ticket_source::where('name', '=', 'email')->first();
|
||||
$source = $ticket_source->id;
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
|
||||
$assign = $get_helptopic->auto_assign;
|
||||
$form_data = null;
|
||||
@@ -141,7 +134,7 @@ class MailController extends Controller {
|
||||
$thread_id = $thread_id;
|
||||
|
||||
foreach ($mail->getAttachments() as $attachment) {
|
||||
$support = "support";
|
||||
$support = 'support';
|
||||
// echo $_SERVER['DOCUMENT_ROOT'];
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
@@ -150,7 +143,7 @@ class MailController extends Controller {
|
||||
// var_dump($attachment->filePath);
|
||||
// dd($filepath);
|
||||
// $path = $dir_img_path[0]."/code/public/".$filepath[1];
|
||||
$path = public_path() . $filepath[1];
|
||||
$path = public_path().$filepath[1];
|
||||
// dd($path);
|
||||
$filesize = filesize($path);
|
||||
$file_data = file_get_contents($path);
|
||||
@@ -159,28 +152,28 @@ class MailController extends Controller {
|
||||
$string = str_replace('-', '', $attachment->name);
|
||||
$filename = explode('src', $attachment->filePath);
|
||||
$filename = str_replace('\\', '', $filename);
|
||||
$body = str_replace("cid:" . $imageid, $filepath[1], $body);
|
||||
$body = str_replace('cid:'.$imageid, $filepath[1], $body);
|
||||
$pos = strpos($body, $filepath[1]);
|
||||
|
||||
if ($pos == false) {
|
||||
if ($settings_email->first()->attachment == 1) {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload = new Ticket_attachments();
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "ATTACHMENT";
|
||||
$upload->poster = 'ATTACHMENT';
|
||||
$upload->save();
|
||||
}
|
||||
} else {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload = new Ticket_attachments();
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "INLINE";
|
||||
$upload->poster = 'INLINE';
|
||||
$upload->save();
|
||||
}
|
||||
unlink($path);
|
||||
@@ -198,35 +191,45 @@ class MailController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* separate reply
|
||||
* @param type $body
|
||||
* separate reply.
|
||||
*
|
||||
* @param type $body
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function separate_reply($body) {
|
||||
public function separate_reply($body)
|
||||
{
|
||||
$body2 = explode('---Reply above this line---', $body);
|
||||
$body3 = $body2[0];
|
||||
|
||||
return $body3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Imap text
|
||||
* Decode Imap text.
|
||||
*
|
||||
* @param type $str
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function decode_imap_text($str) {
|
||||
public function decode_imap_text($str)
|
||||
{
|
||||
$result = '';
|
||||
$decode_header = imap_mime_header_decode($str);
|
||||
foreach ($decode_header AS $obj) {
|
||||
foreach ($decode_header as $obj) {
|
||||
$result .= htmlspecialchars(rtrim($obj->text, "\t"));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch_attachments
|
||||
* fetch_attachments.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments() {
|
||||
public function fetch_attachments()
|
||||
{
|
||||
$uploads = Upload::all();
|
||||
foreach ($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
@@ -234,24 +237,26 @@ class MailController extends Controller {
|
||||
imagejpeg($image, null, 80);
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>';
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,'.base64_encode($data).'"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to load data
|
||||
* @param type $id
|
||||
* function to load data.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type file
|
||||
*/
|
||||
public function get_data($id) {
|
||||
public function get_data($id)
|
||||
{
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
|
||||
foreach ($attachments as $attachment) {
|
||||
header('Content-type: application/' . $attachment->type . '');
|
||||
header('Content-Disposition: inline; filename=' . $attachment->name . '');
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
echo $attachment->file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,38 +5,35 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// Model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Utility\Log_notification;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\settings\Email;
|
||||
use App\Model\helpdesk\Utility\Log_notification;
|
||||
use App\User;
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* NotificationController
|
||||
* This controller is used to send daily notifications
|
||||
* This controller is used to send daily notifications.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class NotificationController extends Controller {
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
/**
|
||||
* This function is for sending daily report/notification about the system
|
||||
* This function is for sending daily report/notification about the system.
|
||||
* */
|
||||
public function send_notification() {
|
||||
public function send_notification()
|
||||
{
|
||||
//fetching email settings
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
// checking if the daily notification is enabled or not
|
||||
if ($email->notification_cron == 1) {
|
||||
// checking if current date is equal to the last entered daily notification log
|
||||
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
|
||||
$date = explode(" ", $notification->created_at);
|
||||
if (Date('Y-m-d') == $date[0]) {
|
||||
|
||||
$date = explode(' ', $notification->created_at);
|
||||
if (date('Y-m-d') == $date[0]) {
|
||||
} else {
|
||||
// creating a daily notification log
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
@@ -54,28 +51,33 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Notification/Report
|
||||
* Admin Notification/Report.
|
||||
*
|
||||
* @param company
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_admin($company) {
|
||||
public function send_notification_to_admin($company)
|
||||
{
|
||||
// get all admin users
|
||||
$users = User::where('role', '=', 'admin')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to admin
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message)use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report ');
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
\Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report ');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Department Manager Notification/Report
|
||||
* Department Manager Notification/Report.
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_manager($company) {
|
||||
public function send_notification_to_manager($company)
|
||||
{
|
||||
// get all department managers
|
||||
$depts = Department::all();
|
||||
foreach ($depts as $dept) {
|
||||
@@ -85,9 +87,9 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to manager of a department
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message)use ($email, $user_name, $company, $dept_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for department manager of ' . $dept_name . ' department.');
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
\Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message) use ($email, $user_name, $company, $dept_name) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report for department manager of '.$dept_name.' department.');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -95,10 +97,12 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Team Lead Notification/Report
|
||||
* Team Lead Notification/Report.
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_team_lead($company) {
|
||||
public function send_notification_to_team_lead($company)
|
||||
{
|
||||
// get all Team leads
|
||||
$teams = Teams::all();
|
||||
foreach ($teams as $team) {
|
||||
@@ -108,9 +112,9 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to team lead
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message)use ($email, $user_name, $company, $team_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for Team Lead of team ' . $team_name);
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
\Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message) use ($email, $user_name, $company, $team_name) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -118,35 +122,40 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Agent Notification/Report
|
||||
* Agent Notification/Report.
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_agent($company) {
|
||||
public function send_notification_to_agent($company)
|
||||
{
|
||||
// get all agents users
|
||||
$users = User::where('role', '=', 'agent')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to all the agents
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message)use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for Agents');
|
||||
$user_name = $user->first_name.' '.$user->last_name;
|
||||
\Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message) use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report for Agents');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching company name
|
||||
* Fetching company name.
|
||||
*
|
||||
* @return type variable
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
|
@@ -6,13 +6,11 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\OrganizationRequest;
|
||||
|
||||
/* include organization model */
|
||||
use App\Http\Requests\helpdesk\OrganizationUpdate;
|
||||
// models
|
||||
/* Define OrganizationRequest to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
|
||||
/* Define OrganizationUpdate to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\User_org;
|
||||
// classes
|
||||
@@ -22,21 +20,21 @@ use Exception;
|
||||
* OrganizationController
|
||||
* This controller is used to CRUD organization detail.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OrganizationController extends Controller {
|
||||
|
||||
class OrganizationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking for authentication
|
||||
$this->middleware('auth');
|
||||
// checking if the role is agent
|
||||
@@ -45,10 +43,13 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values of table organization */
|
||||
return view('themes.default1.agent.helpdesk.organization.index');
|
||||
@@ -58,10 +59,12 @@ class OrganizationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to display the list of Organizations
|
||||
* This function is used to display the list of Organizations.
|
||||
*
|
||||
* @return datatable
|
||||
*/
|
||||
public function org_list() {
|
||||
public function org_list()
|
||||
{
|
||||
// chumper datable package call to display Advance datatable
|
||||
return \Datatable::collection(Organization::all())
|
||||
/* searchable name */
|
||||
@@ -73,28 +76,31 @@ class OrganizationController extends Controller {
|
||||
// return $model->name;
|
||||
if (strlen($model->name) > 20) {
|
||||
$orgname = substr($model->name, 0, 25);
|
||||
$orgname = substr($orgname, 0, strrpos($orgname, ' ')) . ' ...';
|
||||
$orgname = substr($orgname, 0, strrpos($orgname, ' ')).' ...';
|
||||
} else {
|
||||
$orgname = $model->name;
|
||||
}
|
||||
|
||||
return $orgname;
|
||||
})
|
||||
/* column website */
|
||||
->addColumn('website', function ($model) {
|
||||
$website = $model->website;
|
||||
|
||||
return $website;
|
||||
})
|
||||
/* column phone number */
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = $model->phone;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
/* column action buttons */
|
||||
->addColumn('Actions', function ($model) {
|
||||
// displaying action buttons
|
||||
// displaying action buttons
|
||||
// modal popup to delete data
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span> <a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href="'.route('organizations.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -102,11 +108,11 @@ class OrganizationController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
' . $model->user_name . '
|
||||
'.$model->user_name.'
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="'.route('org.delete', $model->id).'"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -117,9 +123,11 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new organization.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.organization.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -129,11 +137,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created organization in storage.
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationRequest $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(Organization $org, OrganizationRequest $request) {
|
||||
public function store(Organization $org, OrganizationRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Insert the all input request to organization table */
|
||||
/* Check whether function success or not */
|
||||
@@ -152,11 +163,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified organization.
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function show($id, Organization $org) {
|
||||
public function show($id, Organization $org)
|
||||
{
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -169,11 +183,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified organization.
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($id, Organization $org) {
|
||||
public function edit($id, Organization $org)
|
||||
{
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -186,12 +203,15 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified organization in storage.
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationUpdate $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function update($id, Organization $org, OrganizationUpdate $request) {
|
||||
public function update($id, Organization $org, OrganizationUpdate $request)
|
||||
{
|
||||
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -213,10 +233,13 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Delete a specified organization from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Organization $org, User_org $user_org) {
|
||||
public function destroy($id, Organization $org, User_org $user_org)
|
||||
{
|
||||
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -237,11 +260,14 @@ class OrganizationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Soring an organization head
|
||||
* @param type $id
|
||||
* Soring an organization head.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function Head_Org($id) {
|
||||
public function Head_Org($id)
|
||||
{
|
||||
// get the user to make organization head
|
||||
$head_user = \Input::get('user');
|
||||
// get an instance of the selected organization
|
||||
@@ -249,7 +275,7 @@ class OrganizationController extends Controller {
|
||||
$org_head->head = $head_user;
|
||||
// save the user to organization head
|
||||
$org_head->save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,56 +3,39 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\SettingsController;use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
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
|
||||
* TicketController2.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class Ticket2Controller extends Controller {
|
||||
|
||||
class Ticket2Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* Show the Inbox ticket list page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deptopen($id) {
|
||||
public function deptopen($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
@@ -66,10 +49,12 @@ class Ticket2Controller extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* Show the Inbox ticket list page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deptclose($id) {
|
||||
public function deptclose($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
@@ -83,10 +68,12 @@ class Ticket2Controller extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* Show the Inbox ticket list page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deptinprogress($id) {
|
||||
public function deptinprogress($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
@@ -98,5 +85,4 @@ class Ticket2Controller extends Controller {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,30 +19,30 @@ use App\Model\helpdesk\Agent_panel\User_org;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
* This controller is used to CRUD an User details, and proile management of an agent
|
||||
* This controller is used to CRUD an User details, and proile management of an agent.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -51,10 +51,13 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display all list of the users.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
return view('themes.default1.agent.helpdesk.user.index');
|
||||
@@ -64,10 +67,12 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to display the list of users using chumper datatables
|
||||
* This function is used to display the list of users using chumper datatables.
|
||||
*
|
||||
* @return datatable
|
||||
*/
|
||||
public function user_list() {
|
||||
public function user_list()
|
||||
{
|
||||
// displaying list of users with chumper datatables
|
||||
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
|
||||
/* searchable column username */
|
||||
@@ -78,28 +83,31 @@ class UserController extends Controller {
|
||||
->addColumn('user_name', function ($model) {
|
||||
if (strlen($model->user_name) > 20) {
|
||||
$username = substr($model->user_name, 0, 30);
|
||||
$username = substr($username, 0, strrpos($username, ' ')) . ' ...';
|
||||
$username = substr($username, 0, strrpos($username, ' ')).' ...';
|
||||
} else {
|
||||
$username = $model->user_name;
|
||||
}
|
||||
|
||||
return $username;
|
||||
})
|
||||
/* column email */
|
||||
->addColumn('email', function ($model) {
|
||||
$email = $model->email;
|
||||
|
||||
return $email;
|
||||
})
|
||||
/* column phone */
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext . ' ' . $model->phone_number;
|
||||
$phone = $model->ext.' '.$model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
$mobile = '';
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone . " " . $mobile;
|
||||
$phone = $phone.' '.$mobile;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
/* column account status */
|
||||
@@ -110,6 +118,7 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
/* column ban status */
|
||||
@@ -120,25 +129,29 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
/* column last login date */
|
||||
->addColumn('lastlogin', function ($model) {
|
||||
$t = $model->updated_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* column actions */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>';
|
||||
return '<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
|
||||
})
|
||||
->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new users.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -148,11 +161,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created users in storage.
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function store(User $user, Sys_userRequest $request) {
|
||||
public function store(User $user, Sys_userRequest $request)
|
||||
{
|
||||
/* insert the input request to sys_user table */
|
||||
/* Check whether function success or not */
|
||||
$user->email = $request->input('email');
|
||||
@@ -175,14 +191,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified users.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
public function show($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -191,14 +211,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
public function edit($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -207,12 +231,15 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified user in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
public function update($id, User $user, Sys_userUpdate $request)
|
||||
{
|
||||
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -229,10 +256,12 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get agent profile page
|
||||
* get agent profile page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||
@@ -242,10 +271,12 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile edit page
|
||||
* get profile edit page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
$user = Auth::user();
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
@@ -255,12 +286,15 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile edit
|
||||
* @param type int $id
|
||||
* post profile edit.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function postProfileedit(ProfileRequest $request) {
|
||||
public function postProfileedit(ProfileRequest $request)
|
||||
{
|
||||
// geet authenticated user details
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
@@ -284,7 +318,7 @@ class UserController extends Controller {
|
||||
// fetching upload destination path
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
// adding a random value to profile picture filename
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
// moving the picture to a destination folder
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
// saving filename to database
|
||||
@@ -292,6 +326,7 @@ class UserController extends Controller {
|
||||
} else {
|
||||
try {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('profile')->with('success', $e->errorInfo[2]);
|
||||
@@ -303,19 +338,23 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile password
|
||||
* @param type int $id
|
||||
* Post profile password.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
// get authenticated user
|
||||
public function postProfilePassword($id, ProfilePassword $request)
|
||||
{
|
||||
// get authenticated user
|
||||
$user = Auth::user();
|
||||
// checking if the old password matches the new password
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
try {
|
||||
$user->save();
|
||||
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
|
||||
@@ -326,25 +365,32 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigning an user to an organization
|
||||
* @param type $id
|
||||
* Assigning an user to an organization.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function UserAssignOrg($id) {
|
||||
public function UserAssignOrg($id)
|
||||
{
|
||||
$org = Input::get('org');
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* creating an organization in user profile page via modal popup
|
||||
* @param type $id
|
||||
* creating an organization in user profile page via modal popup.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
public function User_Create_Org($id)
|
||||
{
|
||||
// checking if the entered value for website is available in database
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
@@ -356,14 +402,14 @@ class UserController extends Controller {
|
||||
$check2 = Organization::where('name', '=', Input::get('name'))->first();
|
||||
// if any of the fields is not available then return false
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
return 'Name is required';
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
return 'Name should be Unique';
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
return 'Website should be Unique';
|
||||
} else {
|
||||
// storing organization details and assigning the current user to that organization
|
||||
$org = new Organization;
|
||||
$org = new Organization();
|
||||
$org->name = Input::get('name');
|
||||
$org->phone = Input::get('phone');
|
||||
$org->website = Input::get('website');
|
||||
@@ -371,7 +417,7 @@ class UserController extends Controller {
|
||||
$org->internal_notes = Input::get('internal');
|
||||
$org->save();
|
||||
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org->id;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
@@ -379,5 +425,4 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,47 +3,46 @@
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Client\kb\UserController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
// Requests
|
||||
use App\Http\Requests\kb\ArticleRequest;
|
||||
use App\Http\Requests\kb\ArticleUpdate;
|
||||
// Models
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\kb\Comment;
|
||||
// Classes
|
||||
use Auth;
|
||||
use Chumper\Datatable\Table;
|
||||
use Datatable;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ArticleController
|
||||
* This controller is used to CRUD Articles
|
||||
* This controller is used to CRUD Articles.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ArticleController extends Controller {
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -51,16 +50,19 @@ class ArticleController extends Controller {
|
||||
SettingsController::language();
|
||||
}
|
||||
|
||||
public function test() {
|
||||
public function test()
|
||||
{
|
||||
//$table = $this->setDatatable();
|
||||
return view('themes.default1.agent.kb.article.test');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching all the list of articles in a chumper datatable format
|
||||
* Fetching all the list of articles in a chumper datatable format.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
// returns chumper datatable
|
||||
return Datatable::collection(Article::All())
|
||||
/* searcable column name */
|
||||
@@ -74,13 +76,14 @@ class ArticleController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column action */
|
||||
->addColumn('Actions', function ($model) {
|
||||
/* here are all the action buttons and modal popup to delete articles with confirmations */
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href=show/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span> <a href=article/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href=show/'.$model->slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -88,11 +91,11 @@ class ArticleController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
' . $model->name . '
|
||||
'.$model->name.'
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="article/delete/' . $model->slug . '"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="article/delete/'.$model->slug.'"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -102,10 +105,12 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* List of Articles
|
||||
* List of Articles.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
/* show article list */
|
||||
try {
|
||||
return view('themes.default1.agent.kb.article.index');
|
||||
@@ -115,11 +120,14 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creating a Article
|
||||
* Creating a Article.
|
||||
*
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create(Category $category) {
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* get the attributes of the category */
|
||||
$category = $category->lists('id', 'name');
|
||||
/* get the create page */
|
||||
@@ -131,17 +139,20 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the values to the article
|
||||
* @param type Article $article
|
||||
* Insert the values to the article.
|
||||
*
|
||||
* @param type Article $article
|
||||
* @param type ArticleRequest $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function store(Article $article, ArticleRequest $request) {
|
||||
public function store(Article $article, ArticleRequest $request)
|
||||
{
|
||||
// requesting the values to store article data
|
||||
$publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00';
|
||||
$publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
|
||||
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$article->slug = $slug;
|
||||
$article->publish_time = $publishTime;
|
||||
$article->fill($request->except('created_at', 'slug'))->save();
|
||||
@@ -155,21 +166,25 @@ class ArticleController extends Controller {
|
||||
/* insert the values to the article table */
|
||||
try {
|
||||
$article->fill($request->except('slug'))->save();
|
||||
|
||||
return redirect('article')->with('success', 'Article Inserted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('article')->with('fails', 'Article Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('article')->with('fails', 'Article Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an Article by id
|
||||
* @param type Integer $id
|
||||
* @param type Article $article
|
||||
* Edit an Article by id.
|
||||
*
|
||||
* @param type Integer $id
|
||||
* @param type Article $article
|
||||
* @param type Relationship $relation
|
||||
* @param type Category $category
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
public function edit($slug, Article $article, Relationship $relation, Category $category) {
|
||||
public function edit($slug, Article $article, Relationship $relation, Category $category)
|
||||
{
|
||||
$aid = $article->where('id', $slug)->first();
|
||||
$id = $aid->id;
|
||||
/* define the selected fields */
|
||||
@@ -188,20 +203,23 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an Artile by id
|
||||
* @param type Integer $id
|
||||
* @param type Article $article
|
||||
* @param type Relationship $relation
|
||||
* Update an Artile by id.
|
||||
*
|
||||
* @param type Integer $id
|
||||
* @param type Article $article
|
||||
* @param type Relationship $relation
|
||||
* @param type ArticleRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request) {
|
||||
public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request)
|
||||
{
|
||||
$aid = $article->where('id', $slug)->first();
|
||||
$publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00';
|
||||
$publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
|
||||
|
||||
$id = $aid->id;
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
// dd($slug);
|
||||
|
||||
$article->slug = $slug;
|
||||
@@ -221,26 +239,31 @@ class ArticleController extends Controller {
|
||||
$article->slug = $slug;
|
||||
$article->publish_time = $publishTime;
|
||||
$article->save();
|
||||
|
||||
return redirect('article')->with('success', 'Article Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('article')->with('fails', 'Article Not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('article')->with('fails', 'Article Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an Agent by id
|
||||
* @param type $id
|
||||
* Delete an Agent by id.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Article $article
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($slug, Article $article, Relationship $relation, Comment $comment) {
|
||||
public function destroy($slug, Article $article, Relationship $relation, Comment $comment)
|
||||
{
|
||||
/* delete the selected article from the table */
|
||||
$article = $article->where('slug', $slug)->first(); //get the selected article via id
|
||||
$id = $article->id;
|
||||
$comments = $comment->where('article_id', $id)->get();
|
||||
if ($comments) {
|
||||
foreach ($comments as $comment)
|
||||
foreach ($comments as $comment) {
|
||||
$comment->delete();
|
||||
}
|
||||
}
|
||||
// deleting relationship
|
||||
$relation = $relation->where('article_id', $id)->first();
|
||||
@@ -260,11 +283,14 @@ class ArticleController extends Controller {
|
||||
|
||||
/**
|
||||
* user time zone
|
||||
* fetching timezone
|
||||
* fetching timezone.
|
||||
*
|
||||
* @param type $utc
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
static function usertimezone($utc) {
|
||||
public static function usertimezone($utc)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$tz = $user->timezone;
|
||||
$set = Settings::whereId('1')->first();
|
||||
@@ -275,5 +301,4 @@ class ArticleController extends Controller {
|
||||
$date = date($format, strtotime($utc) + $offset);
|
||||
echo $date;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,11 +3,8 @@
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\client\kb\UserController;
|
||||
use App\Http\Controllers\admin\kb\ArticleController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// Requests
|
||||
use App\Http\Requests\kb\CategoryRequest;
|
||||
use App\Http\Requests\kb\CategoryUpdate;
|
||||
@@ -16,28 +13,28 @@ use App\Model\kb\Category;
|
||||
use App\Model\kb\Relationship;
|
||||
// Classes
|
||||
use Datatable;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* CategoryController
|
||||
* This controller is used to CRUD category
|
||||
* This controller is used to CRUD category.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CategoryController extends Controller {
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -46,11 +43,14 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexing all Category
|
||||
* Indexing all Category.
|
||||
*
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
/* get the view of index of the catogorys with all attributes
|
||||
of category model */
|
||||
try {
|
||||
@@ -61,10 +61,12 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* fetching category list in chumper datatables
|
||||
* fetching category list in chumper datatables.
|
||||
*
|
||||
* @return type chumper datatable
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
/* fetching chumper datatables */
|
||||
return Datatable::collection(Category::All())
|
||||
/* search column name */
|
||||
@@ -78,13 +80,14 @@ class CategoryController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column Actions */
|
||||
/* there are action buttons and modal popup to delete a data column */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>' . \Lang::get("lang.delete") . '</button></span> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a> <a href=article-list class="btn btn-primary btn-xs">' . \Lang::get("lang.view") . '</a>
|
||||
<div class="modal fade" id="deletecategory' . $model->slug . '">
|
||||
return '<span data-toggle="modal" data-target="#deletecategory'.$model->slug.'"><a href="#" ><button class="btn btn-danger btn-xs"></a>'.\Lang::get('lang.delete').'</button></span> <a href=category/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href=article-list class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
|
||||
<div class="modal fade" id="deletecategory'.$model->slug.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -92,11 +95,11 @@ class CategoryController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
' . $model->name . '
|
||||
'.$model->name.'
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="category/delete/'.$model->id.'"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -106,11 +109,14 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Category
|
||||
* Create a Category.
|
||||
*
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create(Category $category) {
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* Get the all attributes in the category model */
|
||||
$category = $category->get();
|
||||
/* get the view page to create new category with all attributes
|
||||
@@ -123,32 +129,39 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To store the selected category
|
||||
* @param type Category $category
|
||||
* @param type CategoryRequest $request
|
||||
* To store the selected category.
|
||||
*
|
||||
* @param type Category $category
|
||||
* @param type CategoryRequest $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(Category $category, CategoryRequest $request) {
|
||||
public function store(Category $category, CategoryRequest $request)
|
||||
{
|
||||
/* Get the whole request from the form and insert into table via model */
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$category->slug = $slug;
|
||||
// send success message to index page
|
||||
try {
|
||||
$category->fill($request->except('slug'))->save();
|
||||
|
||||
return Redirect::back()->with('success', 'Category Inserted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return Redirect::back()->with('fails', 'Category Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified category.
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
*
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($slug, Category $category) {
|
||||
public function edit($slug, Category $category)
|
||||
{
|
||||
// fetch the category
|
||||
$cid = $category->where('id', $slug)->first();
|
||||
$id = $cid->id;
|
||||
@@ -160,17 +173,20 @@ class CategoryController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified Category in storage.
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
* @param type CategoryUpdate $request
|
||||
*
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
* @param type CategoryUpdate $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function update($slug, Category $category, CategoryUpdate $request) {
|
||||
public function update($slug, Category $category, CategoryUpdate $request)
|
||||
{
|
||||
|
||||
/* Edit the selected category via id */
|
||||
$category = $category->where('id', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
// dd($slug);
|
||||
$category->slug = $slug;
|
||||
/* update the values at the table via model according with the request */
|
||||
@@ -179,22 +195,25 @@ class CategoryController extends Controller {
|
||||
$category->fill($request->all())->save();
|
||||
$category->slug = $slug;
|
||||
$category->save();
|
||||
|
||||
return redirect('category')->with('success', 'Category Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
//redirect to index with fails message
|
||||
return redirect('category')->with('fails', 'Category Not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('category')->with('fails', 'Category Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified category from storage.
|
||||
* @param type $id
|
||||
* @param type Category $category
|
||||
* @param type Relationship $relation
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Category $category
|
||||
* @param type Relationship $relation
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Category $category, Relationship $relation) {
|
||||
|
||||
public function destroy($id, Category $category, Relationship $relation)
|
||||
{
|
||||
$relation = $relation->where('category_id', $id)->first();
|
||||
if ($relation != null) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted');
|
||||
@@ -204,11 +223,11 @@ class CategoryController extends Controller {
|
||||
// redirect to index with success message
|
||||
try {
|
||||
$category->delete();
|
||||
|
||||
return Redirect::back()->with('success', 'Category Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,41 +2,37 @@
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\client\kb\UserController;
|
||||
use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
// controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
// request
|
||||
use App\Http\Requests\kb\PageRequest;
|
||||
use App\Http\Requests\kb\PageUpdate;
|
||||
use Illuminate\Http\Request;
|
||||
// Model
|
||||
use App\Model\kb\Page;
|
||||
// classes
|
||||
// Model
|
||||
use Datatable;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* PageController
|
||||
* This controller is used to CRUD Pages
|
||||
* This controller is used to CRUD Pages.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PageController extends Controller {
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Page $page) {
|
||||
public function __construct(Page $page)
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -46,10 +42,12 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the list of pages
|
||||
* Display the list of pages.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
$pages = $this->page->paginate(3);
|
||||
$pages->setPath('page');
|
||||
try {
|
||||
@@ -60,10 +58,12 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* fetching pages list in chumper datatables
|
||||
* fetching pages list in chumper datatables.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
/* fetching chumper datatables */
|
||||
return Datatable::collection(Page::All())
|
||||
/* search column name */
|
||||
@@ -77,13 +77,14 @@ class PageController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column Actions */
|
||||
/* there are action buttons and modal popup to delete a data column */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . '</button></span> <a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletepage' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#deletepage'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').'</button></span> <a href=page/'.$model->slug.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href=pages/'.$model->slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
|
||||
<div class="modal fade" id="deletepage'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -91,11 +92,11 @@ class PageController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
' . $model->name . '
|
||||
'.$model->name.'
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="page/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="page/delete/'.$model->id.'"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -106,23 +107,29 @@ class PageController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.agent.kb.pages.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert a value to the table Page
|
||||
* To insert a value to the table Page.
|
||||
*
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function store(PageRequest $request) {
|
||||
public function store(PageRequest $request)
|
||||
{
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
try {
|
||||
$this->page->fill($request->except('slug'))->save();
|
||||
|
||||
return redirect('page')->with('success', 'Page created successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
@@ -130,13 +137,17 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To edit a page
|
||||
* @param type $slug
|
||||
* To edit a page.
|
||||
*
|
||||
* @param type $slug
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($slug) {
|
||||
public function edit($slug)
|
||||
{
|
||||
try {
|
||||
$page = $this->page->where('slug', $slug)->first();
|
||||
|
||||
return view('themes.default1.agent.kb.pages.edit', compact('page'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
@@ -144,21 +155,25 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To update a page
|
||||
* @param type $slug
|
||||
* @param type PageUpdate $request
|
||||
* To update a page.
|
||||
*
|
||||
* @param type $slug
|
||||
* @param type PageUpdate $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function update($slug, PageUpdate $request) {
|
||||
public function update($slug, PageUpdate $request)
|
||||
{
|
||||
// get pages with respect to slug
|
||||
$pages = $this->page->where('slug', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
try {
|
||||
$pages->fill($request->all())->save();
|
||||
$pages->slug = $slug;
|
||||
$pages->save();
|
||||
|
||||
return redirect('page')->with('success', 'Your Page Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
@@ -166,19 +181,22 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To Delete a Page
|
||||
* @param type $id
|
||||
* To Delete a Page.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function destroy($id) {
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
// get the page to be deleted
|
||||
$page = $this->page->whereId($id)->first();
|
||||
$page->delete();
|
||||
|
||||
return redirect('page')->with('success', 'Page Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,54 +2,45 @@
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
// Controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// Request
|
||||
use App\Http\Requests\kb\FooterRequest;
|
||||
use App\Http\Requests\kb\ProfilePassword;
|
||||
use App\Http\Requests\kb\ProfileRequest;
|
||||
use App\Http\Requests\kb\SettingsRequests;
|
||||
use App\Http\Requests\kb\SocialRequest;
|
||||
use Illuminate\Http\Request;
|
||||
// Model
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Faq;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\kb\Side1;
|
||||
use App\Model\kb\Side2;
|
||||
use App\Model\kb\Social;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Utility\Date_format;
|
||||
// Classes
|
||||
// Model
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Settings;
|
||||
use Auth;
|
||||
// Classes
|
||||
use Config;
|
||||
use Datatable;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Image;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
* This controller is used to perform settings in the setting page of knowledgebase
|
||||
* This controller is used to perform settings in the setting page of knowledgebase.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -58,11 +49,12 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* to get the settings page
|
||||
* to get the settings page.
|
||||
*
|
||||
* @return response
|
||||
* @package default
|
||||
*/
|
||||
public function settings(Settings $settings, Timezones $time, Date_format $date) {
|
||||
public function settings(Settings $settings, Timezones $time, Date_format $date)
|
||||
{
|
||||
/* get the setting where the id == 1 */
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$time = $time->get();
|
||||
@@ -73,40 +65,42 @@ class SettingsController extends Controller {
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postSettings($id, Settings $settings, SettingsRequests $request) {
|
||||
public function postSettings($id, Settings $settings, SettingsRequests $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company request */
|
||||
$settings = $settings->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/image';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
//echo $fileName;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
//$thDestinationPath = 'dist/th';
|
||||
Image::make($destinationPath . '/' . $fileName, array(
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
Image::make($destinationPath.'/'.$fileName, [
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
'grayscale' => false,
|
||||
))->save('lb-faveo/dist/image/' . $fileName);
|
||||
])->save('lb-faveo/dist/image/'.$fileName);
|
||||
}
|
||||
if (Input::file('background')) {
|
||||
$name = Input::file('background')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/image';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
echo $fileName;
|
||||
Input::file('background')->move($destinationPath, $fileName);
|
||||
$settings->background = $fileName;
|
||||
//$thDestinationPath = 'dist/th';
|
||||
Image::make($destinationPath . '/' . $fileName, array(
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
Image::make($destinationPath.'/'.$fileName, [
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
'grayscale' => false,
|
||||
))->save('lb-faveo/dist/image/' . $fileName);
|
||||
])->save('lb-faveo/dist/image/'.$fileName);
|
||||
}
|
||||
/* Check whether function success or not */
|
||||
if ($settings->fill($request->except('logo', 'background'))->save() == true) {
|
||||
@@ -123,19 +117,24 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To Moderate the commenting
|
||||
* To Moderate the commenting.
|
||||
*
|
||||
* @param type Comment $comment
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function comment(Comment $comment) {
|
||||
public function comment(Comment $comment)
|
||||
{
|
||||
return view('themes.default1.agent.kb.settings.comment');
|
||||
}
|
||||
|
||||
/**
|
||||
* getdata
|
||||
* @return type
|
||||
* getdata.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
return \Datatable::collection(Comment::All())
|
||||
->searchColumns('name', 'email', 'comment', 'created')
|
||||
->orderColumns('name')
|
||||
@@ -154,67 +153,79 @@ class SettingsController extends Controller {
|
||||
->addColumn('status', function ($model) {
|
||||
$status = $model->status;
|
||||
if ($status == 1) {
|
||||
return '<p style="color:blue"">' . \Lang::get('lang.published');
|
||||
return '<p style="color:blue"">'.\Lang::get('lang.published');
|
||||
} else {
|
||||
return '<p style="color:red"">' . \Lang::get('lang.not_published');
|
||||
return '<p style="color:red"">'.\Lang::get('lang.not_published');
|
||||
}
|
||||
})
|
||||
->addColumn('Created', function ($model) {
|
||||
return TicketController::usertimezone(date($model->created_at));
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<a href=comment/delete/' . $model->id . ' class="btn btn-danger btn-xs">' . \Lang::get('lang.delete') . '</a> <a href=published/' . $model->id . ' class="btn btn-warning btn-xs">' . \Lang::get('lang.publish') . '</a>';
|
||||
return '<a href=comment/delete/'.$model->id.' class="btn btn-danger btn-xs">'.\Lang::get('lang.delete').'</a> <a href=published/'.$model->id.' class="btn btn-warning btn-xs">'.\Lang::get('lang.publish').'</a>';
|
||||
})
|
||||
->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin can publish the comment
|
||||
* @param type $id
|
||||
* Admin can publish the comment.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Comment $comment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function publish($id, Comment $comment) {
|
||||
public function publish($id, Comment $comment)
|
||||
{
|
||||
$comment = $comment->whereId($id)->first();
|
||||
$comment->status = 1;
|
||||
if ($comment->save()) {
|
||||
return redirect('comment')->with('success', $comment->name . '-' . 'Comment Published');
|
||||
return redirect('comment')->with('success', $comment->name.'-'.'Comment Published');
|
||||
} else {
|
||||
return redirect('comment')->with('fails', 'Can not Process');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the comment
|
||||
* @param type $id
|
||||
* delete the comment.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Comment $comment
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function delete($id, Comment $comment) {
|
||||
public function delete($id, Comment $comment)
|
||||
{
|
||||
$comment = $comment->whereId($id)->first();
|
||||
if ($comment->delete()) {
|
||||
return redirect('comment')->with('success', $comment->name . "'s!" . 'Comment Deleted');
|
||||
return redirect('comment')->with('success', $comment->name."'s!".'Comment Deleted');
|
||||
} else {
|
||||
return redirect('comment')->with('fails', 'Can not Process');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile page
|
||||
* get profile page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$time = Timezone::all();
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.kb.settings.profile', compact('user', 'time'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* @param type ProfileRequest $request
|
||||
* Post profile page.
|
||||
*
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
public function postProfile(ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -233,12 +244,13 @@ class SettingsController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$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()) {
|
||||
@@ -249,18 +261,22 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile password
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
* post profile password.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
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();
|
||||
|
||||
return redirect('profile')->with('success2', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('profile')->with('fails2', 'Old password Wrong');
|
||||
@@ -268,14 +284,15 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* het locale for language
|
||||
* het locale for language.
|
||||
*
|
||||
* @return type config set
|
||||
*/
|
||||
static function language() {
|
||||
public static function language()
|
||||
{
|
||||
// $set = Settings::whereId(1)->first();
|
||||
// $lang = $set->language;
|
||||
Config::set('app.locale', 'en');
|
||||
Config::get('app');
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,52 +5,42 @@ namespace App\Http\Controllers\Api\v1;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Form\Form_details;
|
||||
// models
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
// classes
|
||||
use App;
|
||||
use App\User;
|
||||
use Artisan;
|
||||
// classes
|
||||
use Config;
|
||||
use File;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
* |=======================================================================
|
||||
* |=======================================================================.
|
||||
*
|
||||
* Class to perform the first install operation without this the database
|
||||
* settings could not be started
|
||||
*
|
||||
* @package Faveo HELPDESK
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*
|
||||
*/
|
||||
class InstallerApiController extends Controller {
|
||||
|
||||
class InstallerApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* config_database
|
||||
* This function is to configure the database and install the application via API call.
|
||||
*
|
||||
* @return type Json
|
||||
*/
|
||||
public function config_database(Request $request) {
|
||||
public function config_database(Request $request)
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
// Check for pre install
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
|
||||
$default = $request->database;
|
||||
$host = $request->host;
|
||||
$database = $request->databasename;
|
||||
@@ -74,7 +64,7 @@ class InstallerApiController extends Controller {
|
||||
}
|
||||
|
||||
// Write environment file
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
$fp = fopen(base_path().'/.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
@@ -90,9 +80,11 @@ class InstallerApiController extends Controller {
|
||||
/**
|
||||
* config_database
|
||||
* This function is to configure the database and install the application via API call.
|
||||
*
|
||||
* @return type Json
|
||||
*/
|
||||
public function config_system(Request $request) {
|
||||
public function config_system(Request $request)
|
||||
{
|
||||
// Check for pre install
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
$firstname = $request->firstname;
|
||||
@@ -104,8 +96,8 @@ class InstallerApiController extends Controller {
|
||||
$datetime = $request->datetime;
|
||||
|
||||
// Migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
|
||||
// checking requested timezone for the admin and system
|
||||
$timezones = Timezones::where('name', '=', $timezone)->first();
|
||||
@@ -118,7 +110,7 @@ class InstallerApiController extends Controller {
|
||||
return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0'];
|
||||
}
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
$system = new System();
|
||||
$system->status = 1;
|
||||
$system->department = 1;
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
@@ -126,17 +118,17 @@ class InstallerApiController extends Controller {
|
||||
$system->save();
|
||||
|
||||
// Creating user
|
||||
$user = User::create(array(
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
));
|
||||
'primary_dpt' => 1,
|
||||
]);
|
||||
|
||||
// Setting database installed status
|
||||
$value = '1';
|
||||
@@ -149,7 +141,7 @@ class InstallerApiController extends Controller {
|
||||
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
|
||||
$lfmpath = "url('photos').'/'";
|
||||
$path22 = app_path('Http/routes.php');
|
||||
$path23 = app_path('config/lfm.php');
|
||||
$path23 = base_path('config/lfm.php');
|
||||
$content23 = File::get($path22);
|
||||
$content24 = File::get($path23);
|
||||
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
|
||||
@@ -165,5 +157,4 @@ class InstallerApiController extends Controller {
|
||||
return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,26 +2,26 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Exception;
|
||||
|
||||
class TestController extends Controller {
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
public $server;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$server = new Request();
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
$server = parse_url($url);
|
||||
$server["path"] = dirname($server["path"]);
|
||||
$server = parse_url($server["path"]);
|
||||
$server["path"] = dirname($server["path"]);
|
||||
$this->server = "http://" . $_SERVER['HTTP_HOST'] . $server['path'] . "/";
|
||||
$server['path'] = dirname($server['path']);
|
||||
$server = parse_url($server['path']);
|
||||
$server['path'] = dirname($server['path']);
|
||||
$this->server = 'http://'.$_SERVER['HTTP_HOST'].$server['path'].'/';
|
||||
}
|
||||
|
||||
static function callGetApi($url) {
|
||||
public static function callGetApi($url)
|
||||
{
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -31,14 +31,15 @@ class TestController extends Controller {
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:' . curl_error($curl);
|
||||
echo 'error:'.curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
static function callPostApi($url, $data) {
|
||||
public static function callPostApi($url, $data)
|
||||
{
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -49,22 +50,23 @@ class TestController extends Controller {
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:' . curl_error($curl);
|
||||
echo 'error:'.curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function ticketReply() {
|
||||
public function ticketReply()
|
||||
{
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
$data = [
|
||||
|
||||
'ticket_ID' => '1',
|
||||
'ticket_ID' => '1',
|
||||
'reply_content' => 'reply for the ticket id',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
@@ -82,28 +84,30 @@ class TestController extends Controller {
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
$url = $this->server . "helpdesk/reply?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/reply?token='.\Config::get('app.token');
|
||||
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function createTicket() {
|
||||
public function createTicket()
|
||||
{
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
$data = [
|
||||
'user_id' => 1,
|
||||
'subject' => 'Api create via faveo api',
|
||||
'body' => 'Test me when call api',
|
||||
'user_id' => 1,
|
||||
'subject' => 'Api create via faveo api',
|
||||
'body' => 'Test me when call api',
|
||||
'helptopic' => '1',
|
||||
'sla' => '1',
|
||||
'priority' => '1',
|
||||
'headers' => [0 => 'vijaycodename47@gmail.com'],
|
||||
'dept' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
/** if attachment */
|
||||
'sla' => '1',
|
||||
'priority' => '1',
|
||||
'headers' => [0 => 'vijaycodename47@gmail.com'],
|
||||
'dept' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
/* if attachment */
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
@@ -121,281 +125,334 @@ class TestController extends Controller {
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
$url = $this->server . "helpdesk/create?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/create?token='.\Config::get('app.token');
|
||||
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function generateToken() {
|
||||
public function generateToken()
|
||||
{
|
||||
$data = [
|
||||
//'email'=>'vijaycodename47@gmail.com',
|
||||
'username' => 'vijay',
|
||||
'password' => 'manjapra',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
$url = $this->server . "authenticate";
|
||||
$url = $this->server.'authenticate';
|
||||
//dd($url);
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function createUser() {
|
||||
public function createUser()
|
||||
{
|
||||
$data = [
|
||||
'email' => 'vijaycodename@gmail.com',
|
||||
'email' => 'vijaycodename@gmail.com',
|
||||
'password' => 'manjapra',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "register";
|
||||
$url = $this->server.'register';
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getAuthUser() {
|
||||
|
||||
$url = $this->server . "authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getAuthUser()
|
||||
{
|
||||
$url = $this->server.'authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function editTicket() {
|
||||
public function editTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => '13',
|
||||
'subject' => 'Api editing ticket via faveo api',
|
||||
'sla_plan' => '2',
|
||||
'help_topic' => '2',
|
||||
'ticket_source' => '2',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'ticket_id' => '13',
|
||||
'subject' => 'Api editing ticket via faveo api',
|
||||
'sla_plan' => '2',
|
||||
'help_topic' => '2',
|
||||
'ticket_source' => '2',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'ticket_priority' => '2',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/edit?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/edit?token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function deleteTicket() {
|
||||
public function deleteTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => [11],
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/delete?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/delete?token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function openedTickets() {
|
||||
$url = $this->server . "helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function openedTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function unassignedTickets() {
|
||||
public function unassignedTickets()
|
||||
{
|
||||
//dd('dsdf');
|
||||
$url = $this->server . "helpdesk/unassigned?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/unassigned?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
//dd($respose);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function closeTickets() {
|
||||
$url = $this->server . "helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function closeTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getAgents() {
|
||||
$url = $this->server . "helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getAgents()
|
||||
{
|
||||
$url = $this->server.'helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getTeams() {
|
||||
$url = $this->server . "helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTeams()
|
||||
{
|
||||
$url = $this->server.'helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function assignTicket() {
|
||||
public function assignTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => 1,
|
||||
'user' => 'vijay.sebastian@ladybirdweb.com',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'user' => 'vijay.sebastian@ladybirdweb.com',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/assign?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/assign?token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getCustomers() {
|
||||
public function getCustomers()
|
||||
{
|
||||
$search = [
|
||||
'search' => 'vij',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'search' => 'vij',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customers?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$url = $this->server.'helpdesk/customers?token='.\Config::get('app.token');
|
||||
$url = $url.'&'.$data;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getCustomer() {
|
||||
public function getCustomer()
|
||||
{
|
||||
$search = [
|
||||
'user_id' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customer?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$url = $this->server.'helpdesk/customer?token='.\Config::get('app.token');
|
||||
$url = $url.'&'.$data;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getSearch() {
|
||||
public function getSearch()
|
||||
{
|
||||
$search = [
|
||||
'search' => 'api',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'search' => 'api',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-search?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$url = $this->server.'helpdesk/ticket-search?token='.\Config::get('app.token');
|
||||
$url = $url.'&'.$data;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function ticketThreads() {
|
||||
public function ticketThreads()
|
||||
{
|
||||
$search = [
|
||||
'id' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'id' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-thread?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$url = $this->server.'helpdesk/ticket-thread?token='.\Config::get('app.token');
|
||||
$url = $url.'&'.$data;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function url() {
|
||||
public function url()
|
||||
{
|
||||
$search = [
|
||||
'url' => 'http://localhost/faveo-helpdesk-github/public/',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'url' => 'http://localhost/faveo-helpdesk-github/public/',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/url?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$url = $this->server.'helpdesk/url?token='.\Config::get('app.token');
|
||||
$url = $url.'&'.$data;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function generateApiKey() {
|
||||
$url = $this->server . "helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function generateApiKey()
|
||||
{
|
||||
$url = $this->server.'helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getHelpTopic() {
|
||||
$url = $this->server . "helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getHelpTopic()
|
||||
{
|
||||
$url = $this->server.'helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getSlaPlan() {
|
||||
$url = $this->server . "helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getSlaPlan()
|
||||
{
|
||||
$url = $this->server.'helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getPriority() {
|
||||
$url = $this->server . "helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
public function getPriority()
|
||||
{
|
||||
$url = $this->server.'helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getDepartment() {
|
||||
$url = $this->server . "helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getDepartment()
|
||||
{
|
||||
$url = $this->server.'helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getTickets() {
|
||||
$url = $this->server . "helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function inbox() {
|
||||
$url = $this->server . "helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function inbox()
|
||||
{
|
||||
$url = $this->server.'helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function internalNote() {
|
||||
public function internalNote()
|
||||
{
|
||||
$data = [
|
||||
'ticketid' => '1',
|
||||
'userid' => 1,
|
||||
'body' => 'Testing the api internal note',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'userid' => 1,
|
||||
'body' => 'Testing the api internal note',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/internal-note?token=" . \Config::get('app.token');
|
||||
$url = $this->server.'helpdesk/internal-note?token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function trash() {
|
||||
$url = $this->server . "helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
|
||||
public function trash()
|
||||
{
|
||||
$url = $this->server.'helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function myTickets(){
|
||||
try{
|
||||
$url = $this->server . "helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
|
||||
public function myTickets()
|
||||
{
|
||||
try {
|
||||
$url = $this->server.'helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getTicketById(){
|
||||
try{
|
||||
$url = $this->server . "helpdesk/my-tickets?id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
@@ -410,4 +467,5 @@ class TestController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -2,70 +2,72 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use Auth;
|
||||
use Mail;
|
||||
use Input;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Ticket Controller
|
||||
* -----------------------------------------------------------------------------
|
||||
* -----------------------------------------------------------------------------.
|
||||
*
|
||||
*
|
||||
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
|
||||
* @copyright (c) 2016, Ladybird Web Solution
|
||||
* @name Faveo HELPDESK
|
||||
*
|
||||
* @version v1
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TicketController extends Controller {
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
$PhpMailController = new PhpMailController();
|
||||
public function __construct()
|
||||
{
|
||||
$PhpMailController = new PhpMailController();
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Ticket
|
||||
* Create Ticket.
|
||||
*
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '') {
|
||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
|
||||
{
|
||||
try {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||
//dd($max_number);
|
||||
if ($max_number == null) {
|
||||
$ticket_number = "AAAA-9999-9999999";
|
||||
$ticket_number = 'AAAA-9999-9999999';
|
||||
} else {
|
||||
foreach ($max_number as $number) {
|
||||
$ticket_number = $max_number->ticket_number;
|
||||
}
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket = new Tickets();
|
||||
$ticket->ticket_number = $this->ticketNumber($ticket_number);
|
||||
//dd($this->ticketNumber($ticket_number));
|
||||
$ticket->user_id = $user_id;
|
||||
@@ -86,7 +88,7 @@ class TicketController extends Controller {
|
||||
foreach ($form_data as $key => $form_details) {
|
||||
foreach ($forms as $from) {
|
||||
if ($from->name == $key) {
|
||||
$form_value = new Ticket_Form_Data;
|
||||
$form_value = new Ticket_Form_Data();
|
||||
$form_value->ticket_id = $id;
|
||||
$form_value->title = $from->label;
|
||||
$form_value->content = $form_details;
|
||||
@@ -96,27 +98,30 @@ class TicketController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->storeCollaborators($headers, $id);
|
||||
|
||||
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
||||
if (!empty($attach)) {
|
||||
$this->attach($thread, $attach);
|
||||
}
|
||||
|
||||
return $thread;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* store_collaborators
|
||||
* @param type $headers
|
||||
* store_collaborators.
|
||||
*
|
||||
* @param type $headers
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function storeCollaborators($headers, $id) {
|
||||
public function storeCollaborators($headers, $id)
|
||||
{
|
||||
try {
|
||||
$company = $this->company();
|
||||
if (isset($headers)) {
|
||||
@@ -124,11 +129,11 @@ class TicketController extends Controller {
|
||||
$name = $name;
|
||||
$email = $email;
|
||||
if ($this->checkEmail($email) == false) {
|
||||
$create_user = new User;
|
||||
$create_user = new User();
|
||||
$create_user->user_name = $name;
|
||||
$create_user->email = $email;
|
||||
$create_user->active = 1;
|
||||
$create_user->role = "user";
|
||||
$create_user->role = 'user';
|
||||
$password = $this->generateRandomString();
|
||||
$create_user->password = Hash::make($password);
|
||||
$create_user->save();
|
||||
@@ -138,19 +143,19 @@ class TicketController extends Controller {
|
||||
// });
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||
|
||||
} else {
|
||||
$user = $this->checkEmail($email);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
$collaborator_store = new Ticket_Collaborator;
|
||||
$collaborator_store = new Ticket_Collaborator();
|
||||
$collaborator_store->isactive = 1;
|
||||
$collaborator_store->ticket_id = $id;
|
||||
$collaborator_store->user_id = $user_id;
|
||||
$collaborator_store->role = "ccc";
|
||||
$collaborator_store->role = 'ccc';
|
||||
$collaborator_store->save();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -158,22 +163,26 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Ticket Thread
|
||||
* Generate Ticket Thread.
|
||||
*
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ticketThread($subject, $body, $id, $user_id) {
|
||||
public function ticketThread($subject, $body, $id, $user_id)
|
||||
{
|
||||
try {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->user_id = $user_id;
|
||||
$thread->ticket_id = $id;
|
||||
$thread->poster = 'client';
|
||||
$thread->title = $subject;
|
||||
$thread->body = $body;
|
||||
$thread->save();
|
||||
|
||||
return $thread->id;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -181,11 +190,14 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Ticket Number
|
||||
* Generates Ticket Number.
|
||||
*
|
||||
* @param type $ticket_number
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticketNumber($ticket_number) {
|
||||
public function ticketNumber($ticket_number)
|
||||
{
|
||||
try {
|
||||
//dd($ticket_number);
|
||||
$number = $ticket_number;
|
||||
@@ -207,21 +219,26 @@ class TicketController extends Controller {
|
||||
$number3++;
|
||||
$number2 = sprintf('%04s', $number2);
|
||||
$number3 = sprintf('%07s', $number3);
|
||||
$array = array($number1, $number2, $number3);
|
||||
$array = [$number1, $number2, $number3];
|
||||
$number = implode('-', $array);
|
||||
|
||||
return $number;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* Generate a random string for password.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
public function generateRandomString($length = 10)
|
||||
{
|
||||
try {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
@@ -229,6 +246,7 @@ class TicketController extends Controller {
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -236,14 +254,16 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Replying a ticket
|
||||
* Replying a ticket.
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function reply($thread, $request, $ta, $attach = '') {
|
||||
public function reply($thread, $request, $ta, $attach = '')
|
||||
{
|
||||
try {
|
||||
|
||||
$check_attachment = null;
|
||||
$eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first();
|
||||
$eventuserid = $eventthread->user_id;
|
||||
@@ -266,11 +286,11 @@ class TicketController extends Controller {
|
||||
if ($tickets->assigned_to == 0) {
|
||||
$tickets->assigned_to = Auth::user()->id;
|
||||
$tickets->save();
|
||||
$thread2 = New Ticket_Thread;
|
||||
$thread2 = new Ticket_Thread();
|
||||
$thread2->ticket_id = $thread->ticket_id;
|
||||
$thread2->user_id = Auth::user()->id;
|
||||
$thread2->is_internal = 1;
|
||||
$thread2->body = "This Ticket have been assigned to " . Auth::user()->first_name . " " . Auth::user()->last_name;
|
||||
$thread2->body = 'This Ticket have been assigned to '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||
$thread2->save();
|
||||
}
|
||||
if ($tickets->status > 1) {
|
||||
@@ -280,7 +300,6 @@ class TicketController extends Controller {
|
||||
}
|
||||
$thread->save();
|
||||
|
||||
|
||||
if (!empty($attach)) {
|
||||
$check_attachment = $this->attach($thread->id, $attach);
|
||||
}
|
||||
@@ -313,22 +332,20 @@ class TicketController extends Controller {
|
||||
// }, true);
|
||||
|
||||
try {
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
|
||||
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
|
||||
foreach ($collaborators as $collaborator) {
|
||||
//mail to collaborators
|
||||
$collab_user_id = $collaborator->user_id;
|
||||
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
|
||||
$collab_email = $user_id_collab->email;
|
||||
if ($user_id_collab->role == "user") {
|
||||
if ($user_id_collab->role == 'user') {
|
||||
$collab_user_name = $user_id_collab->user_name;
|
||||
} else {
|
||||
$collab_user_name = $user_id_collab->first_name . " " . $user_id_collab->last_name;
|
||||
$collab_user_name = $user_id_collab->first_name.' '.$user_id_collab->last_name;
|
||||
}
|
||||
// Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) {
|
||||
// $message->to($collab_email, $collab_user_name)->subject($ticket_subject . '[#' . $ticket_number . ']');
|
||||
@@ -341,13 +358,11 @@ try {
|
||||
// }, true);
|
||||
|
||||
try {
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
return $thread;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -355,17 +370,20 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* company
|
||||
* company.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
try {
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -373,25 +391,28 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticket edit and save ticket data
|
||||
* @param type $ticket_id
|
||||
* Ticket edit and save ticket data.
|
||||
*
|
||||
* @param type $ticket_id
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket) {
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket)
|
||||
{
|
||||
try {
|
||||
|
||||
$ticket = $ticket->where('id', '=', $ticket_id)->first();
|
||||
|
||||
$ticket->sla = Input::get("sla_plan");
|
||||
$ticket->help_topic_id = Input::get("help_topic");
|
||||
$ticket->source = Input::get("ticket_source");
|
||||
$ticket->priority_id = Input::get("ticket_priority");
|
||||
$ticket->sla = Input::get('sla_plan');
|
||||
$ticket->help_topic_id = Input::get('help_topic');
|
||||
$ticket->source = Input::get('ticket_source');
|
||||
$ticket->priority_id = Input::get('ticket_priority');
|
||||
$ticket->save();
|
||||
|
||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||
$threads->title = Input::get("subject");
|
||||
$threads->title = Input::get('subject');
|
||||
$threads->save();
|
||||
|
||||
return $threads;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -399,11 +420,14 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* function to assign ticket
|
||||
* function to assign ticket.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function assign($id) {
|
||||
public function assign($id)
|
||||
{
|
||||
try {
|
||||
$UserEmail = Input::get('user');
|
||||
//dd($UserEmail);
|
||||
@@ -425,11 +449,11 @@ try {
|
||||
return ['error' => 'No thread not found'];
|
||||
}
|
||||
$ticket_subject = $ticket_thread->title;
|
||||
$thread = New Ticket_Thread;
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->ticket_id = $ticket->id;
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->is_internal = 1;
|
||||
$thread->body = "This Ticket has been assigned to " . $user->first_name . " " . $user->last_name;
|
||||
$thread->body = 'This Ticket has been assigned to '.$user->first_name.' '.$user->last_name;
|
||||
$thread->save();
|
||||
|
||||
$company = $this->company();
|
||||
@@ -438,7 +462,7 @@ try {
|
||||
$agent = $user->first_name;
|
||||
$agent_email = $user->email;
|
||||
|
||||
$master = Auth::user()->first_name . " " . Auth::user()->last_name;
|
||||
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||
if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) {
|
||||
// // ticket assigned send mail
|
||||
// Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) {
|
||||
@@ -446,13 +470,10 @@ try {
|
||||
// });
|
||||
|
||||
try {
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject . '[#' . $ticket_number . ']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]);
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]);
|
||||
} catch (\Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -462,13 +483,15 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete ticket
|
||||
* @param type $id
|
||||
* Function to delete ticket.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function delete($ids, $ticket) {
|
||||
|
||||
public function delete($ids, $ticket)
|
||||
{
|
||||
try {
|
||||
foreach ($ids as $id) {
|
||||
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
||||
@@ -496,29 +519,33 @@ try {
|
||||
$ticket_delete->status = 5;
|
||||
$ticket_delete->save();
|
||||
$ticket_status_message = Ticket_Status::where('id', '=', $ticket_delete->status)->first();
|
||||
$thread = New Ticket_Thread;
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->ticket_id = $ticket_delete->id;
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->is_internal = 1;
|
||||
$thread->body = $ticket_status_message->message . " " . Auth::user()->first_name . " " . Auth::user()->last_name;
|
||||
$thread->body = $ticket_status_message->message.' '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||
$thread->save();
|
||||
}
|
||||
} else {
|
||||
return "ticket not found";
|
||||
return 'ticket not found';
|
||||
}
|
||||
}
|
||||
return "your tickets has been deleted";
|
||||
|
||||
return 'your tickets has been deleted';
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check email for dublicate entry
|
||||
* check email for dublicate entry.
|
||||
*
|
||||
* @param type $email
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function checkEmail($email) {
|
||||
public function checkEmail($email)
|
||||
{
|
||||
try {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
@@ -532,17 +559,20 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* system
|
||||
* system.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function system() {
|
||||
public function system()
|
||||
{
|
||||
try {
|
||||
$system = System::Where('id', '=', '1')->first();
|
||||
if ($system->name == null) {
|
||||
$system = "Support Center";
|
||||
$system = 'Support Center';
|
||||
} else {
|
||||
$system = $system->name;
|
||||
}
|
||||
|
||||
return $system;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -550,22 +580,25 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Attachment
|
||||
* Create Attachment.
|
||||
*
|
||||
* @param type $thread
|
||||
* @param type $attach
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function attach($thread, $attach) {
|
||||
public function attach($thread, $attach)
|
||||
{
|
||||
try {
|
||||
$ta = new Ticket_attachments();
|
||||
foreach ($attach as $file) {
|
||||
$ta->create(['thread_id' => $thread, 'name' => $file['name'], 'size' => $file['size'], 'type' => $file['type'], 'file' => $file['file'], 'poster' => 'ATTACHMENT']);
|
||||
}
|
||||
$ta->create(['thread_id' => $thread, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']);
|
||||
|
||||
return 1;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,39 +3,40 @@
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use JWTAuth;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Token authenticate Controller
|
||||
* -----------------------------------------------------------------------------
|
||||
* -----------------------------------------------------------------------------.
|
||||
*
|
||||
*
|
||||
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
|
||||
* @copyright (c) 2016, Ladybird Web Solution
|
||||
* @name Faveo HELPDESK
|
||||
*
|
||||
* @version v1
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TokenAuthController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class TokenAuthController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('api');
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticating user with username and password and retuen token
|
||||
* Authenticating user with username and password and retuen token.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function authenticate(Request $request) {
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$usernameinput = $request->input('username');
|
||||
$password = $request->input('password');
|
||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||
@@ -50,6 +51,7 @@ class TokenAuthController extends Controller {
|
||||
return response()->json(['error' => 'could_not_create_token', 500]);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
@@ -58,27 +60,26 @@ class TokenAuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user details from token
|
||||
* Get the user details from token.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function getAuthenticatedUser() {
|
||||
public function getAuthenticatedUser()
|
||||
{
|
||||
//dd(JWTAuth::parseToken()->authenticate());
|
||||
try {
|
||||
|
||||
if (!$user = JWTAuth::parseToken()->authenticate()) {
|
||||
return response()->json(['user_not_found', 404]);
|
||||
}
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
|
||||
|
||||
return response()->json(['token_expired', $e->getStatusCode()]);
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
|
||||
|
||||
return response()->json(['token_invalid', $e->getStatusCode()]);
|
||||
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
|
||||
|
||||
return response()->json(['token_absent', $e->getStatusCode()]);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
//dd($user);
|
||||
@@ -86,18 +87,22 @@ class TokenAuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a user with username and password
|
||||
* Register a user with username and password.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function register(Request $request) {
|
||||
public function register(Request $request)
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$newuser = $request->all();
|
||||
@@ -108,30 +113,34 @@ class TokenAuthController extends Controller {
|
||||
return User::create($newuser);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verify the url is existing or not
|
||||
* verify the url is existing or not.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function checkUrl() {
|
||||
public function checkUrl()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'url' => 'required|url'
|
||||
'url' => 'required|url',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url . '/api/v1/helpdesk/check-url';
|
||||
$url = $url.'/api/v1/helpdesk/check-url';
|
||||
} catch (Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,21 +3,20 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\LoginRequest;
|
||||
use App\Http\Requests\helpdesk\RegisterRequest;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
@@ -27,12 +26,10 @@ use Exception;
|
||||
* authentication of existing users. By default, this controller uses
|
||||
* a simple trait to add these behaviors. Why don't you explore it?
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
|
||||
@@ -47,11 +44,13 @@ class AuthController extends Controller {
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController) {
|
||||
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->auth = $auth;
|
||||
@@ -60,17 +59,19 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the form for registration
|
||||
* Get the form for registration.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getRegister() {
|
||||
public function getRegister()
|
||||
{
|
||||
// Event for login
|
||||
\Event::fire(new \App\Events\FormRegisterEvent());
|
||||
if (Auth::user()) {
|
||||
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
// return view('auth.register');
|
||||
} elseif (Auth::user()->role == 'user') {
|
||||
// return view('auth.register');
|
||||
}
|
||||
} else {
|
||||
return view('auth.register');
|
||||
@@ -78,12 +79,15 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post registration form
|
||||
* @param type User $user
|
||||
* Post registration form.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type RegisterRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postRegister(User $user, RegisterRequest $request) {
|
||||
public function postRegister(User $user, RegisterRequest $request)
|
||||
{
|
||||
// Event for login
|
||||
\Event::fire(new \App\Events\LoginEvent($request));
|
||||
|
||||
@@ -105,24 +109,26 @@ class AuthController extends Controller {
|
||||
// $message->to($user->email, $user->full_name)->subject('active your account');
|
||||
// });
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('password/reset/' . $code)]);
|
||||
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('password/reset/'.$code)]);
|
||||
|
||||
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail function
|
||||
* @param type $token
|
||||
* Get mail function.
|
||||
*
|
||||
* @param type $token
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMail($token, User $user) {
|
||||
public function getMail($token, User $user)
|
||||
{
|
||||
$user = $user->where('remember_token', $token)->where('active', 0)->first();
|
||||
if ($user) {
|
||||
$user->active = 1;
|
||||
$user->save();
|
||||
|
||||
return redirect('auth/login');
|
||||
} else {
|
||||
return redirect('auth/login');
|
||||
@@ -130,14 +136,16 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get login page
|
||||
* Get login page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getLogin() {
|
||||
public function getLogin()
|
||||
{
|
||||
if (Auth::user()) {
|
||||
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
} elseif (Auth::user()->role == 'user') {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
} else {
|
||||
@@ -146,11 +154,14 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post of login page
|
||||
* Post of login page.
|
||||
*
|
||||
* @param type LoginRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postLogin(LoginRequest $request) {
|
||||
public function postLogin(LoginRequest $request)
|
||||
{
|
||||
// Set login attempts and login time
|
||||
$loginAttempts = 1;
|
||||
$usernameinput = $request->input('email');
|
||||
@@ -186,21 +197,23 @@ class AuthController extends Controller {
|
||||
return redirect()->intended($this->redirectPath());
|
||||
}
|
||||
}
|
||||
|
||||
return redirect($this->loginPath())
|
||||
->withInput($request->only('email', 'remember'))
|
||||
->withErrors([
|
||||
'email' => $this->getFailedLoginMessage(),
|
||||
'email' => $this->getFailedLoginMessage(),
|
||||
'password' => $this->getFailedLoginMessage(),
|
||||
]);
|
||||
// Increment login attempts
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Failed login message
|
||||
* Get Failed login message.
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
protected function getFailedLoginMessage() {
|
||||
protected function getFailedLoginMessage()
|
||||
{
|
||||
return 'This Field do not match our records.';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,39 +3,37 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use Illuminate\Http\Request;
|
||||
// model
|
||||
use App\User;
|
||||
// classes
|
||||
// model
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
// classes
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* PasswordController
|
||||
* PasswordController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PasswordController extends Controller {
|
||||
|
||||
class PasswordController extends Controller
|
||||
{
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Create a new password controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController) {
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
@@ -48,7 +46,8 @@ class PasswordController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getEmail() {
|
||||
public function getEmail()
|
||||
{
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
@@ -57,7 +56,8 @@ class PasswordController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postEmail(Request $request) {
|
||||
public function postEmail(Request $request)
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
$user = User::where('email', '=', $request->only('email'))->first();
|
||||
@@ -67,7 +67,6 @@ class PasswordController extends Controller {
|
||||
$code = str_random(60);
|
||||
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first();
|
||||
if (isset($password_reset_table)) {
|
||||
|
||||
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]);
|
||||
// $password_reset_table->token = $code;
|
||||
// $password_reset_table->update(['token' => $code]);
|
||||
@@ -75,12 +74,11 @@ class PasswordController extends Controller {
|
||||
$create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]);
|
||||
}
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/' . $code)]);
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/'.$code)]);
|
||||
|
||||
return redirect()->back()->with('status', 'We have e-mailed your password reset link!');
|
||||
} else {
|
||||
return redirect()->back()->with('errors', "We can't find a user with that e-mail address.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,24 +32,23 @@ use Input;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
* UserController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
// $this->middleware('roles');
|
||||
@@ -57,10 +56,13 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
return view('themes.default1.agent.helpdesk.user.index');
|
||||
@@ -70,11 +72,12 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to display the list of users
|
||||
* This function is used to display the list of users.
|
||||
*
|
||||
* @return datatable
|
||||
*/
|
||||
public function user_list() {
|
||||
|
||||
public function user_list()
|
||||
{
|
||||
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
|
||||
->searchColumns('user_name')
|
||||
->orderColumns('user_name', 'email')
|
||||
@@ -83,18 +86,20 @@ class UserController extends Controller {
|
||||
})
|
||||
->addColumn('email', function ($model) {
|
||||
$email = $model->email;
|
||||
|
||||
return $email;
|
||||
})
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext . ' ' . $model->phone_number;
|
||||
$phone = $model->ext.' '.$model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
$mobile = '';
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone . " " . $mobile;
|
||||
$phone = $phone.' '.$mobile;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
->addColumn('status', function ($model) {
|
||||
@@ -104,17 +109,19 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
->addColumn('lastlogin', function ($model) {
|
||||
$t = $model->updated_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a> <a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a> <a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
|
||||
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a> <a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span> <a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -122,11 +129,11 @@ class UserController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
' . $model->user_name . '
|
||||
'.$model->user_name.'
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="' . route('user.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="'.route('user.delete', $model->id).'"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -137,9 +144,11 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -149,11 +158,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, Sys_userRequest $request) {
|
||||
public function store(User $user, Sys_userRequest $request)
|
||||
{
|
||||
try {
|
||||
/* insert the input request to sys_user table */
|
||||
/* Check whether function success or not */
|
||||
@@ -180,14 +192,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
public function show($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -196,14 +212,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
public function edit($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -212,12 +232,15 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
public function update($id, User $user, Sys_userUpdate $request)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -238,11 +261,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user) {
|
||||
public function destroy($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -262,30 +288,39 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile page
|
||||
* get profile page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile edit page
|
||||
* get profile edit page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile page
|
||||
* @param type int $id
|
||||
* post profile page.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfileedit(ProfileRequest $request) {
|
||||
public function postProfileedit(ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -304,12 +339,13 @@ class UserController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$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::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -318,17 +354,21 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile password
|
||||
* @param type int $id
|
||||
* Post profile password.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
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();
|
||||
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
|
||||
@@ -336,25 +376,30 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* User Assign Org
|
||||
* @param type $id
|
||||
* User Assign Org.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function UserAssignOrg($id) {
|
||||
public function UserAssignOrg($id)
|
||||
{
|
||||
$org = Input::get('org');
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* user create organisation
|
||||
* user create organisation.
|
||||
*
|
||||
* @return type value
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
|
||||
public function User_Create_Org($id)
|
||||
{
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
$check = Organization::where('website', '=', Input::get('website'))->first();
|
||||
@@ -366,13 +411,13 @@ class UserController extends Controller {
|
||||
$check2 = Organization::where('name', '=', Input::get('name'))->first();
|
||||
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
return 'Name is required';
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
return 'Name should be Unique';
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
return 'Website should be Unique';
|
||||
} else {
|
||||
$org = new Organization;
|
||||
$org = new Organization();
|
||||
$org->name = Input::get('name');
|
||||
$org->phone = Input::get('phone');
|
||||
$org->website = Input::get('website');
|
||||
@@ -380,7 +425,7 @@ class UserController extends Controller {
|
||||
$org->internal_notes = Input::get('internal');
|
||||
$org->save();
|
||||
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org->id;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
@@ -388,5 +433,4 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,70 +3,60 @@
|
||||
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;
|
||||
use App\Http\Controllers\Controller;
|
||||
// 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;
|
||||
// models
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
* TicketController2.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientTicketController extends Controller {
|
||||
|
||||
class ClientTicketController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
SettingsController::smtp();
|
||||
// $this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* Get Checked ticket.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
public function getCheckTicket(Tickets $ticket, User $user)
|
||||
{
|
||||
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request) {
|
||||
public function reply($id, Request $request)
|
||||
{
|
||||
$comment = $request->input('comment');
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
@@ -74,14 +64,15 @@ class ClientTicketController extends Controller {
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$threads = new Ticket_Thread;
|
||||
$threads = new Ticket_Thread();
|
||||
$threads->user_id = Auth::user()->id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
@@ -90,5 +81,4 @@ class ClientTicketController extends Controller {
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,45 +7,47 @@ use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* EmailController
|
||||
* EmailController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
class EmailController extends Controller
|
||||
{
|
||||
/**
|
||||
* post port
|
||||
* post port.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port() {
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id', '=', '1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
|
||||
return $portvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post host
|
||||
* post host.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host() {
|
||||
public static function host()
|
||||
{
|
||||
$host = Option::where('option_name', '=', 'host')->first();
|
||||
$hostvalue = $host->option_value;
|
||||
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post username
|
||||
* post username.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username() {
|
||||
public static function username()
|
||||
{
|
||||
$username = Option::where('option_name', '=', 'username')->first();
|
||||
$uservalue = $username->option_value;
|
||||
|
||||
@@ -53,11 +55,12 @@ class OuthouseController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post passowrd
|
||||
* post passowrd.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password() {
|
||||
public static function password()
|
||||
{
|
||||
$password = Option::where('option_name', '=', 'password')->first();
|
||||
$passvalue = $password->option_value;
|
||||
|
||||
@@ -65,15 +68,15 @@ class OuthouseController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post encryption
|
||||
* post encryption.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption() {
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption = Option::where('option_name', '=', 'encryption')->first();
|
||||
$encryptvalue = $encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,51 +3,44 @@
|
||||
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;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
// models
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
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\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Form_value;
|
||||
use Exception;
|
||||
// classes
|
||||
use Form;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Redirect;
|
||||
use Config;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
* FormController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Constructor to check
|
||||
* Constructor to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
public function __construct(TicketController $TicketController)
|
||||
{
|
||||
// mail smtp settings
|
||||
SettingsController::smtp();
|
||||
// creating a TicketController instance
|
||||
@@ -55,16 +48,20 @@ class FormController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* getform
|
||||
* @param type Help_topic $topic
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
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');
|
||||
@@ -72,64 +69,68 @@ class FormController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function to post the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* 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, Help_topic $topic) {
|
||||
public function postForm($id, 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) {
|
||||
}
|
||||
if ($values) {
|
||||
foreach ($values as $value) {
|
||||
if ($value->type == "select") {
|
||||
if ($value->type == 'select') {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach ($value as $option) {
|
||||
echo '<option>' . $option . '</option>';
|
||||
echo '<option>'.$option.'</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == "radio") {
|
||||
} 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") {
|
||||
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>';
|
||||
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>';
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif ($value->type == "checkbox") {
|
||||
} 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>';
|
||||
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>';
|
||||
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* Posted form.
|
||||
*
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source) {
|
||||
|
||||
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');
|
||||
@@ -157,26 +158,30 @@ class FormController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
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 = new Ticket_Thread();
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$threads->user_id = $tickets->user_id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
@@ -185,5 +190,4 @@ class FormController extends Controller {
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
@@ -13,31 +13,31 @@ 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\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
* GuestController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
class GuestController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
@@ -45,21 +45,27 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* @param type $id
|
||||
* Save profile data.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
public function postProfile(ProfileRequest $request)
|
||||
{
|
||||
$user = User::where('id', '=', Auth::user()->id)->first();
|
||||
$user->gender = $request->get('gender');
|
||||
$user->save();
|
||||
@@ -78,12 +84,13 @@ class GuestController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/media/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$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()) {
|
||||
@@ -92,26 +99,34 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page
|
||||
* Get Ticket page.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic) {
|
||||
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
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
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');
|
||||
@@ -119,24 +134,30 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get my ticket
|
||||
* @param type Tickets $tickets
|
||||
* Get my ticket.
|
||||
*
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket() {
|
||||
public function getMyticket()
|
||||
{
|
||||
return view('themes.default1.client.helpdesk.mytickets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ticket-thread
|
||||
* Get ticket-thread.
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) {
|
||||
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 */
|
||||
@@ -149,26 +170,31 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket Edit
|
||||
* ticket Edit.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
|
||||
public function ticketEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* @param type $id
|
||||
* Post porfile password.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword(ProfilePassword $request) {
|
||||
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'));
|
||||
try {
|
||||
$user->save();
|
||||
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails2', $e->errorInfo[2]);
|
||||
@@ -179,12 +205,15 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticekt reply
|
||||
* Ticekt reply.
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
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;
|
||||
@@ -194,29 +223,35 @@ class GuestController extends Controller {
|
||||
$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);
|
||||
|
||||
return Redirect('thread/'.$ticket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* Get Checked ticket.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
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
|
||||
* 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() {
|
||||
|
||||
public function PostCheckTicket()
|
||||
{
|
||||
$Email = \Input::get('email');
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
@@ -230,7 +265,7 @@ class GuestController extends Controller {
|
||||
if ($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name . " " . $user->last_name;
|
||||
$username = $user->first_name.' '.$user->last_name;
|
||||
}
|
||||
|
||||
if ($user->email != $Email) {
|
||||
@@ -242,7 +277,7 @@ class GuestController extends Controller {
|
||||
$company = $this->company();
|
||||
|
||||
$this->PhpMailController->sendmail(
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user->email], $message = ['subject' => 'Ticket link Request [' . $Ticket_number . ']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => \URL::route('check_ticket', $code)]
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user->email], $message = ['subject' => 'Ticket link Request ['.$Ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => \URL::route('check_ticket', $code)]
|
||||
);
|
||||
|
||||
return \Redirect::back()
|
||||
@@ -252,36 +287,45 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket email
|
||||
* @param type $id
|
||||
* get ticket email.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id) {
|
||||
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
|
||||
* get ticket status.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getTicketStat(Tickets $ticket) {
|
||||
public function getTicketStat(Tickets $ticket)
|
||||
{
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get company
|
||||
* get company.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,23 +9,21 @@ use App\Model\helpdesk\Settings\System;
|
||||
// classes
|
||||
use Config;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
* OuthouseController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomepageController extends Controller {
|
||||
|
||||
class WelcomepageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
public function get(System $note)
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
@@ -33,14 +31,16 @@ class WelcomepageController extends Controller {
|
||||
foreach ($notes as $note) {
|
||||
$content = $note->content;
|
||||
}
|
||||
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ 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\Http\Requests\kb\SearchRequest;
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Comment;
|
||||
@@ -15,18 +15,18 @@ use App\Model\kb\Faq;
|
||||
use App\Model\kb\Page;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use Config;
|
||||
use Auth;
|
||||
// use Creativeorange\Gravatar\Gravatar;
|
||||
use Config;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Redirect;
|
||||
use Hash;
|
||||
use Exception;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//$this->middleware('auth');
|
||||
//SettingsController::language();
|
||||
// $this->port();
|
||||
@@ -38,11 +38,11 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* @return response
|
||||
* @package default
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
// $article = $article->where('status', '1');
|
||||
@@ -56,14 +56,16 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get excerpt from string
|
||||
* 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
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
*
|
||||
* @return string excerpt
|
||||
*/
|
||||
static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
|
||||
{
|
||||
if (strlen($str) > $maxLength) {
|
||||
$excerpt = substr($str, $startPos, $maxLength - 3);
|
||||
$lastSpace = strrpos($excerpt, ' ');
|
||||
@@ -76,7 +78,8 @@ class UserController extends Controller {
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
|
||||
{
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
$search = $request->input('s');
|
||||
@@ -84,14 +87,17 @@ class UserController extends Controller {
|
||||
$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
|
||||
* to show the seleted article.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function show($slug, Article $article, Category $category) {
|
||||
public function show($slug, Article $article, Category $category)
|
||||
{
|
||||
//ArticleController::timezone();
|
||||
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
|
||||
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
|
||||
@@ -105,7 +111,8 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
|
||||
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;
|
||||
@@ -118,7 +125,8 @@ class UserController extends Controller {
|
||||
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
|
||||
}
|
||||
|
||||
public function home(Article $article, Category $category, Relationship $relation) {
|
||||
public function home(Article $article, Category $category, Relationship $relation)
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return redirect('step1');
|
||||
} else {
|
||||
@@ -130,27 +138,34 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function Faq(Faq $faq, Category $category) {
|
||||
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
|
||||
* get the contact page for user.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function contact(Category $category, Settings $settings) {
|
||||
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
|
||||
* send message to the mail adderess that define in the system.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function postContact(ContactRequest $request, Contact $contact) {
|
||||
public function postContact(ContactRequest $request, Contact $contact)
|
||||
{
|
||||
$this->port();
|
||||
$this->host();
|
||||
$this->encryption();
|
||||
@@ -167,7 +182,7 @@ class UserController extends Controller {
|
||||
$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) {
|
||||
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
|
||||
$message->to($contact->email, $contact->name)->subject('Contact');
|
||||
});
|
||||
if ($mail) {
|
||||
@@ -177,19 +192,23 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function contactDetails() {
|
||||
public function contactDetails()
|
||||
{
|
||||
return view('themes.default1.client.kb.article-list.contact-details');
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert the values to the comment table
|
||||
* To insert the values to the comment table.
|
||||
*
|
||||
* @param type Article $article
|
||||
* @param type Request $request
|
||||
* @param type Comment $comment
|
||||
* @param type Id $id
|
||||
* @param type Id $id
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
|
||||
{
|
||||
$article = $article->where('slug', $slug)->first();
|
||||
$id = $article->id;
|
||||
$comment->article_id = $id;
|
||||
@@ -200,39 +219,46 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getPage($name, Page $page) {
|
||||
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() {
|
||||
public static function port()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
|
||||
static function host() {
|
||||
public static function host()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
|
||||
static function encryption() {
|
||||
public static function encryption()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
|
||||
static function email() {
|
||||
public static function email()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
|
||||
//dd(Config::get('mail'));
|
||||
}
|
||||
|
||||
static function password() {
|
||||
public 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) {
|
||||
public function getCategoryList(Article $article, Category $category, Relationship $relation)
|
||||
{
|
||||
//$categorys = $category->get();
|
||||
$categorys = $category->get();
|
||||
// $categorys->setPath('home');
|
||||
@@ -254,12 +280,15 @@ class UserController extends Controller {
|
||||
// //return substr($date, 0, -6);
|
||||
// }
|
||||
|
||||
public function clientProfile() {
|
||||
public function clientProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.client.kb.article-list.profile', compact('user'));
|
||||
}
|
||||
|
||||
public function postClientProfile($id, ProfileRequest $request) {
|
||||
public function postClientProfile($id, ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -278,12 +307,13 @@ class UserController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$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()) {
|
||||
@@ -291,16 +321,17 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function postClientProfilePassword($id, ProfilePassword $request) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,21 +2,20 @@
|
||||
|
||||
namespace App\Http\Controllers\Common;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Phpmailer\PHPMailerautoload;
|
||||
use Illuminate\Http\Request;
|
||||
use Auth;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use Auth;
|
||||
|
||||
class PhpMailController extends Controller {
|
||||
|
||||
public function fetch_smtp_details($id) {
|
||||
class PhpMailController extends Controller
|
||||
{
|
||||
public function fetch_smtp_details($id)
|
||||
{
|
||||
$emails = Emails::where('id', '=', $id)->first();
|
||||
|
||||
return $emails;
|
||||
}
|
||||
|
||||
@@ -25,7 +24,8 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function sendmail($from, $to, $message, $template_variables) {
|
||||
public function sendmail($from, $to, $message, $template_variables)
|
||||
{
|
||||
// dd($from);
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
|
||||
@@ -169,21 +169,21 @@ class PhpMailController extends Controller {
|
||||
|
||||
$system_from = $this->company();
|
||||
|
||||
$mail = new \PHPMailer;
|
||||
$mail = new \PHPMailer();
|
||||
|
||||
$status = \DB::table('settings_email')->first();
|
||||
|
||||
$path2 = \Config::get('view.paths');
|
||||
|
||||
$directory = $path2[0] . '\emails' . DIRECTORY_SEPARATOR . $status->template . DIRECTORY_SEPARATOR;
|
||||
$directory = $path2[0].'\emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
|
||||
|
||||
$handle = fopen($directory . $template . '.blade.php', "r");
|
||||
$contents = fread($handle, filesize($directory . $template . '.blade.php'));
|
||||
$handle = fopen($directory.$template.'.blade.php', 'r');
|
||||
$contents = fread($handle, filesize($directory.$template.'.blade.php'));
|
||||
fclose($handle);
|
||||
|
||||
$variables = array('{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}');
|
||||
$variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}'];
|
||||
|
||||
$data = array($user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link);
|
||||
$data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link];
|
||||
|
||||
// dd($variables,$data,$contents);
|
||||
// $messagebody = str_replace($variables, $data, $contents);
|
||||
@@ -195,7 +195,6 @@ class PhpMailController extends Controller {
|
||||
$contents = $messagebody;
|
||||
}
|
||||
|
||||
|
||||
// dd($messagebody);
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
@@ -226,7 +225,7 @@ class PhpMailController extends Controller {
|
||||
$mail->addBCC($bc);
|
||||
|
||||
if ($attachment != null) {
|
||||
$size = sizeOf($message['attachments']);
|
||||
$size = count($message['attachments']);
|
||||
$attach = $message['attachments'];
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
$file_path = $attach[$i]->getRealPath();
|
||||
@@ -237,8 +236,8 @@ class PhpMailController extends Controller {
|
||||
|
||||
$mail->Subject = $subject;
|
||||
if ($template == 'ticket-reply-agent') {
|
||||
$line = "---Reply above this line--- <br/><br/>";
|
||||
$mail->Body = $line . $messagebody;
|
||||
$line = '---Reply above this line--- <br/><br/>';
|
||||
$mail->Body = $line.$messagebody;
|
||||
} else {
|
||||
$mail->Body = $messagebody;
|
||||
}
|
||||
@@ -247,23 +246,26 @@ class PhpMailController extends Controller {
|
||||
|
||||
if (!$mail->send()) {
|
||||
echo 'Message could not be sent.';
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
echo 'Mailer Error: '.$mail->ErrorInfo;
|
||||
} else {
|
||||
echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching comapny name to send mail
|
||||
* Fetching comapny name to send mail.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
@@ -311,12 +313,15 @@ class PhpMailController extends Controller {
|
||||
// }
|
||||
|
||||
/**
|
||||
* Function to choose from address
|
||||
* @param type Reg $reg
|
||||
* Function to choose from address.
|
||||
*
|
||||
* @param type Reg $reg
|
||||
* @param type Department $dept_id
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function mailfrom($reg, $dept_id) {
|
||||
public function mailfrom($reg, $dept_id)
|
||||
{
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
if ($reg == 1) {
|
||||
return $email->sys_email;
|
||||
@@ -329,5 +334,4 @@ class PhpMailController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,60 +5,65 @@ namespace App\Http\Controllers\Common;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\SmtpRequest;
|
||||
use App\Http\Requests;
|
||||
// models
|
||||
use App\Model\helpdesk\Theme\Widgets;
|
||||
use App\Http\Requests\helpdesk\SmtpRequest;
|
||||
use App\Model\helpdesk\Email\Smtp;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Plugin;
|
||||
// classes
|
||||
use App\Model\helpdesk\Theme\Widgets;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
use Config;
|
||||
use Input;
|
||||
// classes
|
||||
use Crypt;
|
||||
use Illuminate\Support\Collection;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* ***************************
|
||||
* Settings Controllers
|
||||
* ***************************
|
||||
* Controller to keep smtp details and fetch where ever needed
|
||||
* @package default
|
||||
* Controller to keep smtp details and fetch where ever needed.
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
// $this->smtp();
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
SettingsController::driver();
|
||||
SettingsController::host();
|
||||
SettingsController::port();
|
||||
SettingsController::from();
|
||||
SettingsController::encryption();
|
||||
SettingsController::username();
|
||||
SettingsController::password();
|
||||
self::driver();
|
||||
self::host();
|
||||
self::port();
|
||||
self::from();
|
||||
self::encryption();
|
||||
self::username();
|
||||
self::password();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function widgets() {
|
||||
public function widgets()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.theme.widgets');
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_widget() {
|
||||
public function list_widget()
|
||||
{
|
||||
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'title', 'value')
|
||||
@@ -72,33 +77,33 @@ class SettingsController extends Controller {
|
||||
return $model->value;
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>' . \Lang::get("lang.title") . '</label><br/>
|
||||
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
|
||||
<label>'.\Lang::get('lang.title').'</label><br/>
|
||||
<input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>' . \Lang::get("lang.content") . '</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
|
||||
<label>'.\Lang::get('lang.content').'</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#Content' . $model->id . '").wysihtml5();
|
||||
$("#Content'.$model->id.'").wysihtml5();
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
@@ -110,36 +115,44 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* @param type Footer $footer
|
||||
* Post footer.
|
||||
*
|
||||
* @param type Footer $footer
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_widget($id, Widgets $widgets, Request $request) {
|
||||
public function edit_widget($id, Widgets $widgets, Request $request)
|
||||
{
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function social_buttons() {
|
||||
public function social_buttons()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.theme.social');
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_social_buttons() {
|
||||
public function list_social_buttons()
|
||||
{
|
||||
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'value')
|
||||
@@ -150,25 +163,25 @@ class SettingsController extends Controller {
|
||||
return $model->value;
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>' . \Lang::get("lang.link") . '</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
|
||||
<label>'.\Lang::get('lang.link').'</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -179,88 +192,106 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* @param type Footer $footer
|
||||
* Post footer.
|
||||
*
|
||||
* @param type Footer $footer
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_social_buttons($id, Widgets $widgets, Request $request) {
|
||||
public function edit_social_buttons($id, Widgets $widgets, Request $request)
|
||||
{
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Driver
|
||||
* Driver.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function driver() {
|
||||
$set = new Smtp;
|
||||
public static function driver()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.host', $settings->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP host
|
||||
* SMTP host.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function host() {
|
||||
$set = new Smtp;
|
||||
public static function host()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.host', $settings->host);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP port
|
||||
* SMTP port.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function port() {
|
||||
$set = new Smtp;
|
||||
public static function port()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.port', intval($settings->port));
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP from
|
||||
* SMTP from.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function from() {
|
||||
$set = new Smtp;
|
||||
public static function from()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP encryption
|
||||
* SMTP encryption.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function encryption() {
|
||||
$set = new Smtp;
|
||||
public static function encryption()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.encryption', $settings->encryption);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP username
|
||||
* SMTP username.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function username() {
|
||||
$set = new Smtp;
|
||||
public static function username()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.username', $settings->email);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP password
|
||||
* SMTP password.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function password() {
|
||||
public static function password()
|
||||
{
|
||||
$settings = Smtp::first();
|
||||
if ($settings->password) {
|
||||
$pass = $settings->password;
|
||||
@@ -270,19 +301,24 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get SMTP
|
||||
* get SMTP.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getsmtp() {
|
||||
public function getsmtp()
|
||||
{
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST SMTP
|
||||
* POST SMTP.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postsmtp(SmtpRequest $request) {
|
||||
public function postsmtp(SmtpRequest $request)
|
||||
{
|
||||
$data = Smtp::where('id', '=', 1)->first();
|
||||
$data->driver = $request->input('driver');
|
||||
$data->host = $request->input('host');
|
||||
@@ -293,6 +329,7 @@ class SettingsController extends Controller {
|
||||
$data->password = Crypt::encrypt($request->input('password'));
|
||||
try {
|
||||
$data->save();
|
||||
|
||||
return \Redirect::route('getsmtp')->with('success', 'success');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
|
||||
@@ -300,10 +337,12 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP
|
||||
* SMTP.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function smtp() {
|
||||
public static function smtp()
|
||||
{
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
if ($settings->password) {
|
||||
$password = Crypt::decrypt($settings->password);
|
||||
@@ -318,22 +357,29 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings
|
||||
* @param type Smtp $set
|
||||
* Settings.
|
||||
*
|
||||
* @param type Smtp $set
|
||||
*
|
||||
* @return type view\
|
||||
*/
|
||||
public function settings(Smtp $set) {
|
||||
public function settings(Smtp $set)
|
||||
{
|
||||
$settings = $set->where('id', '1')->first();
|
||||
|
||||
return view('themes.default1.admin.settings', compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post settings
|
||||
* @param type Settings $set
|
||||
* @param type Request $request
|
||||
* Post settings.
|
||||
*
|
||||
* @param type Settings $set
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function PostSettings(Settings $set, Request $request) {
|
||||
public function PostSettings(Settings $set, Request $request)
|
||||
{
|
||||
$settings = $set->where('id', '1')->first();
|
||||
$pass = $request->input('password');
|
||||
$password = Crypt::encrypt($pass);
|
||||
@@ -346,13 +392,14 @@ class SettingsController extends Controller {
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist/logo';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
$settings->save();
|
||||
}
|
||||
try {
|
||||
$settings->fill($request->except('logo', 'password'))->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Settings updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -360,25 +407,29 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* version_check
|
||||
* version_check.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function version_check() {
|
||||
public function version_check()
|
||||
{
|
||||
$response_url = \URL::route('post-version-check');
|
||||
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
|
||||
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
|
||||
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
|
||||
echo "<input type='hidden' name='id' value='19'/>";
|
||||
echo "<input type='hidden' name='response_url' value='" . $response_url . "' />";
|
||||
echo "</form>";
|
||||
echo "<input type='hidden' name='response_url' value='".$response_url."' />";
|
||||
echo '</form>';
|
||||
echo "<script language='javascript'>document.redirect.submit();</script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* post_version_check
|
||||
* post_version_check.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function post_version_check(Request $request) {
|
||||
public function post_version_check(Request $request)
|
||||
{
|
||||
$current_version = \Config::get('app.version');
|
||||
$new_version = $request->value;
|
||||
if ($current_version == $new_version) {
|
||||
@@ -390,38 +441,41 @@ class SettingsController extends Controller {
|
||||
$version->new_version = $new_version;
|
||||
$version->save();
|
||||
// echo "Version " . $new_version . " is Available";
|
||||
return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available');
|
||||
return redirect()->route('checkupdate')->with('info', ' Version '.$new_version.' is Available');
|
||||
} else {
|
||||
// echo "Error Checking Version";
|
||||
return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
|
||||
}
|
||||
}
|
||||
|
||||
public function getupdate() {
|
||||
public function getupdate()
|
||||
{
|
||||
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
|
||||
}
|
||||
|
||||
public function Plugins() {
|
||||
public function Plugins()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.settings.plugins');
|
||||
}
|
||||
|
||||
public function GetPlugin() {
|
||||
public function GetPlugin()
|
||||
{
|
||||
$plugins = $this->fetchConfig();
|
||||
|
||||
return \Datatable::collection(new Collection($plugins))
|
||||
->searchColumns('name')
|
||||
->addColumn('name', function($model) {
|
||||
->addColumn('name', function ($model) {
|
||||
if (array_has($model, 'path')) {
|
||||
if ($model['status'] == 0) {
|
||||
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Activate</a>";
|
||||
$settings = " ";
|
||||
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>';
|
||||
$settings = ' ';
|
||||
} else {
|
||||
$settings = "<a href=" . url($model['settings']) . ">Settings</a> | ";
|
||||
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Deactivate</a>";
|
||||
$settings = '<a href='.url($model['settings']).'>Settings</a> | ';
|
||||
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>';
|
||||
}
|
||||
|
||||
$delete = "<a href= id=delete" . $model['path'] . " data-toggle=modal data-target=#del" . $model['path'] . "><span style='color:red'>Delete</span></a>"
|
||||
. "<div class='modal fade' id=del" . $model['path'] . ">
|
||||
$delete = '<a href= id=delete'.$model['path'].' data-toggle=modal data-target=#del'.$model['path']."><span style='color:red'>Delete</span></a>"
|
||||
."<div class='modal fade' id=del".$model['path'].">
|
||||
<div class='modal-dialog'>
|
||||
<div class=modal-content>
|
||||
<div class=modal-header>
|
||||
@@ -430,8 +484,8 @@ class SettingsController extends Controller {
|
||||
<div class=modal-body>
|
||||
<p>Are you Sure ?</p>
|
||||
<div class=modal-footer>
|
||||
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . "</button>
|
||||
<a href=" . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a>
|
||||
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>".\Lang::get('lang.close').'</button>
|
||||
<a href='.url('plugin/delete/'.$model['path'])."><button class='btn btn-danger'>Delete</button></a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -439,116 +493,129 @@ class SettingsController extends Controller {
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
$action = "<br><br>" . $delete . " | " . $settings . $activate;
|
||||
$action = '<br><br>'.$delete.' | '.$settings.$activate;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
return ucfirst($model['name']) . $action;
|
||||
|
||||
return ucfirst($model['name']).$action;
|
||||
})
|
||||
->addColumn('description', function($model) {
|
||||
->addColumn('description', function ($model) {
|
||||
return ucfirst($model['description']);
|
||||
})
|
||||
->addColumn('author', function($model) {
|
||||
->addColumn('author', function ($model) {
|
||||
return ucfirst($model['author']);
|
||||
})
|
||||
->addColumn('website', function($model) {
|
||||
return "<a href=" . $model['website'] . " target=_blank>" . $model['website'] . "</a>";
|
||||
->addColumn('website', function ($model) {
|
||||
return '<a href='.$model['website'].' target=_blank>'.$model['website'].'</a>';
|
||||
})
|
||||
->addColumn('version', function($model) {
|
||||
->addColumn('version', function ($model) {
|
||||
return $model['version'];
|
||||
})
|
||||
->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reading the Filedirectory
|
||||
* Reading the Filedirectory.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ReadPlugins() {
|
||||
$dir = app_path() . '/Plugins';
|
||||
$plugins = array_diff(scandir($dir), array('.', '..'));
|
||||
public function ReadPlugins()
|
||||
{
|
||||
$dir = app_path().'/Plugins';
|
||||
$plugins = array_diff(scandir($dir), ['.', '..']);
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* After plugin post
|
||||
* After plugin post.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function PostPlugins(Request $request) {
|
||||
public function PostPlugins(Request $request)
|
||||
{
|
||||
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||
$plug = new Plugin();
|
||||
$file = $request->file('plugin');
|
||||
//dd($file);
|
||||
$destination = app_path() . '/Plugins';
|
||||
$destination = app_path().'/Plugins';
|
||||
$zipfile = $file->getRealPath();
|
||||
/**
|
||||
/*
|
||||
* get the file name and remove .zip
|
||||
*/
|
||||
$filename2 = $file->getClientOriginalName();
|
||||
$filename2 = str_replace('.zip', '', $filename2);
|
||||
$filename1 = ucfirst($file->getClientOriginalName());
|
||||
$filename = str_replace('.zip', '', $filename1);
|
||||
mkdir($destination . '/' . $filename);
|
||||
/**
|
||||
mkdir($destination.'/'.$filename);
|
||||
/*
|
||||
* extract the zip file using zipper
|
||||
*/
|
||||
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . '/' . $filename);
|
||||
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination.'/'.$filename);
|
||||
|
||||
$file = app_path() . '/Plugins/' . $filename; // Plugin file path
|
||||
$file = app_path().'/Plugins/'.$filename; // Plugin file path
|
||||
|
||||
if (file_exists($file)) {
|
||||
|
||||
$seviceporvider = $file . '/ServiceProvider.php';
|
||||
$config = $file . '/config.php';
|
||||
$seviceporvider = $file.'/ServiceProvider.php';
|
||||
$config = $file.'/config.php';
|
||||
if (file_exists($seviceporvider) && file_exists($config)) {
|
||||
/**
|
||||
/*
|
||||
* move to faveo config
|
||||
*/
|
||||
$faveoconfig = config_path() . '/plugins/' . $filename . '.php';
|
||||
$faveoconfig = config_path().'/plugins/'.$filename.'.php';
|
||||
if ($faveoconfig) {
|
||||
|
||||
//copy($config, $faveoconfig);
|
||||
/**
|
||||
/*
|
||||
* write provider list in app.php line 128
|
||||
*/
|
||||
$app = base_path() . '/config/app.php';
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
|
||||
$app = base_path().'/config/app.php';
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
file_put_contents($app, implode("\n", $lines));
|
||||
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
|
||||
|
||||
return redirect()->back()->with('success', 'Installed SuccessFully');
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin hasn't config.php and ServiceProvider.php
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
return redirect()->back()->with('fails', 'Their is no ' . $file);
|
||||
|
||||
return redirect()->back()->with('fails', 'Their is no '.$file);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin hasn't config.php and ServiceProvider.php
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> ' . $file);
|
||||
|
||||
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin Name is not equal to the folder name
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> ' . $file);
|
||||
|
||||
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the directory
|
||||
* Delete the directory.
|
||||
*
|
||||
* @param type $dir
|
||||
* @return boolean
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteDirectory($dir) {
|
||||
public function deleteDirectory($dir)
|
||||
{
|
||||
if (!file_exists($dir)) {
|
||||
return true;
|
||||
}
|
||||
@@ -559,21 +626,23 @@ class SettingsController extends Controller {
|
||||
if ($item == '.' || $item == '..') {
|
||||
continue;
|
||||
}
|
||||
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
|
||||
if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
public function ReadConfigs() {
|
||||
$dir = app_path() . '/Plugins/';
|
||||
$files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php'));
|
||||
$plugins = array();
|
||||
public function ReadConfigs()
|
||||
{
|
||||
$dir = app_path().'/Plugins/';
|
||||
$files = array_diff(scandir($dir), ['.', '..', 'ServiceProvider.php']);
|
||||
$plugins = [];
|
||||
if ($files) {
|
||||
foreach ($files as $key => $file) {
|
||||
$plugin = $dir . $file;
|
||||
$plugins[$key] = array_diff(scandir($plugin), array('.', '..', 'ServiceProvider.php'));
|
||||
$plugin = $dir.$file;
|
||||
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
|
||||
$plugins[$key]['file'] = $plugin;
|
||||
}
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -582,22 +651,24 @@ class SettingsController extends Controller {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file == 'config.php') {
|
||||
$config[] = $dir . '/' . $file;
|
||||
$config[] = $dir.'/'.$file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
||||
} else {
|
||||
return 'null';
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchConfig() {
|
||||
public function fetchConfig()
|
||||
{
|
||||
$configs = $this->ReadConfigs();
|
||||
//dd($configs);
|
||||
$plug = new Plugin;
|
||||
$plug = new Plugin();
|
||||
$plug = $plug->select('path', 'status')->orderBy('name')->get()->toArray();
|
||||
//dd($plug[0]['path']);
|
||||
if ($configs !== 'null') {
|
||||
@@ -608,38 +679,42 @@ class SettingsController extends Controller {
|
||||
$fields[$key]['status'] = $plug[$key]['status'];
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
} else {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public function DeletePlugin($slug) {
|
||||
$dir = app_path() . '/Plugins/' . $slug;
|
||||
public function DeletePlugin($slug)
|
||||
{
|
||||
$dir = app_path().'/Plugins/'.$slug;
|
||||
$this->deleteDirectory($dir);
|
||||
/**
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . '/config/app.php';
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().'/config/app.php';
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, "//", $file_contents);
|
||||
$file_contents = str_replace($str, '//', $file_contents);
|
||||
file_put_contents($path_to_file, $file_contents);
|
||||
$plugin = new Plugin();
|
||||
$plugin = $plugin->where('path', $slug)->first();
|
||||
$plugin->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
public function StatusPlugin($slug) {
|
||||
$plug = new Plugin;
|
||||
public function StatusPlugin($slug)
|
||||
{
|
||||
$plug = new Plugin();
|
||||
$plug = $plug->where('name', $slug)->first();
|
||||
$status = $plug->status;
|
||||
if ($status == 0) {
|
||||
$plug->status = 1;
|
||||
|
||||
$app = base_path() . '/config/app.php';
|
||||
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$app = base_path().'/config/app.php';
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -647,18 +722,18 @@ class SettingsController extends Controller {
|
||||
}
|
||||
if ($status == 1) {
|
||||
$plug->status = 0;
|
||||
/**
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . '/config/app.php';
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().'/config/app.php';
|
||||
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, "//", $file_contents);
|
||||
$file_contents = str_replace($str, '//', $file_contents);
|
||||
file_put_contents($path_to_file, $file_contents);
|
||||
}
|
||||
$plug->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Status has changed');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@ namespace App\Http\Controllers;
|
||||
|
||||
// classes
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
use DispatchesCommands,
|
||||
ValidatesRequests;
|
||||
}
|
||||
|
@@ -6,20 +6,19 @@ namespace App\Http\Controllers\Error;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
* ErrorController
|
||||
* ErrorController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ErrorController extends Controller {
|
||||
|
||||
class ErrorController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a Error Page of 404.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function error404() {
|
||||
public function error404()
|
||||
{
|
||||
return view('404');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
|
||||
class HomeController extends Controller {
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Home Controller
|
||||
@@ -22,7 +22,8 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
@@ -31,48 +32,52 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// ksjdckjdsnc
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
public function getsmtp() {
|
||||
public function getsmtp()
|
||||
{
|
||||
$smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first();
|
||||
|
||||
return $smtp->host;
|
||||
}
|
||||
|
||||
Public function getdata() {
|
||||
public function getdata()
|
||||
{
|
||||
return \View::make('emails/notifications/agent');
|
||||
}
|
||||
|
||||
public function getreport() {
|
||||
public function getreport()
|
||||
{
|
||||
return \View::make('test');
|
||||
}
|
||||
|
||||
public function pushdata() {
|
||||
|
||||
$date2 = strtotime(Date('Y-m-d'));
|
||||
$date3 = Date('Y-m-d');
|
||||
public function pushdata()
|
||||
{
|
||||
$date2 = strtotime(date('Y-m-d'));
|
||||
$date3 = date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
|
||||
|
||||
$return = "";
|
||||
$last = "";
|
||||
$return = '';
|
||||
$last = '';
|
||||
for ($i = $date1; $i <= $date2; $i = $i + 86400) {
|
||||
$thisDate = date('Y-m-d', $i);
|
||||
|
||||
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
|
||||
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
}
|
||||
$last = rtrim($return, ',');
|
||||
|
||||
return '[' . $last . ']';
|
||||
return '['.$last.']';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,47 +7,40 @@ use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Form\Form_details;
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
// classes
|
||||
use App;
|
||||
use Artisan;
|
||||
use Config;
|
||||
use Exception;
|
||||
use File;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
* |=======================================================================
|
||||
* |=======================================================================.
|
||||
*
|
||||
* Class to perform the first install operation without this the database
|
||||
* settings could not be started
|
||||
*
|
||||
* @package Faveo HELPDESK
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*
|
||||
*/
|
||||
class InstallController extends Controller {
|
||||
|
||||
class InstallController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get Licence (step 1)
|
||||
* Get Licence (step 1).
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licence() {
|
||||
// checking if the installation is running for the first time or not
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
public function licence()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
@@ -58,14 +51,17 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Licencecheck
|
||||
* Post Licencecheck.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licencecheck() {
|
||||
public function licencecheck()
|
||||
{
|
||||
// checking if the user have accepted the licence agreement
|
||||
$accept = (Input::has('accept1')) ? true : false;
|
||||
if ($accept == 'accept') {
|
||||
Session::put('step1', 'step1');
|
||||
|
||||
return Redirect::route('prerequisites');
|
||||
} else {
|
||||
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
@@ -74,17 +70,15 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prerequisites (step 2)
|
||||
* Get prerequisites (step 2).
|
||||
*
|
||||
* Checking the extensions enabled required for installing the faveo
|
||||
* without which the project cannot be executed properly
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisites() {
|
||||
// checking if the installation is running for the first time or not
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
public function prerequisites()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step1') == 'step1') {
|
||||
@@ -99,24 +93,25 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post Prerequisitescheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisitescheck() {
|
||||
public function prerequisitescheck()
|
||||
{
|
||||
Session::put('step2', 'step2');
|
||||
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Localization (step 3)
|
||||
* Requesting user recomended settings for installation
|
||||
* Requesting user recomended settings for installation.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localization() {
|
||||
// checking if the installation is running for the first time or not
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
public function localization()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -131,11 +126,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post localizationcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localizationcheck() {
|
||||
|
||||
public function localizationcheck()
|
||||
{
|
||||
Session::put('step3', 'step3');
|
||||
|
||||
Session::put('language', Input::get('language'));
|
||||
@@ -148,14 +144,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get Configuration (step 4)
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configuration() {
|
||||
// checking if the installation is running for the first time or not
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
public function configuration()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -170,12 +164,19 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post configurationcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck() {
|
||||
|
||||
public function configurationcheck()
|
||||
{
|
||||
Session::put('step4', 'step4');
|
||||
// dd(Input::get('default'));
|
||||
// dd(Input::get('host'));
|
||||
// dd(Input::get('databasename'));
|
||||
// dd(Input::get('username'));
|
||||
// dd(Input::get('password'));
|
||||
// dd(Input::get('port'));
|
||||
|
||||
Session::put('default', Input::get('default'));
|
||||
Session::put('host', Input::get('host'));
|
||||
@@ -188,10 +189,12 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* postconnection
|
||||
* postconnection.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postconnection() {
|
||||
public function postconnection()
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$default = Input::get('default');
|
||||
$host = Input::get('host');
|
||||
@@ -213,7 +216,7 @@ class InstallController extends Controller {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
// Write environment file
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
$fp = fopen(base_path().'/.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
@@ -222,10 +225,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get database
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function database() {
|
||||
public function database()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
@@ -240,10 +245,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get account
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function account() {
|
||||
public function account()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
@@ -251,6 +258,7 @@ class InstallController extends Controller {
|
||||
Session::forget('step1');
|
||||
Session::forget('step2');
|
||||
Session::forget('step3');
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view5');
|
||||
} else {
|
||||
return Redirect::route('configuration');
|
||||
@@ -262,15 +270,18 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post accountcheck
|
||||
* checking prerequisites
|
||||
* @param type InstallerRequest $request
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @param type InstallerRequest $request
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request) {
|
||||
public function accountcheck(InstallerRequest $request)
|
||||
{
|
||||
|
||||
// migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
|
||||
// create user
|
||||
$firstname = $request->input('firstname');
|
||||
@@ -284,9 +295,8 @@ class InstallController extends Controller {
|
||||
$date = $request->input('date');
|
||||
$datetime = $request->input('datetime');
|
||||
|
||||
|
||||
//\Cache::forever('language', $language);
|
||||
|
||||
|
||||
//\App::setLocale($language);
|
||||
// $system = System::where('id','=','1')->first();
|
||||
// $system->time_zone = $timezone;
|
||||
@@ -306,39 +316,41 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
$system = new System();
|
||||
$system->status = 1;
|
||||
$system->department = 1;
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
$system->time_zone = $timezones->id;
|
||||
$system->save();
|
||||
|
||||
|
||||
// creating an user
|
||||
$user = User::create(array(
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
));
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
]);
|
||||
// checking if the user have been created
|
||||
if ($user) {
|
||||
Session::put('step6', 'step6');
|
||||
|
||||
return Redirect::route('final');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finalize
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalize() {
|
||||
public function finalize()
|
||||
{
|
||||
// checking if the installation have been completed or not
|
||||
if (Session::get('step6') == 'step6') {
|
||||
$value = '1';
|
||||
@@ -364,6 +376,7 @@ class InstallController extends Controller {
|
||||
Session::forget('step4');
|
||||
Session::forget('step5');
|
||||
Session::forget('step6');
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('npl');
|
||||
@@ -375,15 +388,16 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post finalcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalcheck() {
|
||||
public function finalcheck()
|
||||
{
|
||||
try {
|
||||
return redirect('/auth/login');
|
||||
} catch (Exception $e) {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,12 +5,10 @@ namespace App\Http;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
/**
|
||||
* Kernel
|
||||
*
|
||||
* @package HttpKernel
|
||||
* Kernel.
|
||||
*/
|
||||
class Kernel extends HttpKernel {
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
@@ -32,15 +30,14 @@ class Kernel extends HttpKernel {
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => 'App\Http\Middleware\Authenticate',
|
||||
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
|
||||
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
|
||||
'roles' => 'App\Http\Middleware\CheckRole',
|
||||
'role.agent' => 'App\Http\Middleware\CheckRoleAgent',
|
||||
'role.user' => 'App\Http\Middleware\CheckRoleUser',
|
||||
'api' => 'App\Http\Middleware\ApiKey',
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class
|
||||
'auth' => 'App\Http\Middleware\Authenticate',
|
||||
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
|
||||
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
|
||||
'roles' => 'App\Http\Middleware\CheckRole',
|
||||
'role.agent' => 'App\Http\Middleware\CheckRoleAgent',
|
||||
'role.user' => 'App\Http\Middleware\CheckRoleUser',
|
||||
'api' => 'App\Http\Middleware\ApiKey',
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
|
||||
];
|
||||
|
||||
}
|
||||
|
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use Closure;
|
||||
|
||||
class ApiKey {
|
||||
|
||||
class ApiKey
|
||||
{
|
||||
public $setting;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$setting = new System();
|
||||
$this->setting = $setting;
|
||||
}
|
||||
@@ -17,11 +18,13 @@ class ApiKey {
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
if ($set->api_enable == 1) {
|
||||
$key = $set->api_key;
|
||||
@@ -29,12 +32,13 @@ class ApiKey {
|
||||
return $next($request);
|
||||
} else {
|
||||
$result = 'wrong api key';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
} else {
|
||||
$result = 'please enable api';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,13 +6,12 @@ use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
|
||||
/**
|
||||
* Authenticate
|
||||
* Authenticate.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class Authenticate {
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
@@ -23,21 +22,25 @@ class Authenticate {
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @param Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth) {
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->guest()) {
|
||||
if ($request->ajax()) {
|
||||
return response('Unauthorized.', 401);
|
||||
@@ -48,5 +51,4 @@ class Authenticate {
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,26 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRole
|
||||
* CheckRole.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRole {
|
||||
|
||||
class CheckRole
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'admin') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('guest')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRoleAgent
|
||||
* CheckRoleAgent.
|
||||
*
|
||||
* @package default
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRoleAgent {
|
||||
|
||||
class CheckRoleAgent
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'agent' || $request->user()->role == 'admin') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('dashboard')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRoleUser
|
||||
* CheckRoleUser.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRoleUser {
|
||||
|
||||
class CheckRoleUser
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'user') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('guest')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,22 +5,19 @@ namespace App\Http\Middleware;
|
||||
use Cache;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Routing\Middleware;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LanguageMiddleware implements Middleware {
|
||||
|
||||
public function handle($request, Closure $next) {
|
||||
if (Cache::has('language') AND array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
class LanguageMiddleware implements Middleware
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Cache::has('language') and array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
App::setLocale(Cache::get('language'));
|
||||
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified
|
||||
App::setLocale(Config::get('app.fallback_locale'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class RedirectIfAuthenticated {
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
@@ -18,26 +18,29 @@ class RedirectIfAuthenticated {
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @param Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth) {
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->check()) {
|
||||
return new RedirectResponse(url('dashboard'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,17 +5,18 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
||||
|
||||
class VerifyCsrfToken extends BaseVerifier {
|
||||
|
||||
class VerifyCsrfToken extends BaseVerifier
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return parent::handle($request, $next);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest {
|
||||
abstract class Request extends FormRequest
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentRequest extends Request {
|
||||
|
||||
class AgentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,21 +26,21 @@ class AgentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'user_name' => 'required|unique:users',
|
||||
'user_name' => 'required|unique:users',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'required',
|
||||
'active' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'required',
|
||||
'active' => 'required',
|
||||
// 'account_status' => 'required',
|
||||
'assign_group' => 'required',
|
||||
'primary_dpt' => 'required',
|
||||
'agent_tzone' => 'required',
|
||||
'primary_dpt' => 'required',
|
||||
'agent_tzone' => 'required',
|
||||
// 'phone_number' => 'phone:IN',
|
||||
// 'mobile' => 'phone:IN',
|
||||
'team_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentUpdate
|
||||
* AgentUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentUpdate extends Request {
|
||||
|
||||
class AgentUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,20 +26,20 @@ class AgentUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'active' => 'required',
|
||||
'role' => 'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'active' => 'required',
|
||||
'role' => 'required',
|
||||
'assign_group' => 'required',
|
||||
'primary_dpt' => 'required',
|
||||
'agent_tzone' => 'required',
|
||||
'primary_dpt' => 'required',
|
||||
'agent_tzone' => 'required',
|
||||
// 'phone_number' => 'phone:IN',
|
||||
// 'mobile' => 'phone:IN',
|
||||
'team_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ArticleRequest extends Request {
|
||||
|
||||
class ArticleRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,11 +21,11 @@ class ArticleRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'name' => 'required',
|
||||
'description' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* BanRequest
|
||||
* BanRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanRequest extends Request {
|
||||
|
||||
class BanRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class BanRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'ban' => 'required',
|
||||
'ban' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* BanlistRequest
|
||||
* BanlistRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistRequest extends Request {
|
||||
|
||||
class BanlistRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class BanlistRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'email',
|
||||
'ban' => 'required',
|
||||
'ban' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedRequest extends Request {
|
||||
|
||||
class CannedRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CannedRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required',
|
||||
'title' => 'required',
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedUpdateRequest extends Request {
|
||||
|
||||
class CannedUpdateRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CannedUpdateRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required',
|
||||
'title' => 'required',
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CheckTicket
|
||||
* CheckTicket.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckTicket extends Request {
|
||||
|
||||
class CheckTicket extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CheckTicket extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'email' => 'required|email',
|
||||
'ticket_number' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CompanyRequest
|
||||
* CompanyRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientRequest extends Request {
|
||||
|
||||
class ClientRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ class ClientRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'Name' => 'required',
|
||||
'Email' => 'required',
|
||||
'Name' => 'required',
|
||||
'Email' => 'required',
|
||||
'Subject' => 'required',
|
||||
'Details' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class CommentRequest extends Request {
|
||||
|
||||
class CommentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,13 +21,13 @@ class CommentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:10',
|
||||
'email' => 'required|email',
|
||||
'name' => 'required|max:10',
|
||||
'email' => 'required|email',
|
||||
'website' => 'url',
|
||||
'comment' => 'required|max:60',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CompanyRequest
|
||||
* CompanyRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CompanyRequest extends Request {
|
||||
|
||||
class CompanyRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ class CompanyRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'company_name' => 'required',
|
||||
'website' => 'url',
|
||||
'phone' => 'numeric',
|
||||
'logo' => 'image',
|
||||
'website' => 'url',
|
||||
'phone' => 'numeric',
|
||||
'logo' => 'image',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ContactRequest extends Request {
|
||||
|
||||
class ContactRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,13 +21,13 @@ class ContactRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'subject' => 'required',
|
||||
'message' => 'required|max:50',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CreateTicketRequest
|
||||
* CreateTicketRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CreateTicketRequest extends Request {
|
||||
|
||||
class CreateTicketRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,18 +26,18 @@ class CreateTicketRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'email' => 'required|email',
|
||||
'fullname' => 'required|min:3',
|
||||
'email' => 'required|email',
|
||||
'fullname' => 'required|min:3',
|
||||
'helptopic' => 'required',
|
||||
// 'dept' => 'required',
|
||||
'sla' => 'required',
|
||||
'subject' => 'required|min:5',
|
||||
'body' => 'required|min:20',
|
||||
'sla' => 'required',
|
||||
'subject' => 'required|min:5',
|
||||
'body' => 'required|min:20',
|
||||
'priority' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DepartmentRequest
|
||||
* DepartmentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentRequest extends Request {
|
||||
|
||||
class DepartmentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class DepartmentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|unique:department',
|
||||
// 'outgoing_email' => 'required',
|
||||
@@ -34,5 +35,4 @@ class DepartmentRequest extends Request {
|
||||
// 'group_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DepartmentUpdate
|
||||
* DepartmentUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentUpdate extends Request {
|
||||
|
||||
class DepartmentUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class DepartmentUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
// 'outgoing_email' => 'required',
|
||||
@@ -34,5 +35,4 @@ class DepartmentUpdate extends Request {
|
||||
// 'group_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DiagnoRequest
|
||||
* DiagnoRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DiagnoRequest extends Request {
|
||||
|
||||
class DiagnoRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ class DiagnoRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'from' => 'required|email',
|
||||
'to' => 'required|email',
|
||||
'from' => 'required|email',
|
||||
'to' => 'required|email',
|
||||
'subject' => 'required',
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailRequest
|
||||
* EmailRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailRequest extends Request {
|
||||
|
||||
class EmailRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ class EmailRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailsEditRequest
|
||||
* EmailsEditRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsEditRequest extends Request {
|
||||
|
||||
class EmailsEditRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,11 @@ class EmailsEditRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email_address' => 'email',
|
||||
'email_name' => 'required',
|
||||
'email_name' => 'required',
|
||||
// 'department' => 'required',
|
||||
// 'priority' => 'required',
|
||||
// 'help_topic' => 'required',
|
||||
@@ -39,10 +40,9 @@ class EmailsEditRequest extends Request {
|
||||
// 'sending_host' => 'required',
|
||||
// 'sending_port' => 'required',
|
||||
//'mailbox_protocol' => 'required'
|
||||
'fetching_host' => 'required',
|
||||
'fetching_port' => 'required',
|
||||
'fetching_host' => 'required',
|
||||
'fetching_port' => 'required',
|
||||
'mailbox_protocol' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailsRequest
|
||||
* EmailsRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsRequest extends Request {
|
||||
|
||||
class EmailsRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,11 @@ class EmailsRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email_address' => 'required|email|unique:emails',
|
||||
'email_name' => 'required',
|
||||
'email_name' => 'required',
|
||||
// 'department' => 'required',
|
||||
// 'priority' => 'required',
|
||||
// 'help_topic' => 'required',
|
||||
@@ -38,10 +39,9 @@ class EmailsRequest extends Request {
|
||||
// 'user_name' => 'required',
|
||||
// 'sending_host' => 'required',
|
||||
// 'sending_port' => 'required',
|
||||
'fetching_host' => 'required',
|
||||
'fetching_port' => 'required',
|
||||
'fetching_host' => 'required',
|
||||
'fetching_port' => 'required',
|
||||
'mailbox_protocol' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* FormRequest
|
||||
* FormRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormRequest extends Request {
|
||||
|
||||
class FormRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ class FormRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'title' => 'required',
|
||||
'label' => 'required',
|
||||
'type' => 'required',
|
||||
'title' => 'required',
|
||||
'label' => 'required',
|
||||
'type' => 'required',
|
||||
'visibility' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* GroupRequest
|
||||
* GroupRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupRequest extends Request {
|
||||
|
||||
class GroupRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ class GroupRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|unique:groups',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* HelptopicRequest
|
||||
* HelptopicRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicRequest extends Request {
|
||||
|
||||
class HelptopicRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@ class HelptopicRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'topic' => 'required|unique:help_topic',
|
||||
// 'parent_topic' => 'required',
|
||||
// 'custom_form' => 'required',
|
||||
'department' => 'required',
|
||||
'priority' => 'required',
|
||||
'sla_plan' => 'required',
|
||||
'priority' => 'required',
|
||||
'sla_plan' => 'required',
|
||||
// 'auto_assign' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* HelptopicUpdate
|
||||
* HelptopicUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicUpdate extends Request {
|
||||
|
||||
class HelptopicUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ class HelptopicUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'parent_topic' => 'required',
|
||||
// 'custom_form' => 'required',
|
||||
'department' => 'required',
|
||||
'priority' => 'required',
|
||||
'sla_plan' => 'required',
|
||||
'priority' => 'required',
|
||||
'sla_plan' => 'required',
|
||||
// 'auto_assign' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user