如何在 laravel 中应用 class1 函数和 class2 函数?
我在我的页面中使用 laravel-nova,laravel 是开发的后端。
public function actions(){
return [new DownloadExcel];
}
在我的项目中,nova actions()
函数正在使用 DownloadExcel 操作,该操作负责下载我正在使用的 excel 文件 laravel excel 包。
我想将所有单元格列转换为全局字符串,为此我编写了一个名为 customExcel.php
的自定义类,它扩展了 DownloadExcel.php
以及我为其编写的逻辑将所有单元格列转换为 customeExcel.php
文件中的字符串,现在我必须更改所有出现的 actions()
就像下面的代码片段一样,它工作正常,但我需要一些建议在不改变所有事件的情况下有什么方法可以加载加载了自定义Excel类以及DownloadExcel类,请给我一些建议..
public function actions(){
return [new CustomExcel];
}
i am using laravel-nova for my pages and laravel is the backend for development.
public function actions(){
return [new DownloadExcel];
}
in my project nova actions()
functions are using DownloadExcel action which is responsible for downloading the excel file for that i am using laravel excel package.
i want to convert all the cell columns as a string globally,for that i write one custom class called customExcel.php
which extends DownloadExcel.php
along with that i wrote logic for converting all cells column to string inside the customeExcel.php
file, now i have to change all occurrences of actions()
like following snippet then it's working fine but i need some suggestion without changing all occurrences is there any way to load the customExcel class along with the DownloadExcel class loaded,please give me some suggestions..
public function actions(){
return [new CustomExcel];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于类是扩展的,因此您只需实现一个对象。所以你需要再次实例。
Since a class is extended you only implement one object. so you need to instance again.