| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 8 | CRAP | 0.00% covered (danger) | 0.00% | 0 / 20
ExcelController | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 8 | 90.00 | 0.00% covered (danger) | 0.00% | 0 / 20
index | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
create | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
store | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
makeExcel | 0.00% covered (danger) | 0.00% | 0 / 1 | 6.00 | 0.00% covered (danger) | 0.00% | 0 / 13
show | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
edit | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
update | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1
destroy | 0.00% covered (danger) | 0.00% | 0 / 1 | 2.00 | 0.00% covered (danger) | 0.00% | 0 / 1

1 | <?php
2 |
3 | namespace App\Http\Controllers;
4 |
5 | use App\Exports\GoodsNeateningExcelExport;
6 | use App\GoodsNeateningExcel;
7 | use Carbon\Carbon;
8 | use Illuminate\Http\Request;
9 | use Illuminate\Support\Facades\DB;
10 | use Illuminate\Support\Facades\Storage;
11 | use Maatwebsite\Excel\Facades\Excel;
12 | use function foo\func;
13 |
14 | class ExcelController extends Controller
15 | {
16 | /**
17 | * Display a listing of the resource.
18 | *
19 | * @return \Illuminate\Http\Response
20 | */
21 | public function index()
22 | {
23 | }
24 |
25 | /**
26 | * Show the form for creating a new resource.
27 | *
28 | * @return \Illuminate\Http\Response
29 | */
30 | public function create()
31 | {
32 |
33 | }
34 |
35 | /**
36 | * Store a newly created resource in storage.
37 | *
38 | * @param \Illuminate\Http\Request $request
39 | * @return \Illuminate\Http\Response
40 | */
41 | public function store(Request $request)
42 | {
43 | //
44 | }
45 | public function makeExcel()
46 | {
47 | ini_set('memory_limit', '512M');
48 |
49 | $goodsesExcelArray=[['barcode','weight','id','key','time','url']];
50 | $handler=fopen('d:/newdws10.json','r');
51 | $json = fread($handler, filesize('d:/newdws10.json'));
52 | $json = '[' . $json . ']';
53 | $jsonArr=json_decode($json,true);
54 | foreach ($jsonArr as $obj){
55 | $url = $obj['url']??'';
56 | $barcode=$obj['barcode'].' ';
57 | array_push($goodsesExcelArray,[$barcode,$obj['weight'],$obj['id'].' '
58 | ,$obj['key'],$obj['time'], $url]);
59 | }
60 | Excel::store(new GoodsNeateningExcelExport($goodsesExcelArray),'exportedJson.xlsx','public');
61 | return ['result'=>'success'];
62 | }
63 |
64 | /**
65 | * Display the specified resource.
66 | *
67 | * @param \App\GoodsNeateningExcel $goodsNeateningExcel
68 | * @return \Illuminate\Http\Response
69 | */
70 | public function show(GoodsNeateningExcel $goodsNeateningExcel)
71 | {
72 | //
73 | }
74 |
75 | /**
76 | * Show the form for editing the specified resource.
77 | *
78 | * @param \App\GoodsNeateningExcel $goodsNeateningExcel
79 | * @return \Illuminate\Http\Response
80 | */
81 | public function edit(GoodsNeateningExcel $goodsNeateningExcel)
82 | {
83 | //
84 | }
85 |
86 | /**
87 | * Update the specified resource in storage.
88 | *
89 | * @param \Illuminate\Http\Request $request
90 | * @param \App\GoodsNeateningExcel $goodsNeateningExcel
91 | * @return \Illuminate\Http\Response
92 | */
93 | public function update(Request $request, GoodsNeateningExcel $goodsNeateningExcel)
94 | {
95 | //
96 | }
97 |
98 | /**
99 | * Remove the specified resource from storage.
100 | *
101 | * @param \App\GoodsNeateningExcel $goodsNeateningExcel
102 | * @return \Illuminate\Http\Response
103 | */
104 | public function destroy(GoodsNeateningExcel $goodsNeateningExcel)
105 | {
106 | //
107 | }
108 | }