Laravel redirect HttpException error - laravel

I'm trying to
Redirect::route('some_route');
I'm getting this error
throw new MethodNotAllowedHttpException($others);
Can anyone help me?

Redirect::route() sends GET request. You must have POST or some method set as the handler. Please change the route to handle GET request and you will be fine.

Related

Laravel Middleware exception returns json

Somewhere in my app I have made a change so that whenever a middleware faces an exception it return json.
Route::get('/profile/edit', 'UserController#edit')->middleware('auth');
I want it to redirect to /login however it returns {"error":"Unauthenticated"}.
I can't find where I have made the change... Any Ideas? :)
You have probably edited app\Exceptions\Handler.php

MethodNotAllowedHttpException when using Route::delete

I don't know why I get this
I tested the route with
Route::delete("/attachments/{url}","TrixAttachmentController#destroyAttachment");
localhost:3000/api/v1/attachments?url=hDXtilCleTWc6WyiMeWpp9O0xIx3cRyJuEwVPxzL.jpeg
public function destroyAttachment($url){
dd($url);
}
still i get it
localhost:3000/api/v1/attachments?url=hDXtilCleTWc6WyiMeWpp9O0xIx3cRyJuEwVPxzL.jpeg
here ?url it shows it now using get request
call this route via delete method
can you show form
When using the Route::delete, the request is expecting a POST request with a method of DELETE.
If you are hitting the route in the browser using a GET request, this is the sort of error that will be thrown.
If you are calling the route in a browser you need to change that.
Make sure you are calling it on a form using DELETE verb.

Laravel, api, postman

I am following a grafikart tutorial on the back-end of an API under laravel, but creating a comment module, and since yesterday I have this message why. I think that I come from a call or from a space name but I know ... on postman also it returns to me errors.
postman:
error message:
Add the model namespace to your call, make sure you have a method called allFor
$comments = \App\Comment::allFor();

How to Log Laravel 404 Error With Details

Just as in the title, I am getting a 404 error in my Log but don't know where/why this error is happening cause my App is working fine without a problem.
Is there a way for me to log the error in details (the referral link) e.g
Error
[2014-11-30 05:44:13] production.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /home/domain/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:146
Details
Detail: User tried to access route http://domain.com/users
Thanks, any help will be appreciated.
App::missing(function($exception)
{
Log::error( Request::url() );
return Response::view('errors.missing', array(), 404);
});
or use Request::fullUrl() this includes query strings in the URL
You need to make the view.

MethodNotAllowedHttpException with lucadegasperi/oauth2-server-laravel's included AccessTokenFlow POST route

This is my first Laravel project I'm on, and it has been a ton of fun so far.
I'm setting up an OAuth2 server. I have copied the code posted here in to my routes file.
Via this block of code...
Route::post('oauth/access_token', function()
{
return AuthorizationServer::performAccessTokenFlow();
});
I have tried doing http://local.server.com/oauth/access_token and a "MethodNotAllowedHttpException" error.
If there is any other information I could provide that would help you help me, please tell me!
Cheers
If you are typing http://local.server.com/oauth/access_token into the browser URL bar, then you are sending the request:
GET oauth/access_token
However, your route handles a POST request, and since there is no GET route defined, Laravel is responding with MethodNotAllowedHttpException
In order to properly test your route, you will need to send a POST request.

Resources