Laravel
Helper 함수 - app()
Sein_
2023. 9. 24. 11:55
728x90
app()
- The app function returns the service container instance:
$container = app();
- You may pass a class or interface name to resolve it from the container:
$api = app('HelpSpot\API');
- 실제 코드 적용 예시
(실제 Searcher 클래스에 접근하여 사용)
public function 주문_조회_실제()
{
$searcher = app(Searcher::class);
$result = $searcher->search(new SearchRequest());
$this->assertIsObject($result);
}
참고
https://laravel.com/docs/10.x/helpers#method-app
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
laravel.com