Laravel on submit The POST method is not supported for this route. Supported methods: GET, HEAD.

QuestionsLaravel on submit The POST method is not supported for this route. Supported methods: GET, HEAD.
Raghu prasad asked 4 years ago

I have also added the CSRF Token in meta tag and also include below jquery

 

<divclass=”box-body”>
<div>{!! $phpgrid_output !!}</div>
</div>
<scripttype=”text/javascript”>
$.ajaxSetup({headers: {‘X-CSRF-TOKEN’:$(‘meta[name=”csrf-token”]’).attr(‘content’)}});
</script>
</div>

 

 

{ “message”: “The POST method is not supported for this route. Supported methods: GET, HEAD.”, “exception”: “Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException”, “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php”, “line”: 256, “trace”: [ { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php”, “line”: 242, “function”: “methodNotAllowed”, “class”: “Illuminate\\Routing\\RouteCollection”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php”, “line”: 176, “function”: “getRouteForMethods”, “class”: “Illuminate\\Routing\\RouteCollection”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Router.php”, “line”: 634, “function”: “match”, “class”: “Illuminate\\Routing\\RouteCollection”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Router.php”, “line”: 623, “function”: “findRoute”, “class”: “Illuminate\\Routing\\Router”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Router.php”, “line”: 612, “function”: “dispatchToRoute”, “class”: “Illuminate\\Routing\\Router”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php”, “line”: 176, “function”: “dispatch”, “class”: “Illuminate\\Routing\\Router”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 30, “function”: “Illuminate\\Foundation\\Http\\{closure}”, “class”: “Illuminate\\Foundation\\Http\\Kernel”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/fideloper/proxy/src/TrustProxies.php”, “line”: 57, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 163, “function”: “handle”, “class”: “Fideloper\\Proxy\\TrustProxies”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 53, “function”: “Illuminate\\Pipeline\\{closure}”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php”, “line”: 21, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 163, “function”: “handle”, “class”: “Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 53, “function”: “Illuminate\\Pipeline\\{closure}”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php”, “line”: 21, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 163, “function”: “handle”, “class”: “Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 53, “function”: “Illuminate\\Pipeline\\{closure}”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php”, “line”: 27, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 163, “function”: “handle”, “class”: “Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 53, “function”: “Illuminate\\Pipeline\\{closure}”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php”, “line”: 62, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 163, “function”: “handle”, “class”: “Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php”, “line”: 53, “function”: “Illuminate\\Pipeline\\{closure}”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php”, “line”: 104, “function”: “Illuminate\\Routing\\{closure}”, “class”: “Illuminate\\Routing\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php”, “line”: 151, “function”: “then”, “class”: “Illuminate\\Pipeline\\Pipeline”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php”, “line”: 116, “function”: “sendRequestThroughRouter”, “class”: “Illuminate\\Foundation\\Http\\Kernel”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/public/index.php”, “line”: 55, “function”: “handle”, “class”: “Illuminate\\Foundation\\Http\\Kernel”, “type”: “->” }, { “file”: “/Applications/MAMP/htdocs/laraadmin/server.php”, “line”: 21, “function”: “require_once” } ] }

1 Answers
Abu Ghufran Staff answered 4 years ago

Hi,

Please follow this guides step3: https://www.gridphp.com/laravel-datagrid/

Step3: Setting Routes

The Last step in this tutorial is to set the routes to our controller. We will use both GET and POST routes as our grid uses both methods.

Hopfully this should solve it.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

6 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 4

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?