laravel-8 changes

This commit is contained in:
RafficMohammed
2023-01-08 02:16:25 +05:30
parent 6c8e2a8c71
commit 0433640426
3 changed files with 63 additions and 77 deletions

View File

@@ -2,43 +2,30 @@
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next, ...$guards)
{
if ($this->auth->check()) {
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(url('dashboard'));
}
}
return $next($request);
}

View File

@@ -1,57 +1,55 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans.
*
* @author Taylor Otwell <taylorotwell@gmail.com>
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);

View File

@@ -10,7 +10,8 @@ use App\Http\Controllers\Job;
use App\Http\Controllers\Update;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs;
use Illuminate\Support\Facades\Lang;
/*
|--------------------------------------------------------------------------
| Application Routes
@@ -23,7 +24,7 @@ use Illuminate\Support\Facades\Route;
*/
Route::middleware('web')->group(function () {
Route::middleware('install', 'update')->group(function () {
Auth::routes();
\Illuminate\Support\Facades\Auth::routes();
Route::post('login', [Auth\AuthController::class, 'postLogin'])->name('post.login');
Route::post('auth/register', [Auth\AuthController::class, 'postRegister'])->name('post.register');
Route::post('password/reset', [Auth\PasswordController::class, 'reset'])->name('post.reset');
@@ -277,8 +278,8 @@ Route::middleware('web')->group(function () {
*/
Route::resource('labels', 'Admin\helpdesk\Label\LabelController');
Route::get('labels-ajax', [Admin\helpdesk\Label\LabelController::class, 'ajaxTable'])->name('labels.ajax');
Route::get('labels/delete/{id}', [Admin\helpdesk\Label\LabelController::class, 'destroy'])->name('labels.destroy');
// Route::get('labels-ajax', [Admin\helpdesk\Label\LabelController::class, 'ajaxTable'])->name('labels.ajax');
// Route::get('labels/delete/{id}', [Admin\helpdesk\Label\LabelController::class, 'destroy'])->name('labels.destroy');
Route::get('clean-dummy-data', [Admin\helpdesk\SettingsController::class, 'getCleanUpView'])->name('clean-database');
Route::post('post-clean-dummy-data', [Admin\helpdesk\SettingsController::class, 'postCleanDummyData'])->name('post-clean-database');
@@ -378,12 +379,12 @@ Route::middleware('web')->group(function () {
Route::get('/get-parent-tickets/{id}', [Agent\helpdesk\TicketController::class, 'getParentTickets'])->name('get.parent.ticket');
Route::patch('/merge-tickets/{id}', [Agent\helpdesk\TicketController::class, 'mergeTickets'])->name('merge.tickets');
//To get department tickets data
//open tickets of department
Route::get('/get-open-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getOpenTickets'])->name('get.dept.open');
//close tickets of deartment
Route::get('/get-closed-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getCloseTickets'])->name('get.dept.close');
//in progress ticket of department
Route::get('/get-under-process-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getInProcessTickets'])->name('get.dept.inprocess');
// //open tickets of department
// Route::get('/get-open-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getOpenTickets'])->name('get.dept.open');
// //close tickets of deartment
// Route::get('/get-closed-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getCloseTickets'])->name('get.dept.close');
// //in progress ticket of department
// Route::get('/get-under-process-tickets/{id}', [Agent\helpdesk\Ticket2Controller::class, 'getInProcessTickets'])->name('get.dept.inprocess');
// route for graphical reporting
Route::get('report', [Agent\helpdesk\ReportController::class, 'index'])->name('report.index'); /* To show dashboard pages */
@@ -399,14 +400,14 @@ Route::middleware('web')->group(function () {
/*
* Label
*/
Route::get('labels-ticket', [Admin\helpdesk\Label\LabelController::class, 'attachTicket'])->name('labels.ticket');
Route::get('json-labels', [Admin\helpdesk\Label\LabelController::class, 'getLabel'])->name('labels.json');
// Route::get('labels-ticket', [Admin\helpdesk\Label\LabelController::class, 'attachTicket'])->name('labels.ticket');
// Route::get('json-labels', [Admin\helpdesk\Label\LabelController::class, 'getLabel'])->name('labels.json');
/*
* Tags
*/
Route::get('add-tag', [Agent\helpdesk\Filter\TagController::class, 'addToFilter'])->name('tag.add');
Route::get('get-tag', [Agent\helpdesk\Filter\TagController::class, 'getTag'])->name('tag.get');
// Route::get('add-tag', [Agent\helpdesk\Filter\TagController::class, 'addToFilter'])->name('tag.add');
// Route::get('get-tag', [Agent\helpdesk\Filter\TagController::class, 'getTag'])->name('tag.get');
Route::middleware('force.option', 'role.agent')->group(function () {
Route::get('tickets', [Agent\helpdesk\TicketController::class, 'getTicketsView'])->name('tickets-view');
@@ -729,12 +730,12 @@ Route::middleware('web')->group(function () {
/*
* Webhook
*/
\Event::listen('ticket.details', function ($details) {
\Illuminate\Support\Facades\Event::listen('ticket.details', function ($details) {
$api_control = new \App\Http\Controllers\Common\ApiSettings();
$api_control->ticketDetailEvent($details);
});
Route::get('test', [Common\PushNotificationController::class, 'response'])->name('test');
// Route::get('test', [Common\PushNotificationController::class, 'response'])->name('test');
Route::get('mail/config/service', [Job\MailController::class, 'serviceForm'])->name('mail.config.service');
/*