Skip to content

Commit d1a6a4a

Browse files
authored
Merge pull request #11 from vitorccs/feature/add_importing_feature
Adds CSV Importing feature
2 parents 31f0cff + e324835 commit d1a6a4a

File tree

97 files changed

+2831
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2831
-555
lines changed

README.md

Lines changed: 219 additions & 50 deletions
Large diffs are not rendered by default.

src/Concerns/Exportable.php renamed to src/Concerns/Exportables/Exportable.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

3-
namespace Vitorccs\LaravelCsv\Concerns;
3+
namespace Vitorccs\LaravelCsv\Concerns\Exportables;
44

55
use Illuminate\Foundation\Bus\PendingDispatch;
66
use Symfony\Component\HttpFoundation\StreamedResponse;
7+
use Vitorccs\LaravelCsv\Entities\CsvConfig;
78
use Vitorccs\LaravelCsv\Facades\CsvExporter;
89
use Vitorccs\LaravelCsv\Helpers\CsvHelper;
910

@@ -17,6 +18,22 @@ public function limit(): ?int
1718
return null;
1819
}
1920

21+
/**
22+
* @return CsvConfig
23+
*/
24+
public function getConfig(): CsvConfig
25+
{
26+
return CsvExporter::getConfig();
27+
}
28+
29+
/**
30+
* @param CsvConfig $config
31+
*/
32+
public function setConfig(CsvConfig $config): void
33+
{
34+
CsvExporter::setConfig($config);
35+
}
36+
2037
/**
2138
* @return int
2239
*/
@@ -68,6 +85,14 @@ public function queue(?string $filename = null,
6885
return CsvExporter::queue($this, $this->getFilename($filename), $disk, $diskOptions);
6986
}
7087

88+
/**
89+
* @return resource
90+
*/
91+
public function stream()
92+
{
93+
return CsvExporter::stream($this);
94+
}
95+
7196
/**
7297
* @param string|null $filename
7398
* @return string

src/Concerns/FromArray.php renamed to src/Concerns/Exportables/FromArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Vitorccs\LaravelCsv\Concerns;
3+
namespace Vitorccs\LaravelCsv\Concerns\Exportables;
44

55
interface FromArray
66
{

src/Concerns/FromCollection.php renamed to src/Concerns/Exportables/FromCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Vitorccs\LaravelCsv\Concerns;
3+
namespace Vitorccs\LaravelCsv\Concerns\Exportables;
44

55
use Illuminate\Support\Collection;
66
use Illuminate\Support\LazyCollection;

src/Concerns/FromQuery.php renamed to src/Concerns/Exportables/FromQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace Vitorccs\LaravelCsv\Concerns;
3+
namespace Vitorccs\LaravelCsv\Concerns\Exportables;
44

5-
use Illuminate\Database\Query\Builder;
65
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
6+
use Illuminate\Database\Query\Builder;
77

88
interface FromQuery
99
{

src/Concerns/FromQueryCursor.php renamed to src/Concerns/Exportables/FromQueryCursor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Vitorccs\LaravelCsv\Concerns;
3+
namespace Vitorccs\LaravelCsv\Concerns\Exportables;
44

55
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
66
use Illuminate\Database\Query\Builder;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Vitorccs\LaravelCsv\Concerns\Importables;
4+
5+
interface FromContents
6+
{
7+
/**
8+
* @return string
9+
*/
10+
public function contents(): string;
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Vitorccs\LaravelCsv\Concerns\Importables;
4+
5+
interface FromDisk
6+
{
7+
/**
8+
* @return string|null
9+
*/
10+
public function disk(): ?string;
11+
12+
/**
13+
* @return string
14+
*/
15+
public function filename(): string;
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Vitorccs\LaravelCsv\Concerns\Importables;
4+
5+
interface FromFile
6+
{
7+
/**
8+
* @return string
9+
*/
10+
public function filename(): string;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Vitorccs\LaravelCsv\Concerns\Importables;
4+
5+
interface FromResource
6+
{
7+
/**
8+
* @return resource
9+
*/
10+
public function resource();
11+
}

0 commit comments

Comments
 (0)