Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to update the app id/secret #92

Merged
merged 6 commits into from
Nov 12, 2015
Merged

Allow to update the app id/secret #92

merged 6 commits into from
Nov 12, 2015

Conversation

kxgio
Copy link

@kxgio kxgio commented Oct 15, 2015

usage:
$fb = App::make('SammyK\LaravelFacebookSdk\LaravelFacebookSdk');
$fb->updateAppIdSecret('your_app_id', 'your_app_secret');

@SammyK
Copy link
Owner

SammyK commented Oct 15, 2015

Thanks for the PR!

I think this would be better if we could send in an all new $config array so that different apps could use different options (like different versions of Graph for example). You can just array_merge() the existing config so that it will fallback to the original instance config for unspecified options.

Also the method should be named newInstance() and return a new instance of itself:

return new static($config);

@SammyK
Copy link
Owner

SammyK commented Oct 21, 2015

Hey @kxgen! Just wanted to check in with you to see if you'd be able to update your PR based on my feedback. If not, l can get in there and make the patch. :)

@kxgio
Copy link
Author

kxgio commented Oct 22, 2015

Hi @SammyK , sorry to reply you so late, I just follow your guide and change the update method.
So now we can use something like this to update app info:

$new_config = ['app_id' => 'you_app_id', 'app_secret' => 'you_app_secret'];
$fb->newInstance($new_config)->post('things you want to do');

right?

{
$new_config = array_merge($this->default_config, $config);

return new static($this->config_handler, $this->url, $config);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be passing in $new_config as the 3rd arg

@SammyK
Copy link
Owner

SammyK commented Oct 22, 2015

Thanks @kxgen! Just change based on my comments and it should be good to pull in. :)

@kxgio
Copy link
Author

kxgio commented Oct 22, 2015

:)

@SammyK SammyK merged commit 816aea7 into SammyK:2.0 Nov 12, 2015
SammyK added a commit that referenced this pull request Nov 12, 2015
@SammyK
Copy link
Owner

SammyK commented Nov 12, 2015

Thanks! :)

SammyK added a commit that referenced this pull request Nov 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants