Skip to content

Commit 2fde479

Browse files
authored
Update README.md
1 parent 7d9f218 commit 2fde479

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
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).
99

10-
## Installation
11-
The package must be installed directly from [Composer](https://getcomposer.org/).
12-
Run the following command:
10+
## Installation
1311
```
1412
$ composer require cyber-duck/laravel-excel
1513
```
1614

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.
1816

1917
Note. If you are on Laravel 4, use *Cyberduck\LaravelExcel\ExcelLegacyServiceProvider*
2018

@@ -59,11 +57,12 @@ return Exporter::make('Excel')->load($yourCollection)->save($yourFileNameWithPat
5957
```
6058

6159
### Advanced usage
62-
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.
6362

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.
6766

6867
Example
6968
```
@@ -79,7 +78,7 @@ class ExampleSerialiser implements SerialiserInterface
7978
$row = [];
8079
8180
$row[] = $data->field1;
82-
$row[] = $data->relation->field2;
81+
$row[] = $data->relationship->field2;
8382
8483
return $row;
8584
}
@@ -88,7 +87,7 @@ class ExampleSerialiser implements SerialiserInterface
8887
{
8988
return [
9089
'Field 1',
91-
'Field 2 (from a relation)'
90+
'Field 2 (from a relationship)'
9291
];
9392
}
9493
}

0 commit comments

Comments
 (0)