jailtonsc / laravel-response-xml

Add the method xml integrating the laravel's response, converting eloquent return to XML.
46 stars 15 forks source link

Localized configurations #17

Open robinwkurtz opened 6 years ago

robinwkurtz commented 6 years ago

Hello! Thanks for the great package.

I was wondering if there was any interest in allowing the configuration to be local and therefore overwrite the global configuration. In my case I need to output multiple xml files with different template & rowNames.

Thanks!

jailtonsc commented 6 years ago

Hi, I'm sorry for the delay in answering, my computer is in trouble, I sent it to the concert.

Yes I have, could you develop and commit?

Att.

robinwkurtz commented 6 years ago

Submitted a PR https://github.com/jailtonsc/laravel-response-xml/pull/18 to replace the class variables form private to protected so I can extend the XmlResponse class and override the construct function.

Thanks!

jailtonsc commented 6 years ago

Sorry for the delay, these days I'm without a computer at home.

I made the merge.

robinwkurtz commented 6 years ago

No worries! Thanks for the merge :)

jailtonsc commented 6 years ago

Hello,

I made the local setting adjustment, make sure the setting suppresses your need.

You are in version 3.0

Example

$config = [ 'template' => '', 'rowName' => 'name' ];

Route::get('/', function () { return response()->xml(User::all(), 200, $config); });

Att.