Missing required parameters for [Route: ] – Laravel 7

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}', '[email protected]');
});

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

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.