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

Use passed request before fallback to global one #34

Merged
merged 10 commits into from
Jun 15, 2016
Merged

Use passed request before fallback to global one #34

merged 10 commits into from
Jun 15, 2016

Conversation

f-liva
Copy link
Contributor

@f-liva f-liva commented Jun 14, 2016

When a $request parameter is provided, storeCrud and updateCrud uses that before fallback to global request instance:

public function store(StoreRequest $request)
{
    // alter original request...

    return parent::storeCrud($request);
}

public function update(UpdateRequest $request)
{
    // alter original request...

    return parent::updateCrud($request);
}

If the parameter is not passed, as before, the used request will be \Request::instance()

@tabacitu
Copy link
Member

Hmm... I've come to trust you, @fede91it , so I'll definitely merge this last commit, but I'm just wondering - where did you encounter this problem and when can the request be null?

Thanks!

@f-liva
Copy link
Contributor Author

f-liva commented Jun 14, 2016

Through store or update methods are called the relative storeCrud or updateCrud methods. but they always use the global request instance instead of using their $request parameter, that by default was set to null.

With the check, I add I choose to use the global request only if the passed parameter isn't present, as before, but I use it if there is. This behavior is useful to manipulate the request sent by the admin form before its parameters will be stored by crud controller.

Please let me know if I sent any wrong or nonsense PR. I really want to help the project because the project is helping me a lot, so I want to contribute to say ma thank you.

@tabacitu tabacitu merged commit 9504a5b into Laravel-Backpack:master Jun 15, 2016
@tabacitu
Copy link
Member

You're perfectly right. Don't worry about it, it's not nonsense, I just wanted to understand it and sometimes I'm a bit thick headed :-) You're doing a great job, by the way, you're probably already the #2 contributor to the package :-)

I merged it now, thanks!

PS. Please remember to do a git pull in your fork every time before you publish a PR, otherwise github will merge all your PRs into one. For now it's manageable, but soon enough it will be difficult to understand what each PR does. (note: i'm not sure this is the solution, i'm just guessing)

Cheers!

@f-liva
Copy link
Contributor Author

f-liva commented Jun 17, 2016

Oh thank you, since now I only did a reporisoty fetch but no a real pull.
After I finish my current project I want to show you the result. I mixed also
other packages to create a full multi-language site managed via backend, very
amazing!

@tabacitu
Copy link
Member

Sure, definitely want to see that!

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