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,44 +2,31 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated 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. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* * @param string|null ...$guards
* @return mixed * @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;
return redirect(url('dashboard'));
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(url('dashboard'));
}
} }
return $next($request); return $next($request);
} }
} }

View File

@@ -1,10 +1,24 @@
<?php <?php
/** use Illuminate\Contracts\Http\Kernel;
* Laravel - A PHP Framework For Web Artisans. use Illuminate\Http\Request;
*
* @author Taylor Otwell <taylorotwell@gmail.com> 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;
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -12,46 +26,30 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Composer provides a convenient, automatically generated class loader for | Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it | this 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 | into the script here so we don't need to manually load our classes.
| loading any of our classes later on. It feels nice to relax.
| |
*/ */
require __DIR__.'/../bootstrap/autoload.php'; require __DIR__.'/../vendor/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';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Run The Application | Run The Application
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Once we have the application, we can handle the incoming request | Once we have the application, we can handle the incoming request using
| through the kernel, and send the associated response back to | the application's HTTP kernel. Then, we will send the response back
| the client's browser allowing them to enjoy the creative | to this client's browser, allowing them to enjoy our application.
| and wonderful application we have prepared for them.
| |
*/ */
$kernel = $app->make('Illuminate\Contracts\Http\Kernel'); $app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle( $response = $kernel->handle(
$request = Illuminate\Http\Request::capture() $request = Request::capture()
); )->send();
$response->send(); $kernel->terminate($request, $response);
$kernel->terminate($request, $response);

View File

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