Please explain in the OrdersController controller file:

use App\Repositories\OrderRepository; public function __construct(OrderRepository $orders) { $this->orders = $orders; } 

What is the OrderRepository here? Class, interface? And why is it written like this in the constructor argument along with its own object? In native php did not see this

  • one
    I'm afraid you need to read for OOP and then start working with frameworks ... you can see the class or interface by going to the OrderRepository on the keyword before the name - Ep1demic
  • I found this example in the documentation, but the orderrepository itself is not there. And I know perfectly well what a class and interface are. I just need a case study clarification - Artur Han
  • Well, then I can advise you not to expect ALL to be described in the documentation for a specific example. Try to abstract from the implementations of the elements used in the documentation and try to focus on the described feature. - Ep1demic 4:34 pm
  • Read the documentation first, especially the section about the service container. This is the so-called dependency injection. And if you haven’t seen this in native php - this is php7 with typed parameters of methods - Maxim K

0