A
A
Andrey Pushkin2019-09-29 22:16:21
Laravel
Andrey Pushkin, 2019-09-29 22:16:21

How do variables get into the controller?

For example, there is a method in the controller:

public function foo(Request $request){
 $file = $request->file();
.......
}

Where to dig to understand how the request got into the controller, because I actually don’t call it inside. I just don't even know what I need to google.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Pushkin, 2019-11-16
@a_pussycan

This is autowiring

J
JhaoDa, 2019-09-29
@JhaoDa

Google Dependency Injection and Inversion of Control, read the Laravel documentation (you won’t believe it is there!) and Diving Laravel , study the framework code.

A
Anton R., 2019-09-29
@anton_reut

This piece - "Request $request" means that only an object of type Request can get into the variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question