所以我在刀片視圖文件上有一個表,我已成功將其導出到 Excel 文件中?,F在我想導出而不導出“操作”列。我該怎么做?我在下面附上了我的代碼和刀片文件,它工作得很好。我只想導出除操作列之外的所有內容,因為它包含用于數據庫操作的按鈕這是我的出口類別代碼:public function view(): View{ return view ('ims.view_inventory_history_table', [ 'data' => inbound_history::all() ]);}public function headings(): array{ return [ 'ID', 'Warehouse', 'SKU', 'Child SKU', 'Units', 'Invoice No.', 'Container No.', 'Entry Date' ];}/** * @return array */public function registerEvents(): array{ return [ AfterSheet::class => function(AfterSheet $event) { $cellRange = 'A1:W1'; // All headers $event->sheet->getDelegate()->getStyle($cellRange)->getFont()->setSize(14); }, ];}}這是我的控制器功能:public function export_view(){ return Excel::download(new inboundHistory(), 'inboundHistory.xlsx');}這是我的路線:Route::Get('inbound_history/export_view' ,'imsController@export_view')->name('inbound_history.export_view');
1 回答

12345678_0001
TA貢獻1802條經驗 獲得超5個贊
我不知道我是否正確理解了一切,但你為什么不做這樣的事情:
$isView當您想要為用戶創建視圖時,將附加變量傳遞到您的刀片模板,例如。
在 Blade.php 模板中,您可以執行以下操作:
@isset($isView)
<th class="disabled-sorting text-right" style="width:12%">Actions</th>
@endisset
// do the same @isset test for the corresponding <td> element
當您想要將其呈現為 Excel 時,您只需不傳遞此變量并且不會呈現該列。
- 1 回答
- 0 關注
- 136 瀏覽
添加回答
舉報
0/150
提交
取消