Answer the question
In order to leave comments, you need to log in
Is it possible to pass a variable from a method to an intermediary (middleware)?
All health! Please help me understand.
For example, I have a FooController controller with a myMethod method, and myMiddleware middleware
The route says: Route::post('/slug','[email protected]');
The controller says:
#...
class FooController extends Controller
{
public function __construct()
{
$this->middleware('myMiddleware', ['only' => ['myMethod']]);
}
public function myMethod(Request $request)
{
#...
}
#...
}
Answer the question
In order to leave comments, you need to log in
You probably have a problem with the encoding in the excel file.
there is a character in the file that cannot be displayed in ASKII
This contradicts the meaning of the mediator, because the meaning in it is to call the method after checking if everything is OK or throw an error if not.
If you want to call a check from a method, then you should just use some kind of helper class, and not specifically middleware.
a question arose, since middleware is being discussed here, is
it possible to call the midlleware handle method directly from the controller and how to do it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question