diff --git a/README.md b/README.md index 2517100..498b3f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Eloquent Report Generator -This package can be used to generates reports from Eloquent models +This package can be used to generate reports from Eloquent models in many formats, such as CSV, PDF, Markdown, and HTML. ## Installation @@ -16,6 +16,24 @@ does not do this for you. ## Usage +First, add the `Reportable` trait to the model or models you wish to +create reports from. + +```php +namespace App; + +use Illuminate\Database\Eloquent\Model; +use LangleyFoxall\EloquentReportGenerator\Traits\Reportable; + +class User extends Model +{ + use Reportable; + + // ... +``` + +You can then generate reports elsewhere in your application by calling the static `generateReport` method from this trait. + See the following code snippet for example usage. ```php @@ -45,4 +63,4 @@ User::generateReport() $name->value = ucwords($name); } ->save(storage_path('app/report.csv')); -``` \ No newline at end of file +```