I am at the top of the controller method:
namespace App\Http\AdminControllers;
public function signIn(Request $request) {
return redirect()->intended('Am/Index/index', $request);
}
This will jump to the index method of the Index controller, but now the problem is coming. Instead of jumping, the program reports an error:
Object of class Illuminate\Http\Request could not be converted to int
But I have always written like this before...I don’t know why I reported an error. I just forwarded the request.
Please give me your opinions, thank you all.
PHP中文网2017-05-27 17:44:18
Of course you are not right
Let’s take a look at the definition of intended
https://laravel.com/api/5.1/I...
RedirectResponse intended(string $default = '/', int $status = 302, array $headers = array(), bool $secure = null)
The first parameter is the URL to jump to, the default is homepage
The second parameter is the http status code, the default is 302, and the int type is required because it is a redirection
Looking at your usage method, you passed the $request object in the second parameter. This required parameter does not meet the requirements
So the error could not be converted to int
is that it cannot be converted into int type
迷茫2017-05-27 17:44:18
namespace App\Http\AdminControllers;
use Illuminate\Http\Request; // 加上这一行导入这个类即可
public function signIn(Request $request) {
return redirect()->intended('Am/Index/index', $request);
}