More Related Content
Similar to Laravelの良いところ (20)
Laravelの良いところ
- 20. class BookController extends Controller {
protected $service;
public function __construct(BookService $service) {
$this->service = $service;
}
public function index(Request $request) {
//
}
}
class BookService {
protected $bookRepository;
public function __construct(BookRepositoryInterface $bookRepository) {
$this->bookRepository = $bookRepository;
}
}
app()->bind(BookRepositoryInterface::class, BookRepository::class);
- 21. • BookController index
(※1)
• BookController BookService
(※2)
• BookService
(※1)
• BookService
BookRepositoryInterface (※2)
• BookRepositoryInterface BookRepository
BookRepository (※1)
BookService
• BookController index Request
(※2) (※1)