草庐IT

php - Laravel 上的存储库模式

我想使用RepositoryPattern但我被语法困住了。我想获取我的函数index()。第一步,我创建文件夹Repositories并创建文件AuteurRepository.php在我的文件AuteurController中我有这个:publicfunctionindex(){$auteurs=Auteur::oldest()->paginate(5);returnview('admin.auteurs.index',compact('auteurs'))->with('i',(request()->input('page',1)-1)*5);}在我的模型中我只有一个文件Aute