You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,12 @@
7
7
8
8
This package provides a way to export an Eloquent collection as an excel file and to import a Excel file as an Eloquent collection. It's based on [box/spout](https://github.com/box/spout).
9
9
10
-
## Installation
11
-
The package must be installed directly from [Composer](https://getcomposer.org/).
12
-
Run the following command:
10
+
## Installation
13
11
```
14
12
$ composer require cyber-duck/laravel-excel
15
13
```
16
14
17
-
To make Facades available, register the service provider in config/app.php adding *Cyberduck\LaravelExcel\ExcelServiceProvider* to the provider array.
15
+
Register the service provider in config/app.php adding *Cyberduck\LaravelExcel\ExcelServiceProvider* to the provider array.
18
16
19
17
Note. If you are on Laravel 4, use *Cyberduck\LaravelExcel\ExcelLegacyServiceProvider*
By default, every element of the Collection become a row and every unprotected field of the Model become a cell. No headers row is printed.
60
+
By default, every element of the Collection becomes a row and every unprotected field of the Model becomes a cell.
61
+
No headers row is printed.
63
62
64
-
To change this behaviour, create a class extending *Cyberduck\LaravelExcel\Contract\SerialiserInterface* and implement the methods *getHeaderRow()* and *getData(Model $data)*.
65
-
*getHeaderRow()* must return an array of string, and every elements is a cell of the first row. To not print the header row, simply return a void array *[]*.
66
-
*getData(Model $data)* must return an array of string, and every elements is a cell of rows after the header.
63
+
To change this behaviour, create a class which extends *Cyberduck\LaravelExcel\Contract\SerialiserInterface* and implements the methods *getHeaderRow()* and *getData(Model $data)*.
64
+
*getHeaderRow()* must return an array of string where every element is a cell of the first row. To not print the header row, simply return a void array *[]*.
65
+
*getData(Model $data)* must return an array of string, and every elements is a cell.
67
66
68
67
Example
69
68
```
@@ -79,7 +78,7 @@ class ExampleSerialiser implements SerialiserInterface
79
78
$row = [];
80
79
81
80
$row[] = $data->field1;
82
-
$row[] = $data->relation->field2;
81
+
$row[] = $data->relationship->field2;
83
82
84
83
return $row;
85
84
}
@@ -88,7 +87,7 @@ class ExampleSerialiser implements SerialiserInterface
0 commit comments