Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -87,7 +87,7 @@ class AgentController extends Controller
// get all department
$departments = $department->get();
// list all the teams in a single variable
$teams = $team->lists('id', 'name')->toArray();
$teams = $team->pluck('id', 'name')->toArray();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
// returns to the page with all the variables and their datas
@@ -187,13 +187,13 @@ class AgentController extends Controller
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$user = $user->whereId($id)->first();
$team = $team->where('status', '=', 1)->get();
$teams1 = $team->lists('name', 'id');
$teams1 = $team->pluck('name', 'id');
$timezones = $timezone->get();
$groups = $group->where('group_status', '=', 1)->get();
$departments = $department->get();
$table = $team_assign_agent->where('agent_id', $id)->first();
$teams = $team->lists('id', 'name')->toArray();
$assign = $team_assign_agent->where('agent_id', $id)->lists('team_id')->toArray();
$teams = $team->pluck('id', 'name')->toArray();
$assign = $team_assign_agent->where('agent_id', $id)->pluck('team_id')->toArray();
return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'))->with('phonecode', $phonecode->phonecode);
} catch (Exception $e) {

View File

@@ -84,7 +84,7 @@ class DepartmentController extends Controller
$emails = $email->select('email_name', 'id')->get();
$templates = $template->get();
$department = $department->get();
$groups = $group->lists('id', 'name');
$groups = $group->pluck('id', 'name');
return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
} catch (Exception $e) {
@@ -164,8 +164,8 @@ class DepartmentController extends Controller
$emails = $email->select('email_name', 'id')->get();
$templates = $template->get();
$departments = $department->whereId($id)->first();
//$groups = $group->lists('id', 'name');
$assign = $group_assign_department->where('department_id', $id)->lists('group_id');
//$groups = $group->pluck('id', 'name');
$assign = $group_assign_department->where('department_id', $id)->pluck('group_id');
return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'sys_department'));
} catch (Exception $e) {

View File

@@ -82,7 +82,7 @@ class EmailsController extends Controller
$mailbox_protocols = $mailbox_protocol->get();
$service = new \App\Model\MailJob\MailService();
$services = $service->lists('name', 'id')->toArray();
$services = $service->pluck('name', 'id')->toArray();
// return with all the table data
return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'services'));
@@ -351,7 +351,7 @@ class EmailsController extends Controller
$mailbox_protocols = $mailbox_protocol->get();
$service = new \App\Model\MailJob\MailService();
$services = $service->lists('name', 'id')->toArray();
$services = $service->pluck('name', 'id')->toArray();
// return if the execution is succeeded
return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails', 'sys_email', 'services'))->with('count', $count);

View File

@@ -190,7 +190,7 @@ class FormController extends Controller
try {
$forms = new Forms();
$form = $forms->find($id);
$select_forms = $forms->where('id', '!=', $id)->lists('formname', 'id')->toArray();
$select_forms = $forms->where('id', '!=', $id)->pluck('formname', 'id')->toArray();
//dd($form);
if ($form) {
$fields = $form->fields();
@@ -209,7 +209,7 @@ class FormController extends Controller
try {
$forms = new Forms();
$form = $forms->find($id);
$select_forms = $forms->where('id', '!=', $id)->lists('formname', 'id')->toArray();
$select_forms = $forms->where('id', '!=', $id)->pluck('formname', 'id')->toArray();
//dd($form);
if ($form) {
$fields = $form->fields();
@@ -541,7 +541,7 @@ class FormController extends Controller
$session = self::getSession();
$script = self::jqueryScript($field_value = '', $field->id, $field->name, $field_type);
$form_hidden = Form::hidden('fieldid[]', $field->id, ['id' => 'hidden'.$session.$field->id]).Form::label($field->label, $field->label, ['class' => $required_class]);
$select = Form::$field_type($field->name, ['' => 'Select', 'Selects' => self::removeUnderscoreFromDB($field->values()->lists('field_value', 'field_value')->toArray())], null, ['class' => "form-control $session$field->id", 'id' => $session.$field->id, 'required' => $required]).'</br>';
$select = Form::$field_type($field->name, ['' => 'Select', 'Selects' => self::removeUnderscoreFromDB($field->values()->pluck('field_value', 'field_value')->toArray())], null, ['class' => "form-control $session$field->id", 'id' => $session.$field->id, 'required' => $required]).'</br>';
$html = $script.$form_hidden.$select;
$response_div = '<div id='.$session.$field->name.'></div>';
@@ -552,7 +552,7 @@ class FormController extends Controller
{
$radio = '';
$html = '';
$values = $field->values()->lists('field_value')->toArray();
$values = $field->values()->pluck('field_value')->toArray();
if (count($values) > 0) {
foreach ($values as $field_value) {
$script = self::jqueryScript($field_value, $field->id, $field->name, $field_type);
@@ -570,7 +570,7 @@ class FormController extends Controller
$session = self::getSession();
$checkbox = '';
$html = '';
$values = $field->values()->lists('field_value')->toArray();
$values = $field->values()->pluck('field_value')->toArray();
if (count($values) > 0) {
$i = 1;
foreach ($values as $field_value) {

View File

@@ -48,7 +48,7 @@ class GroupController extends Controller
{
try {
$groups = $group->get();
$departments = $department->lists('id');
$departments = $department->pluck('id');
return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
} catch (Exception $e) {

View File

@@ -49,7 +49,7 @@ class TeamController extends Controller
try {
$teams = $team->get();
/* find out the Number of Members in the Team */
$id = $teams->lists('id');
$id = $teams->pluck('id');
$assign_team_agent = $assign_team_agent->get();
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
@@ -213,7 +213,7 @@ class TeamController extends Controller
$a_id = [];
$teams = $team->whereId($id)->first();
$agent_team = $assign_team_agent->where('team_id', $id)->get();
$agent_id = $agent_team->lists('agent_id', 'agent_id');
$agent_id = $agent_team->pluck('agent_id', 'agent_id');
foreach ($agent_id as $value) {
array_push($a_id, $value);
}

View File

@@ -145,7 +145,7 @@ class WorkflowController extends Controller
public function create(Emails $emails)
{
$email_data = '';
foreach ($emails->lists('email_address', 'id') as $key => $email) {
foreach ($emails->pluck('email_address', 'id') as $key => $email) {
$email_data["E-$key"] = $email;
}
$emails = $email_data;

View File

@@ -67,7 +67,7 @@ class FilterController extends Controller
}
}
})
->lists('ticket_id')
->pluck('ticket_id')
->toArray();
return $query;

View File

@@ -1763,7 +1763,7 @@ class TicketController extends Controller
public function autosearch($id)
{
$term = \Input::get('term');
$user = \App\User::where('email', 'LIKE', '%'.$term.'%')->lists('email');
$user = \App\User::where('email', 'LIKE', '%'.$term.'%')->pluck('email');
echo json_encode($user);
}
@@ -1776,7 +1776,7 @@ class TicketController extends Controller
*/
public function autosearch2(User $user)
{
$user = $user->lists('email');
$user = $user->pluck('email');
echo json_encode($user);
}

View File

@@ -257,7 +257,7 @@ class UserController extends Controller
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$org = Organization::lists('name', 'id')->toArray();
$org = Organization::pluck('name', 'id')->toArray();
return view('themes.default1.agent.helpdesk.user.create', compact('org', 'settings', 'email_mandatory'))->with('phonecode', $phonecode->phonecode);
} catch (Exception $e) {
@@ -647,9 +647,9 @@ class UserController extends Controller
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$orgs = Organization::all();
// dd($org);
$organization_id = User_org::where('user_id', '=', $id)->lists('org_id')->first();
$organization_id = User_org::where('user_id', '=', $id)->pluck('org_id')->first();
// $org_name=Organization::where('id','=',$org_id)->lists('name')->first();
// $org_name=Organization::where('id','=',$org_id)->pluck('name')->first();
// dd($org_name);
return view('themes.default1.agent.helpdesk.user.edit', compact('users', 'orgs', '$settings', '$email_mandatory', 'organization_id'))->with('phonecode', $phonecode->phonecode);
@@ -833,7 +833,7 @@ class UserController extends Controller
$org_name = Input::get('org');
if ($org_name) {
$org = Organization::where('name', '=', $org_name)->lists('id')->first();
$org = Organization::where('name', '=', $org_name)->pluck('id')->first();
if ($org) {
$user_org = new User_org();
$user_org->org_id = $org;
@@ -854,7 +854,7 @@ class UserController extends Controller
$org_name = Input::get('org');
if ($org_name) {
$org = Organization::where('name', '=', $org_name)->lists('id')->first();
$org = Organization::where('name', '=', $org_name)->pluck('id')->first();
if ($org) {
$user_org = User_org::where('user_id', '=', $id)->first();
$user_org->org_id = $org;

View File

@@ -134,7 +134,7 @@ class ArticleController extends Controller
public function create(Category $category)
{
/* get the attributes of the category */
$category = $category->lists('id', 'name');
$category = $category->pluck('id', 'name');
/* get the create page */
try {
return view('themes.default1.agent.kb.article.create', compact('category'));
@@ -196,9 +196,9 @@ class ArticleController extends Controller
$aid = $article->where('id', $slug)->first();
$id = $aid->id;
/* define the selected fields */
$assign = $relation->where('article_id', $id)->lists('category_id');
$assign = $relation->where('article_id', $id)->pluck('category_id');
/* get the attributes of the category */
$category = $category->lists('id', 'name');
$category = $category->pluck('id', 'name');
/* get the selected article and display it at edit page */
/* Get the selected article with id */
$article = $article->whereId($id)->first();

View File

@@ -121,7 +121,7 @@ class CategoryController extends Controller
public function create(Category $category)
{
/* Get the all attributes in the category model */
$category = $category->lists('name', 'id')->toArray();
$category = $category->pluck('name', 'id')->toArray();
/* get the view page to create new category with all attributes
of category model */
try {
@@ -167,7 +167,7 @@ class CategoryController extends Controller
{
/* get the atributes of the category model whose id == $id */
$category = Category::whereId($id)->first();
$categories = Category::lists('name', 'id')->toArray();
$categories = Category::pluck('name', 'id')->toArray();
/* get the Edit page the selected category via id */
return view('themes.default1.agent.kb.category.edit', compact('category', 'categories'));
}

View File

@@ -627,7 +627,7 @@ class TicketController extends Controller
public function autosearch()
{
$term = \Input::get('term');
$user = \App\User::where('email', 'LIKE', '%'.$term.'%')->orWhere('first_name', 'LIKE', '%'.$term.'%')->orWhere('last_name', 'LIKE', '%'.$term.'%')->orWhere('user_name', 'LIKE', '%'.$term.'%')->lists('email');
$user = \App\User::where('email', 'LIKE', '%'.$term.'%')->orWhere('first_name', 'LIKE', '%'.$term.'%')->orWhere('last_name', 'LIKE', '%'.$term.'%')->orWhere('user_name', 'LIKE', '%'.$term.'%')->pluck('email');
return $user;
}

View File

@@ -142,7 +142,7 @@ class UserController extends Controller
$all = $relation->where('category_id', $id)->get();
// $all->setPath('');
/* from whole attribute pick the article_id */
$article_id = $all->lists('article_id');
$article_id = $all->pluck('article_id');
$categorys = $category->get();
/* direct to view with $article_id */
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));

View File

@@ -34,7 +34,7 @@ class ApiSettings extends Controller
$ticket_detail = '';
$settings = $this->api;
if ($settings->get()->count() > 0) {
$details = $this->api->lists('value', 'key')->toArray();
$details = $this->api->pluck('value', 'key')->toArray();
}
if (array_key_exists('ticket_detail', $details)) {
$ticket_detail = $details['ticket_detail'];

View File

@@ -206,7 +206,7 @@ class PhpMailController extends Controller
public function setServices($emailid, $protocol)
{
$service = new \App\Model\MailJob\FaveoMail();
$services = $service->where('email_id', $emailid)->lists('value', 'key')->toArray();
$services = $service->where('email_id', $emailid)->pluck('value', 'key')->toArray();
$controller = new \App\Http\Controllers\Admin\helpdesk\EmailsController();
$controller->setServiceConfig($protocol, $services);
}
@@ -279,7 +279,7 @@ class PhpMailController extends Controller
if ($active_queue) {
$short = $active_queue->short_name;
$fields = new \App\Model\MailJob\FaveoQueue();
$field = $fields->where('service_id', $active_queue->id)->lists('value', 'key')->toArray();
$field = $fields->where('service_id', $active_queue->id)->pluck('value', 'key')->toArray();
}
$this->setQueueConfig($short, $field);
}

View File

@@ -97,7 +97,7 @@ class TemplateController extends Controller
{
try {
$i = $this->template->orderBy('created_at', 'desc')->first()->id + 1;
$type = $this->type->lists('name', 'id')->toArray();
$type = $this->type->pluck('name', 'id')->toArray();
return view('themes.default1.common.template.create', compact('type'));
} catch (\Exception $ex) {
@@ -135,7 +135,7 @@ class TemplateController extends Controller
try {
$i = $this->template->orderBy('created_at', 'desc')->first()->id + 1;
$template = $this->template->where('id', $id)->first();
$type = $this->type->lists('name', 'id')->toArray();
$type = $this->type->pluck('name', 'id')->toArray();
return view('themes.default1.common.template.edit', compact('type', 'template'));
} catch (\Exception $ex) {

View File

@@ -57,7 +57,7 @@ class CheckUpdate
if ($not->count() > 0) {
$now = \Carbon\Carbon::now();
$yesterday = \Carbon\Carbon::yesterday();
$notifications = $notify->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key');
$notifications = $notify->whereBetween('created_at', [$yesterday, $now])->pluck('value', 'key');
$todelete = $notify->where('created_at', '<', $yesterday)->get();
if ($todelete->count() > 0) {
foreach ($todelete as $delete) {
@@ -114,7 +114,7 @@ class CheckUpdate
if ($n) {
$now = \Carbon\Carbon::now();
$yesterday = \Carbon\Carbon::yesterday();
$notifications = $notify->where('key', 'new-version')->whereBetween('created_at', [$yesterday, $now])->lists('value', 'key');
$notifications = $notify->where('key', 'new-version')->whereBetween('created_at', [$yesterday, $now])->pluck('value', 'key');
if ($notifications->count() > 0) {
return false;
}

View File

@@ -3,6 +3,7 @@
namespace App\Http\ViewComposers;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
@@ -20,6 +21,7 @@ class AgentLayout
protected $users;
protected $tickets;
protected $department;
protected $emails;
/**
* Create a new profile composer.
@@ -28,13 +30,14 @@ class AgentLayout
*
* @return void
*/
public function __construct(Company $company, User $users, Tickets $tickets, Department $department)
public function __construct(Company $company, User $users, Tickets $tickets, Department $department, Emails $emails)
{
$this->company = $company;
$this->auth = Auth::user();
$this->users = $users;
$this->tickets = $tickets;
$this->department = $department;
$this->emails = $emails;
}
/**
@@ -48,16 +51,19 @@ class AgentLayout
{
$notifications = \App\Http\Controllers\Common\NotificationController::getNotifications();
$view->with([
'company' => $this->company,
'notifications' => $notifications,
'myticket' => $this->myTicket(),
'unassigned' => $this->unassigned(),
'followup_ticket' => $this->followupTicket(),
'deleted' => $this->deleted(),
'tickets' => $this->inbox(),
'department' => $this->departments(),
'overdues' => $this->overdues(),
'due_today' => $this->getDueToday(),
'company' => $this->company,
'notifications' => $notifications,
'myticket' => $this->myTicket(),
'unassigned' => $this->unassigned(),
'followup_ticket' => $this->followupTicket(),
'deleted' => $this->deleted(),
'closed' => $this->closed(),
'tickets' => $this->inbox(),
'department' => $this->departments(),
'overdues' => $this->overdues(),
'due_today' => $this->getDueToday(),
'is_mail_conigured' => $this->getEmailConfig(),
'ticket_policy' => new \App\Policies\TicketPolicy(),
]);
}
@@ -98,10 +104,10 @@ class AgentLayout
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('assigned_to', $this->auth->id)
->where('status', '1');
->where('status', '1');
} elseif ($this->auth->role == 'agent') {
return $ticket->where('assigned_to', $this->auth->id)
->where('status', '1');
->where('status', '1');
}
}
@@ -110,13 +116,13 @@ class AgentLayout
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('assigned_to', '=', null)
->where('status', '=', '1')
->select('id');
->where('status', '=', '1')
->select('id');
} elseif ($this->auth->role == 'agent') {
return $ticket->where('assigned_to', '=', null)
->where('status', '=', '1')
->where('dept_id', '=', $this->auth->primary_dpt)
->select('id');
->where('status', '=', '1')
->where('dept_id', '=', $this->auth->primary_dpt)
->select('id');
}
}
@@ -137,7 +143,7 @@ class AgentLayout
return $ticket->where('status', '5')->select('id');
} elseif ($this->auth->role == 'agent') {
return $ticket->where('status', '5')->where('dept_id', '=', $this->auth->primary_dpt)
->select('id');
->select('id');
}
}
@@ -151,7 +157,7 @@ class AgentLayout
return $table->Join('ticket_status', function ($join) {
$join->on('ticket_status.id', '=', 'tickets.status')
->whereIn('ticket_status.id', [1, 7]);
->whereIn('ticket_status.id', [1, 7]);
});
}
@@ -194,4 +200,45 @@ class AgentLayout
->whereRaw('date(duedate) = ?', [date('Y-m-d')]);
}
}
/**
* @category function to fetch closed tickets count
*
* @param null
*
* @return builder
*/
public function closed()
{
$table = $this->tickets();
if (Auth::user()->role == 'agent') {
$id = Auth::user()->id;
$dept = DepartmentAssignAgents::where('agent_id', '=', $id)->pluck('department_id')->toArray();
$table = $table->whereIn('tickets.dept_id', $dept)->orWhere('assigned_to', '=', Auth::user()->id);
// $id = Auth::user()->primary_dpt;
// $table = $table->where('tickets.dept_id', '=', $id)->orWhere('assigned_to', '=', Auth::user()->id);
}
return $table->where('status', 3);
}
/**
* @category function to check configured mails
*
* @param null
*
* @var $emails
*
* @return bool true/false
*/
public function getEmailConfig()
{
$emails = $this->emails->where('sending_status', '=', 1)->where('fetching_status', '=', 1)->count();
if ($emails >= 1) {
return true;
}
return false;
}
}

View File

@@ -23,7 +23,7 @@ class AuthUser
'auth_name' => $this->user->name(),
'auth_user_active' => $this->user->active,
'auth_user_primary_dept'=> $this->user->primary_dept,
'auth_user_assign_group'=> $this->user->assign_group,
'auth_user_assign_group'=> '', //$this->user->assign_group,
]);
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\ViewComposers;
use Illuminate\View\View;
class UserLanguage
{
public function __construct()
{
}
public function compose(View $view)
{
$path = base_path().DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'lang';
$langs = scandir($path);
$langs = array_diff($langs, ['.', '..']);
$languages = [];
foreach ($langs as $lang) {
$languages[$lang] = \Config::get('languages.'.$lang);
}
$view->with([
'langs' => $languages,
]);
}
}

View File

@@ -12,10 +12,9 @@
*/
Route::group(['middleware' => ['web']], function () {
Route::group(['middleware' => 'update', 'middleware' => 'install'], function () {
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
Auth::routes();
Route::post('login', ['uses' => 'Auth\AuthController@postLogin', 'as' => 'post.login']);
Route::get('auth/logout', ['uses' => 'Auth\AuthController@getLogout', 'as' => 'get.logout']);
Route::get('social/login/redirect/{provider}/{redirect?}', ['uses' => 'Auth\AuthController@redirectToProvider', 'as' => 'social.login']);
Route::get('social/login/{provider}', ['as'=>'social.login.callback', 'uses'=>'Auth\AuthController@handleProviderCallback']);
Route::get('social-sync', ['as'=>'social.sync', 'uses'=>'Client\helpdesk\GuestController@sync']);

View File

@@ -22,7 +22,7 @@ class Organization extends BaseModel
public function getUserIds()
{
$user_relations = $this->userRelation()->lists('user_id')->toArray();
$user_relations = $this->userRelation()->pluck('user_id')->toArray();
return $user_relations;
}

View File

@@ -29,7 +29,7 @@ class Filter extends Model
public function getTagsByTicketId($ticketid)
{
$filter = $this->where('key', 'tag')->where('ticket_id', $ticketid)->lists('value')->toArray();
$filter = $this->where('key', 'tag')->where('ticket_id', $ticketid)->pluck('value')->toArray();
return $filter;
}

View File

@@ -32,7 +32,7 @@ class Fields extends BaseModel
public function valuesAsString()
{
$string = '';
$values = $this->values()->lists('field_value')->toArray();
$values = $this->values()->pluck('field_value')->toArray();
if (count($values) > 0) {
$string = implode(',', $values);
}

View File

@@ -22,7 +22,7 @@ class SocialMedia extends Model
if ($key !== '' && $key !== 'redirect') {
$social = $this->where('provider', $provider)->where('key', $key)->first();
} elseif ($key !== 'redirect') {
$social = $this->where('provider', $provider)->lists('value', 'key')->toArray();
$social = $this->where('provider', $provider)->pluck('value', 'key')->toArray();
}
if (is_object($social)) {
$social = $social->value;

View File

@@ -116,7 +116,7 @@ class Ticket_ThreadOld extends Model
public function inlineAttachment($body)
{
if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) {
$search = $this->attach()->where('poster', 'INLINE')->lists('name')->toArray();
$search = $this->attach()->where('poster', 'INLINE')->pluck('name')->toArray();
foreach ($this->attach()->where('poster', 'INLINE')->get() as $key => $attach) {
$replace[$key] = "data:$attach->type;base64,".$attach->file;
}

View File

@@ -4,7 +4,9 @@ namespace App\Providers;
use App\Model\Update\BarNotification;
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\DuskServiceProvider;
use Queue;
use View;
@@ -23,33 +25,20 @@ class AppServiceProvider extends ServiceProvider
{
$this->app->bind('Illuminate\Contracts\Auth\Registrar');
require_once __DIR__.'/../Http/helpers.php';
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
}
// if (isInstall()) {
// $this->plugin();
// }
}
public function boot()
{
Queue::failing(function (JobFailed $event) {
loging('Failed Job - '.$event->connectionName, json_encode($event->data));
$failedid = $event->failedId;
//\Artisan::call('queue:retry',['id'=>[$failedid]]);
loging('Failed Job - '.$event->connectionName, json_encode([$event->job->payload(), 'error' => $event->exception->getMessage().' file=>'.$event->exception->getFile().' line=>'.$event->exception->getLine()]));
});
// Please note the different namespace
// and please add a \ in front of your classes in the global namespace
\Event::listen('cron.collectJobs', function () {
\Cron::add('example1', '* * * * *', function () {
$this->index();
return 'No';
});
\Cron::add('example2', '*/2 * * * *', function () {
// Do some crazy things successfully every two minute
});
\Cron::add('disabled job', '0 * * * *', function () {
// Do some crazy things successfully every hour
}, false);
});
Route::singularResourceParameters(false);
$this->composer();
}
@@ -63,4 +52,70 @@ class AppServiceProvider extends ServiceProvider
view()->share($not);
});
}
public function plugin()
{
if (isPlugin('Ldap') && $this->isPluginDir('Ldap')) {
$this->app->register(\App\Plugins\Ldap\ServiceProvider::class);
}
if (isPlugin('Chat') && $this->isPluginDir('Chat')) {
$this->app->register(\App\Plugins\Chat\ServiceProvider::class);
}
if (isPlugin('Envato') && $this->isPluginDir('Envato')) {
$this->app->register(\App\Plugins\Envato\ServiceProvider::class);
}
if (isPlugin('Htrunk') && $this->isPluginDir('Htrunk')) {
$this->app->register(\App\Plugins\Htrunk\ServiceProvider::class);
}
if (isPlugin('HtrunkDocs') && $this->isPluginDir('HtrunkDocs')) {
$this->app->register(\App\Plugins\HtrunkDocs\ServiceProvider::class);
}
if (isPlugin('Licenses') && $this->isPluginDir('Licenses')) {
$this->app->register(\App\Plugins\Licenses\ServiceProvider::class);
}
if (isPlugin('Migration') && $this->isPluginDir('Migration')) {
$this->app->register(\App\Plugins\Migration\ServiceProvider::class);
}
if (isPlugin('Reseller') && $this->isPluginDir('Reseller')) {
$this->app->register(\App\Plugins\Reseller\ServiceProvider::class);
}
if (isPlugin('SMS') && $this->isPluginDir('SMS')) {
$this->app->register(\App\Plugins\SMS\ServiceProvider::class);
}
if (isPlugin('ServiceDesk') && $this->isPluginDir('ServiceDesk')) {
$this->app->register(\App\Plugins\ServiceDesk\ServiceProvider::class);
}
if (isPlugin('Social') && $this->isPluginDir('Social')) {
$this->app->register(\App\Plugins\Social\ServiceProvider::class);
}
if (isPlugin('Telephony') && $this->isPluginDir('Telephony')) {
$this->app->register(\App\Plugins\Telephony\ServiceProvider::class);
}
if (isPlugin('Zapier') && $this->isPluginDir('Zapier')) {
$this->app->register(\App\Plugins\Zapier\ServiceProvider::class);
}
if ($this->isModuleDir('Location')) {
$this->app->register(\App\Location\LocationServiceProvider::class);
}
}
public function isPluginDir($name)
{
$check = false;
if (is_dir(app_path('Plugins'.DIRECTORY_SEPARATOR.$name))) {
$check = true;
}
return $check;
}
public function isModuleDir($name)
{
$check = false;
if (is_dir(app_path($name))) {
$check = true;
}
return $check;
}
}

View File

@@ -2,7 +2,6 @@
namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
@@ -13,7 +12,8 @@ class AuthServiceProvider extends ServiceProvider
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
'App\Model' => 'App\Policies\ModelPolicy',
\App\Model\helpdesk\Ticket\Tickets::class => \App\Policies\TicketPolicy::class,
];
/**
@@ -23,9 +23,9 @@ class AuthServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot(GateContract $gate)
public function boot()
{
parent::registerPolicies($gate);
parent::registerPolicies();
//
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
/*
* Authenticate the user's personal channel...
*/
Broadcast::channel('App.User.*', function ($user, $userId) {
return (int) $user->id === (int) $userId;
});
}
}

View File

@@ -13,10 +13,19 @@ class ComposerServiceProvider extends ServiceProvider
*/
public function boot()
{
$service_desk = '';
// if (isInstall()) {
// if (isPlugin()) {
// $service_desk = 'service::interface.agent.sidebar';
// }
// }
view()->composer(
[
'themes.default1.agent.layout.agent',
'themes.default1.agent.helpdesk.dashboard.dashboard',
'themes.default1.admin.layout.admin',
'themes.default1.admin.helpdesk.setting',
$service_desk,
], 'App\Http\ViewComposers\AgentLayout'
);
view()->composer(
@@ -30,6 +39,13 @@ class ComposerServiceProvider extends ServiceProvider
'themes.default1.admin.layout.admin',
], 'App\Http\ViewComposers\AuthUser'
);
view()->composer(
[
'themes.default1.admin.layout.admin',
'themes.default1.agent.layout.agent',
'themes.default1.client.layout.client',
], 'App\Http\ViewComposers\UserLanguage'
);
}
/**

View File

@@ -2,7 +2,6 @@
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
@@ -13,8 +12,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'event.name' => [
'EventListener',
'App\Events\WorkFlowEvent' => [
'App\Listeners\WorkFlowListen',
],
];
@@ -25,9 +24,9 @@ class EventServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot(DispatcherContract $events)
public function boot()
{
parent::boot($events);
parent::boot();
//
}

View File

@@ -3,12 +3,12 @@
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
@@ -19,28 +19,95 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
public function boot()
{
//
parent::boot($router);
parent::boot();
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
$this->mapInstallerRoutes();
$this->mapUpdateRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
public function map(Router $router)
protected function mapWebRoutes()
{
$router->group(['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
Route::group([
'middleware' => 'web',
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/web.php');
});
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::group([
'middleware' => 'api',
'namespace' => $this->namespace,
'prefix' => 'api',
], function ($router) {
require base_path('routes/api.php');
});
}
/**
* Define the "installer" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapInstallerRoutes()
{
Route::group([
'middleware' => ['web', 'installer'],
'namespace' => $this->namespace,
], function ($router) {
require base_path('routes/installer.php');
});
}
/**
* Define the "update" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapUpdateRoutes()
{
Route::group([
'middleware' => ['web', 'redirect', 'install'],
'namespace' => $this->namespace,
'prefix' => 'app/update',
], function ($router) {
require base_path('routes/update.php');
});
}
}

View File

@@ -125,7 +125,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
$id = $this->attributes['id'];
}
$info = new UserAdditionalInfo();
$infos = $info->where('owner', $id)->lists('value', 'key')->toArray();
$infos = $info->where('owner', $id)->pluck('value', 'key')->toArray();
return $infos;
}