Skip to content

Commit

Permalink
Restructure to use static function.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Aug 4, 2019
1 parent 867d120 commit dfe5827
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/FacileServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ class FacileServiceProvider extends ServiceProvider implements DeferrableProvide
*/
public function register()
{
$this->app->singleton('orchestra.facile', function (Application $app) {
$factory = new Factory($app, $app->make('request'));
$template = new Template\Simple($app->make('view'), new Transformable());
$this->app->singleton('orchestra.facile', static function (Application $app) {
return \tap(new Factory($app, $app->make('request')), function ($factory) use ($app) {
$template = new Template\Simple($app->make('view'), new Transformable());

$factory->name('default', $template);
$factory->name('simple', $template);

return $factory;
$factory->name('default', $template);
$factory->name('simple', $template);
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Template/Composers/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function streamCsv(array $data = [], $status = 200, array $config = []):

$collection = $this->convertToCsvable($data, $config);

return Response::stream(function () use ($collection) {
return Response::stream(static function () use ($collection) {
$collection->streamCsv();
}, $status, [
'Content-Type' => 'text/csv',
Expand Down

0 comments on commit dfe5827

Please sign in to comment.