I do not get this error on production server which is laravel 5. I did a version upgrade and after I'm getting this error. I don't really know if version upgrade caused this.But I'm getting this error in laravel 7.
Error- Missing required parameters for [Route: ] [URI: users/{user_id}/privacy-groups-modal/{list_id}] [Missing parameters: user_id, list_id]. (View: /opt/lampp/htdocs/php/resources/views/wishlist/show.blade.php)
Web.php
Route::group(['middleware' => ['imageOptimizer', 'auth']], function() {
Route::get('users/{user_id}/privacy-groups-modal/{list_id}', 'UserController@getPrivacyGroupsModel');
});
show.blade.php
reffer the commented
//Error Line:
var link = '';
//Error line
$(document).on('changed.bs.select', '.privacy-selector', function (e, clickedIndex, newValue, oldValue) {
if (!triggeredByClick)
changeTriggered = true;
var _self = $(this);
var val = _self.selectpicker('val');
var prevValue = oldValue;
if ($.isNumeric(val)) {
var privacy_level = _self.find('option[value='+val+']').attr('data-type');
if (privacy_level == 'custom') {
var link = ''; //Error line
link = link.replace('list_id', _self.attr('data-list-id'));
$.ajax({
url: link
})
.done(function(response) {
privacy_group_modal = bootbox.dialog({
title: '@lang("app.my_privacy_groups")',
message: response,
backdrop: false,
animate: false,
buttons: {
cancel: {
label: '@lang("app.cancel")',
className: 'btn-default',
callback: function () {
privacy_group_modal = null;
bootbox.hideAll();
_self.selectpicker('val', prevValue);
_self.selectpicker('refresh');
}
}
}
});
$('input[type=hidden][name=list_id]').val(_self.attr('data-list-id'));
})
.fail(function() {
$.toast({
heading: 'Error',
text: '@lang("app.error_occurred")',
showHideTransition: 'slide',
hideAfter: 2000,
position: 'top-center',
icon: 'error',
afterHidden: function () {
_self.selectpicker('val', prevValue);
_self.selectpicker('refresh');
}
});
});
} else {
var link = '';
link = link.replace('list_id', _self.attr('data-list-id'));
link = link.replace('level_id', val);
$.ajax({
url: link,
})
.done(function() {
$.toast({
heading: 'Success',
text: '@lang("app.successfully_updated")',
showHideTransition: 'slide',
hideAfter: 5000,
position: 'top-center',
icon: 'success'
});
})
.fail(function() {
$.toast({
heading: 'Error',
text: '@lang("app.error_occurred")',
showHideTransition: 'slide',
hideAfter: 2000,
position: 'top-center',
icon: 'error',
afterHidden: function () {
_self.selectpicker('val', prevValue);
_self.selectpicker('refresh');
}
});
});
}
}
if (triggeredByClick)
triggeredByClick = false
});
UserController.php
public function getPrivacyGroupsModel($user_id, $list_id)
{
$validator = Validator::make([
'user_id' => $user_id,
'list_id' => $list_id
], [
'user_id' => 'required|exists:users,id',
'list_id' => 'required|exists:wishlists,id',
]);
if ($validator->fails()) {
return response()->json($validator->errors()->all(), 422);
}
$privacy_level_custom = $this->privacy_level_repository
->getPrivacyLevelByName('Custom');
$privacy_groups_of_user = $this->privacy_group_repository
->getPrivacyGroupsByUserId((int) $user_id);
$wishlist = $this->wishlist_repository
->getWishlistById((int) $list_id);
return view()->make('user.partials._privacy-groups-modal', [
'wishlist' => $wishlist,
'level_id' => $privacy_level_custom->id,
'share_with_groups' => $privacy_groups_of_user->where('type', PrivacyGroup::TYPE_SHARE_WITH),
'unshare_with_groups' => $privacy_groups_of_user->where('type', PrivacyGroup::TYPE_DONT_SHARE_WITH)
])
->render();
}
Is this a problem with JQuery syntax after upgrade? Help would be much appreciated
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3CxUkE4
via IFTTT
Aucun commentaire:
Enregistrer un commentaire