php - Using RedirecResponse outside Laravel
Get the solution ↓↓↓Solution:
There is a simple and clean way to do this, I came here looking to do the same thing and this page showed me that simply adding a call to->send()
on a response will send the response. In your case, thelogin
method could look like this:
public function login($data)
{
$success = Auth::attempt([
'user' => $data['user'],
'password' => $data['password'],
], $data['remember']);
if ($success) {
$response = redirect()->to(url('/'));
$response->send();
return $response;
}
}
If there is a single spot in your integration where you are calling your controller methods, it would make more sense to place the call there so that you don't actually call->send()
from within your controller (as Laravel doesn't).
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: fastcgi sent in stderr: "primary script unknown" while reading response header from upstream
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.