|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Finder\Pipelines\Identify; |
|
4
|
|
|
|
|
5
|
|
|
use League\Pipeline\Pipeline; |
|
6
|
|
|
use Operador\Contracts\StageInterface; |
|
7
|
|
|
|
|
8
|
|
|
class FileType |
|
9
|
|
|
{ |
|
10
|
|
|
public static function run($file) |
|
|
|
|
|
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public static function excell($eloquentClasses) |
|
|
|
|
|
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
// $collection = (new FastExcel)->configureCsv(';', '#', '\n', 'gbk') //, 'gbk' |
|
19
|
|
|
// // $collections = (new FastExcel) |
|
20
|
|
|
// ->import( |
|
21
|
|
|
// storage_path('app/'.$file), |
|
22
|
|
|
// function ($line) use ($fileName, $assuntosDaPasta) { |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
// $arrayData = []; |
|
26
|
|
|
|
|
27
|
|
|
// // Caso Finances |
|
28
|
|
|
// $modelClass = \Casa\Models\Economic\Gasto::class; |
|
29
|
|
|
// foreach ($line as $name=>$column) { |
|
30
|
|
|
// $name = StringModificator::clean($name); |
|
31
|
|
|
// $column = StringModificator::clean($column); |
|
32
|
|
|
// $indice = 'obs'; |
|
33
|
|
|
// // $arrayData[$name] = $column; |
|
34
|
|
|
// if ($name == 'DATA') { |
|
35
|
|
|
// $indice = 'data'; |
|
36
|
|
|
// } else if ($name == 'VALOR') { |
|
37
|
|
|
// $indice = 'value'; |
|
38
|
|
|
// $column = floatval($column); |
|
39
|
|
|
// // $indice = 'amount'; |
|
40
|
|
|
// } else if ($name == 'TIPO') { |
|
41
|
|
|
// // $indice = 'type'; |
|
42
|
|
|
// $indice = 'description'; |
|
43
|
|
|
// } |
|
44
|
|
|
|
|
45
|
|
|
// $arrayData[$indice] = $column; |
|
46
|
|
|
// } |
|
47
|
|
|
|
|
48
|
|
|
// dd( |
|
49
|
|
|
// $line, |
|
50
|
|
|
// $modelClass.'::create', |
|
51
|
|
|
// $arrayData |
|
52
|
|
|
// ); |
|
53
|
|
|
|
|
54
|
|
|
// $this->info('Importing '.$fileName); |
|
55
|
|
|
// return call_user_func( |
|
56
|
|
|
// $modelClass.'::create', |
|
57
|
|
|
// $arrayData |
|
58
|
|
|
// ); |
|
59
|
|
|
// } |
|
60
|
|
|
// ); |
|
61
|
|
|
} |
|
62
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.