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

[5.4] Add macros to Eloquent/Builder #17719

Merged
merged 1 commit into from
Feb 7, 2017
Merged

[5.4] Add macros to Eloquent/Builder #17719

merged 1 commit into from
Feb 7, 2017

Conversation

reinink
Copy link
Contributor

@reinink reinink commented Feb 1, 2017

This adds macroable functionality to the Eloquent/Builder, with one exception to the normal implementation — it doesn't use the Macroable trait.

This because the class already has it's own locally scoped macro functionality. For example, when you to enable soft deletes on a specific model. Unfortunately this functionality cannot be globally (statically), hence this change.

To use the macro() method in both local and static situations, I've removed the method from the class and implemented it via __call() and __callStatic().

From my testing, I believe this change maintains 100% backward compatibility.

@GrahamCampbell GrahamCampbell changed the title Add macros to Eloquent/Builder [5.4] Add macros to Eloquent/Builder Feb 1, 2017
*
* @throws \BadMethodCallException
*/
public static function __callStatic($method, $parameters)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here can be: public static function __callStatic($method, array $parameters)

@vlakoff
Copy link
Contributor

vlakoff commented Nov 9, 2017

Refs #21980.

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.

4 participants