0

I am creating a web site. So , there is a table to show users. In my database, I stored 0 for the Pending and 1 for the Approved under Action column. If some user has 0 , Pending will be displayed in this table and if the user has 1 Approved will be displayed. Now I want to when someone clicks this Pending button, I want to update database value to 1. I tried it as below. But , when I click Pending button, it gives me this error -

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message

And also I was unable to update the database value.

How Can I Fix this ??

View Page ( AdminPanel.blade.php )

 <table class="table table-bordered">

            <tr>
                <td> Action</td>
            </tr>

            @foreach($data as $value )
                <tr>
                    @if($value->action ==0)
                        <td><a href="actionedit/{{ $value->id }}"><input type="submit" name="pending" value="Pending"
                                                                         class="btn btn-warning"></a></td>
                    @else
                        <td><a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Approved"
                                                                   class="btn btn-success"></a></td>
                    @endif
                </tr>
            @endforeach
        </table>

Controller. ( AdminPanelController.php )

public function actionedit(Request $request)
    {
        // Add Validation

        DB::table('users')
            ->update(['action' => 1]);

            $request->session()->flash('Msg', 'Successfully Updated !!');

            return redirect('adminPanel');

    }

Route.

Route::put('/actionedit/{id}', 'AdminPanelController@actionedit');

1 Answer 1

3

You are requesting get not put change it to get http verb

Route::get('/actionedit/{id}', 'AdminPanelController@actionedit');

or use ajax to request as post or put

Sign up to request clarification or add additional context in comments.

5 Comments

Now it's Working 100% Perfectly !! Thank U Very Much !! :D
I would expect more from you: This question was caused by a problem that can no longer be reproduced or a simple typographical error. We can argue that put != get (is not a typo), but its so simple mistake that you could have posted comment and let OP delete the question.
@Kyslik : I appreciate your thought :)
@Amithash : Please revert your acceptance so that I can remove my answer. It is normal sense for route concept and not longer learning thing I found here. Also Please remove the question. After all you found the solution.
Well received critique, did not expect that. No matter the outcome +1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.