I have a form and I'm trying to pass null value into the $dev-id
parameter but it doesnt work, instead ti will replace the dev id parameter with the $id
as shown in my code at the bottom,
The reason i needed it to be null because I'm using this function for 2 different page but one of the page doesn't have $dev_id
. any help is appreciated
HTML:
<form method="post"
action="{{ route('admin.developers.admins.edit.post',['admin' => $admin, 'dev_id' => null, 'id' => $id]) }}" autocomplete="off" novalidate>
web.php:
Route::post('developers/{dev_id?}/admins/{id}/edit', 'Admin\DeveloperAdminController@postEditDeveloperAdmin')->name('admin.developers.admins.edit.post')->where(['dev_id' => '[0-9]+', 'id' => '[0-9]+']);
You can pass those parametres in the form of hidden input and in controller use request to get those values Add these to yur form
<input type="hidden" value="anything" name="dev_id">
Instead you are using vue use `v-model` instead of name and value
Now modify your form like this
<form method="post"
action="{{ route('admin.developers.admins.edit.post',['admin' => $admin,'id' => $id]) }}" autocomplete="off" novalidate>
Now you are access that using $request
object in your logic and check if the value is null or not
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.