芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/app/Http/Controllers/Admin/SubscriberController.php
middleware('auth:admin'); } //*** JSON Request public function datatables() { $datas = Subscriber::orderBy('id','desc'); //--- Integrating This Collection Into Datatables return Datatables::of($datas) ->addColumn('sl', function(Subscriber $data) { $id = 1; return $id++; }) ->toJson();//--- Returning Json Data To Client Side } //*** GET Request public function index() { return view('admin.subscribers.index'); } //*** GET Request public function download() { // Code for generating csv file header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=subscribers.csv'); $output = fopen('php://output', 'w'); fputcsv($output, array('Subscribers Emails')); $result = Subscriber::all(); foreach ($result as $row){ fputcsv($output, $row->toArray()); } fclose($output); } }