Merge pull request #4185 from howdu/master

Fix error with missing locale and error with route:list
This commit is contained in:
Jitendra Singh 2020-10-28 18:34:50 +05:30 committed by GitHub
commit c2480ef1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 15 deletions

View File

@ -43,7 +43,9 @@ class InvoiceController extends Controller
$this->middleware('auth:' . $this->guard);
}
$this->repository = app($this->_config['repository']);
if ($this->_config) {
$this->repository = app($this->_config['repository']);
}
}
/**

View File

@ -12,7 +12,7 @@ class ResourceController extends Controller
* @var array
*/
protected $guard;
/**
* Contains route related configuration
*
@ -45,7 +45,9 @@ class ResourceController extends Controller
$this->middleware('auth:' . $this->guard);
}
$this->repository = app($this->_config['repository']);
if ($this->_config) {
$this->repository = app($this->_config['repository']);
}
}
/**
@ -58,8 +60,8 @@ class ResourceController extends Controller
$query = $this->repository->scopeQuery(function($query) {
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $query->where('customer_id', auth()->user()->id );
}
}
foreach (request()->except(['page', 'limit', 'pagination', 'sort', 'order', 'token']) as $input => $value) {
$query = $query->whereIn($input, array_map('trim', explode(',', $value)));
}
@ -89,11 +91,11 @@ class ResourceController extends Controller
* @return \Illuminate\Http\Response
*/
public function get($id)
{
$query = isset($this->_config['authorization_required']) && $this->_config['authorization_required'] ?
$this->repository->where('customer_id', auth()->user()->id)->findOrFail($id) :
{
$query = isset($this->_config['authorization_required']) && $this->_config['authorization_required'] ?
$this->repository->where('customer_id', auth()->user()->id)->findOrFail($id) :
$this->repository->findOrFail($id);
return new $this->_config['resource']($query);
}
@ -108,7 +110,7 @@ class ResourceController extends Controller
$wishlistProduct = $this->repository->findOrFail($id);
$this->repository->delete($id);
return response()->json([
'message' => 'Item removed successfully.',
]);

View File

@ -71,7 +71,7 @@
{!! view_render_event('bagisto.admin.layout.head') !!}
</head>
<body @if (core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
<body @if (core()->getCurrentLocale() && core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
<div id="app" class="container">
<flash-wrapper ref='flashes'></flash-wrapper>

View File

@ -39,7 +39,7 @@
</head>
<body @if (core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
<body @if (core()->getCurrentLocale() && core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
{!! view_render_event('bagisto.shop.layout.body.before') !!}
@ -103,7 +103,7 @@
@endif
window.serverErrors = [];
@if (isset($errors))
@if (count($errors))
window.serverErrors = @json($errors->getMessages());

View File

@ -20,7 +20,7 @@
<link rel="stylesheet" href="{{ asset('themes/velocity/assets/css/velocity.css') }}" />
<link rel="stylesheet" href="{{ asset('themes/velocity/assets/css/bootstrap.min.css') }}" />
@if (core()->getCurrentLocale()->direction == 'rtl')
@if (core()->getCurrentLocale() && core()->getCurrentLocale()->direction == 'rtl')
<link href="{{ asset('themes/velocity/assets/css/bootstrap-flipped.css') }}" rel="stylesheet">
@endif
@ -45,7 +45,7 @@
</style>
</head>
<body @if (core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif>
<body @if (core()->getCurrentLocale() && core()->getCurrentLocale()->direction == 'rtl') class="rtl" @endif>
{!! view_render_event('bagisto.shop.layout.body.before') !!}
@include('shop::UI.particals')