Answer the question
In order to leave comments, you need to log in
How does the redirect()->send() function work with sessions?
I call a redirect in a class that is called in the controller
redirect()->route('error')->with('message', $exception->getMessage())->send();
Route::get('/error', function (Request $request) {
$value = $request->session()->get('message', function () {
return 'default';
});
echo $value;
})->name('error');
message
is always default. What could be the problem? $imageUploader->upload()->resize();
public function resize($width, $height, $dirForSave, $quality = 100)
{
$params = [
'width' => $width,
'height' => $height,
'dirForSave' => $dirForSave
];
try {
$this->validateResizeParams($params);
if (!is_null($this->file)) {
//Тут уменьшаю изображение
} else {
// Throw Exception
}
} catch (Exception $exception) {
Log::error($exception->getMessage());
FileHelper::deleteDir($this->filePath);
redirect()->route('error')->with('message', $exception->getMessage())->send();
}
}
Answer the question
In order to leave comments, you need to log in
Solved the problem with the functionabort(500, 'error message');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question