The parameter necessary for [Route: admin.request.update] is missing. The required URI is admin/request/{request}, and the missing parameter is 'request'

When attempting to access detail.blade.php, I encountered an error stating "Missing required parameter for [Route: admin.request.update] [URI: admin/request/{request}] [Missing parameter: request]." Despite following the steps and codes exactly as in my previous project where it worked (editing data), I am unsure of what went wrong.

Below is the code from my detail.blade.php:

 <form action="{{ route('admin.request.update', $requestStock) }}" method="POST">
                @csrf
                {{ method_field('PUT') }}
                <div class="form-group row">
                    <label for="name" class="col-sm-2 col-form-label">Name</label>
                    <div class="col-sm-10">
                        <textarea class="form-control" id="name" name="name" rows="3" readonly value="{{ $requestStock->name }}"></textarea>
                    </div>
                </div>
                <div class="form-group row">
                    <label for="status" class="col-sm-2 col-form-label">Complete</label>
                    <div class="col-sm-10">
                        <select class=" form-control" name="status" id="status">
                            <option name="status" value="1" {{ $requestStock->status == '1' ? 'selected' : ''}}> Not Completed </option>
                            <option name="status" value="0" {{ $requestStock->status == '0' ? 'selected' : ''}}> Complete </option>
                        </select>
                    </div>
                </div>
                <button type="submit" class="btn btn-secondary" style="margin-top: 20px; width: 100%">Update</button>
            </form>

And here are the relevant functions from my RequestPageController:

public function edit(RequestStock $requestStock)
{
    return view('admin.request.detail')->with([
        'requestStock' => $requestStock,
    ]);
}

public function update(Request $request, RequestStock $requestStock)
{
    $requestStock->status = $request->status;
    $requestStock->save();

    return redirect()->route('admin.request.index');
}

Route Configuration:

 Route::namespace("App\Http\Controllers\Admin")->prefix("admin")->name("admin.")->middleware('can:adminpage')->group(function () {
     Route::resource("/request", RequestPageController::class);
 });

Thank you.

Answer №1

Here are some recommended modifications:

Altered Route:

Route::namespace("App\Http\Controllers\Admin")->prefix("admin")->name("admin.")->middleware('can:adminpage')->group(function () {
     Route::resource("/request-stock", RequestPageController::class);
 });

Updated RequestPageController:

public function edit(RequestStock $requestStock)
{
    return view('admin.request-stock.detail')->with([
        'requestStock' => $requestStock,
    ]);
}

public function update(Request $request, RequestStock $requestStock)
{
    $requestStock->status = $request->status;
    $requestStock->save();

    return redirect()->route('admin.request-stock.index');
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Capture a snapshot of a webpage that includes an embedded iframe

Currently, we have a nodeJS/angular 4 website that contains an iframe from a third party (powerBI Emebdded). Our goal is to develop a feature that allows the end user to capture a screenshot of the entire page, including the content within the iframe. We ...

Run a PHP script on the current page upon choosing an option from a dropdown list with the help of Ajax or JavaScript

I'm currently working on a MySQL query that needs to be executed when a user selects options from multiple dropdown lists. What I am looking for is the ability to automatically run a query related to the selected dropdown list option using AJAX/JavaS ...

CodeIgniter - Utilizing quotes within a form

Consider a scenario where the database has a field named NAME which contains text with both single and double quotes: TEST1 "TEST2" 'TEST3' Now, if you want to edit this value using the following code in a form: <label for="name">Ful ...

Extracting information from several span elements within the main span class using BeautifulSoup

I'm currently attempting to extract data from the following HTML code: <span class="double-line-ellipsis"> <span> ₹ 2800 for 2 (approx) </span> <span> | </span> <a data-w-onclick="stopClickPropagation|w1-re ...

Is there a way to display the next/previous buttons separately from the scroller in my jQuery thumbnail scroller implementation?

Is there a method to display the next and previous buttons outside of the scroller frame when using jQuery thumbnail scroller by manos.malihu.gr? I have attempted to modify the button class in CSS to make them more prominent or visible, but unfortunately ...

Step-by-step guide on setting up a click counter that securely stores data in a text file, even after the

Can anyone help me make this link actually function as intended? Right now it only runs the JavaScript code, but I would like it to run the code and redirect to a webpage. Additionally, I need the data to be saved to a text file. Please provide assistanc ...

Maintain the scrollable feature of the element until the final content is reached

I'm struggling to come up with the right keywords to search for my issue. I've tried using Google, but it seems my search terms are not effective. The problem I'm facing involves two relative div elements with dynamic content. This means th ...

Remove all HTML tags except for those containing a specific class

Looking for a regex that removes all HTML tags except the "a" tags with the "classmark" class For example, given this HTML string: <b>this</b> <a href="#">not match</a> <a href="#" target="_blank" ...

Experiencing issues when trying to invoke an action through the console with Zend Framework 2?

While I can easily call the action using console by defining the console based path in module.config.php, I am facing issues when trying to call an http request based action within the console based action. Here is the code snippet where I encounter an er ...

Is there a way to showcase the elements in my array using a foreach loop in PHP

I am having trouble displaying the values from my array using a foreach() loop. Here is the array in question: Array( [0] => Array( [projectId] => 2[seDate] => 2017 - 04 - 13[startTime] => 06: 57[taskToDo] => testing[studen ...

What is the best way to interact with the dynamic Twitter follow button using Selenium and Python?

Trying to interact with Twitter's follow button can be challenging, especially when it is dynamic and has attributes that are not well-documented in the Selenium documentation. Below is a snippet of the HTML code for the button: Below you will see my ...

Utilizing the Neo4j Index Search with the NeoJ-REST-PHP-API Client

I am facing an issue with the Index Lookup functionality while using the PHP API Client. Initially, I am able to successfully create a node and index it without any problems. However, when I attempt to perform a lookup using the following curl command: c ...

The view has no access to $scope but the controller does

I need to display the iso code using a $scope when selecting a country from a list. The list of countries is fetched through a $http call in a factory and then stored in a scope. ///////// get countries //////////////// tableFactory.getCountries().then(f ...

Obtaining the highest index value within an array

Here is an example of an array: $number= array( array([0]=>2,[1]=>2) array([0]=>2,[1]=>2,[2]=>2,[3]=>2) array([0]=>2,[1]=>2,[2]=>2) array([0]=>2,[1]=>2) ) T ...

In PHP, there may be instances where certain words are not displayed properly, even if they do not

I am facing an unusual issue where I am extracting data from SQL Server using Xammp server and displaying it in a browser using PHP with JSON output. Some of the strings that I want to display on the browser have descriptions like: "**Delightfully warming ...

Modify the color of the text to be white

How can I modify the code below to change the text color to white? The original code is inspired by this question. I am unsure about how the text color was originally set to blue. .footer-background { padding-top: 20px; padding-bottom: 20px; bac ...

Can administration users view the same content and functionalities as other user types?

I am currently working on a Laravel web application that caters to two distinct types of users: customers admins Depending on their user type, they have access to different features and functionalities. Customers When customers log in, they are greete ...

Cannot interact with controller method via ajax

I am currently facing an issue with sending data back to a controller, which should then pass it to a model. Upon hitting the submit button (with all fields filled in), I receive a success response triggering the confirmation dropdown. However, the brand/ ...

What is the best way to format these div elements in order to create a functional comment section?

For the past few hours, I've been struggling to figure out what’s causing issues with the styling on my webpage. The layout should display a user post on one side and a comment-section along with the comment form on the other. Within the PostComment ...

CakePHP and Legacy Ajax Script Integration

I have an old script that I want to integrate into a cakephp application. The script uses $_POST and I'm not very experienced with this, so I need some assistance with the integration. This is what the script consists of: THE JAVASCRIPT: prototype ...