Removed Extra Middlewares

This commit is contained in:
Devansh 2022-03-31 16:58:52 +05:30
parent b22bfb2bd7
commit 22b1725d85
23 changed files with 18 additions and 79 deletions

View File

@ -38,8 +38,6 @@ class ConfigurationController extends Controller
*/
public function __construct(CoreConfigRepository $coreConfigRepository)
{
$this->middleware('admin');
$this->coreConfigRepository = $coreConfigRepository;
$this->_config = request('_config');

View File

@ -66,8 +66,6 @@ class CustomerController extends Controller
) {
$this->_config = request('_config');
$this->middleware('admin');
$this->customerRepository = $customerRepository;
$this->customerAddressRepository = $customerAddressRepository;

View File

@ -32,8 +32,6 @@ class CustomerGroupController extends Controller
{
$this->_config = request('_config');
$this->middleware('admin');
$this->customerGroupRepository = $customerGroupRepository;
}

View File

@ -100,8 +100,6 @@ class DashboardController extends Controller
) {
$this->_config = request('_config');
$this->middleware('admin');
$this->orderRepository = $orderRepository;
$this->orderItemRepository = $orderItemRepository;

View File

@ -7,16 +7,6 @@ use Webkul\Admin\Exports\DataGridExport;
class ExportController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('admin');
}
/**
* Export datagrid.
*

View File

@ -47,8 +47,6 @@ class InvoiceController extends Controller
OrderRepository $orderRepository,
InvoiceRepository $invoiceRepository
) {
$this->middleware('admin');
$this->_config = request('_config');
$this->orderRepository = $orderRepository;

View File

@ -43,8 +43,6 @@ class OrderController extends Controller
OrderCommentRepository $orderCommentRepository
)
{
$this->middleware('admin');
$this->_config = request('_config');
$this->orderRepository = $orderRepository;

View File

@ -51,8 +51,6 @@ class RefundController extends Controller
OrderItemRepository $orderItemRepository,
RefundRepository $refundRepository
) {
$this->middleware('admin');
$this->_config = request('_config');
$this->orderRepository = $orderRepository;

View File

@ -51,8 +51,6 @@ class ShipmentController extends Controller
OrderRepository $orderRepository,
OrderItemRepository $orderItemRepository
) {
$this->middleware('admin');
$this->_config = request('_config');
$this->orderRepository = $orderRepository;

View File

@ -52,8 +52,6 @@ class TransactionController extends Controller
OrderRepository $orderRepository,
OrderTransactionRepository $orderTransactionRepository,
InvoiceRepository $invoiceRepository) {
$this->middleware('admin');
$this->_config = request('_config');
$this->orderRepository = $orderRepository;

View File

@ -1,29 +1,22 @@
<?php
use Illuminate\Support\Facades\Route;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\User\Http\Controllers\ForgetPasswordController;
use Webkul\User\Http\Controllers\ResetPasswordController;
use Webkul\User\Http\Controllers\SessionController;
use Webkul\Notification\Http\Controllers\Admin\NotificationController;
/**
* Auth routes.
* Notification routes.
*/
Route::group(['middleware' => ['web', 'admin_locale'], 'prefix' => config('app.admin_url')], function () {
// notification
Route::get('notifications', 'Webkul\Notification\Http\Controllers\Admin\NotificationController@index')->defaults('_config', [
Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => config('app.admin_url')], function () {
Route::get('notifications', [NotificationController::class, 'index'])->defaults('_config', [
'view' => 'admin::notifications.index',
])->name('admin.notification.index');
// get notification
Route::get('get-notifications', 'Webkul\Notification\Http\Controllers\Admin\NotificationController@getNotifications')
Route::get('get-notifications', [NotificationController::class, 'getNotifications'])
->name('admin.notification.get-notification');
//view order
Route::get('viewed-notifications/{orderId}', 'Webkul\Notification\Http\Controllers\Admin\NotificationController@viewedNotifications')
Route::get('viewed-notifications/{orderId}', [NotificationController::class, 'viewedNotifications'])
->name('admin.notification.viewed-notification');
// read all notification
Route::post('read-all-notifications', 'Webkul\Notification\Http\Controllers\Admin\NotificationController@readAllNotifications')
Route::post('read-all-notifications', [NotificationController::class, 'readAllNotifications'])
->name('admin.notification.read-all');
});

View File

@ -30,8 +30,6 @@ class PageController extends Controller
*/
public function __construct(CmsRepository $cmsRepository)
{
$this->middleware('admin');
$this->cmsRepository = $cmsRepository;
$this->_config = request('_config');

View File

@ -18,8 +18,6 @@ class AccountController extends Controller
*/
public function __construct()
{
$this->middleware('customer');
$this->_config = request('_config');
}

View File

@ -36,8 +36,6 @@ class AddressController extends Controller
*/
public function __construct(CustomerAddressRepository $customerAddressRepository)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = auth()->guard('customer')->user();

View File

@ -54,8 +54,6 @@ class CustomerController extends Controller
ProductReviewRepository $productReviewRepository,
SubscribersListRepository $subscriptionRepository
) {
$this->middleware('customer');
$this->_config = request('_config');
$this->customerRepository = $customerRepository;

View File

@ -22,8 +22,6 @@ class SessionController extends Controller
*/
public function __construct()
{
$this->middleware('customer')->except(['show', 'create']);
$this->_config = request('_config');
}

View File

@ -8,14 +8,14 @@ use Webkul\Notification\Repositories\NotificationRepository;
class NotificationController extends Controller
{
/**
* Contains route related configuration
* Contains route related configuration.
*
* @var array
*/
protected $_config;
/**
* NotificationRepository
* Notification repository instance.
*
* @var object
*/
@ -30,8 +30,6 @@ class NotificationController extends Controller
{
$this->notificationRepository = $notificationRepository;
$this->middleware('admin');
$this->_config = request('_config');
}
@ -56,7 +54,7 @@ class NotificationController extends Controller
if (isset($params['page'])) {
unset($params['page']);
}
}
if (count($params)) {
$searchResults = $this->notificationRepository->getParamsData($params);
@ -71,26 +69,26 @@ class NotificationController extends Controller
}
/**
* Update the notification is readed or not
* Update the notification is readed or not.
*
* @param int $orderId
* @return \Illuminate\View\View
*/
public function viewedNotifications($orderId)
{
if ($notification = $this->notificationRepository->where('order_id', $orderId)->first()) {
$notification->read = 1;
$notification->save();
return redirect()->route('admin.sales.orders.view',$orderId);
}
return redirect()->route('admin.sales.orders.view', $orderId);
}
abort(404);
}
/**
* Update the notification is readed or not
* Update the notification is readed or not.
*
* @return array
*/
@ -99,8 +97,8 @@ class NotificationController extends Controller
$this->notificationRepository->where('read', 0)->update(['read' => 1]);
$params = [
"limit" => 5,
"read" => 0
'limit' => 5,
'read' => 0,
];
$searchResults = $this->notificationRepository->getParamsData($params);
@ -108,9 +106,7 @@ class NotificationController extends Controller
return [
'search_results' => $searchResults,
'total_unread' => $this->notificationRepository->where('read', 0)->count(),
'success_message' => trans('admin::app.notification.notification-marked-success')
'success_message' => trans('admin::app.notification.notification-marked-success'),
];
abort(404);
}
}

View File

@ -25,8 +25,6 @@ class DownloadableProductController extends Controller
DownloadableLinkPurchasedRepository $downloadableLinkPurchasedRepository
)
{
$this->middleware('customer');
$this->downloadableLinkPurchasedRepository = $downloadableLinkPurchasedRepository;
parent::__construct();

View File

@ -43,8 +43,6 @@ class OrderController extends Controller
OrderRepository $orderRepository,
InvoiceRepository $invoiceRepository
) {
$this->middleware('customer');
$this->currentCustomer = auth()->guard('customer')->user();
$this->orderRepository = $orderRepository;

View File

@ -20,8 +20,6 @@ class TaxController extends Controller
*/
public function __construct()
{
$this->middleware('admin');
$this->_config = request('_config');
}

View File

@ -40,8 +40,6 @@ class RoleController extends Controller
RoleRepository $roleRepository,
AdminRepository $adminRepository
) {
$this->middleware('admin');
$this->roleRepository = $roleRepository;
$this->adminRepository = $adminRepository;

View File

@ -18,8 +18,6 @@ class SessionController extends Controller
*/
public function __construct()
{
$this->middleware('admin')->except(['create', 'store']);
$this->_config = request('_config');
}

View File

@ -49,8 +49,6 @@ class UserController extends Controller
$this->roleRepository = $roleRepository;
$this->_config = request('_config');
$this->middleware('guest', ['except' => 'destroy']);
}
/**