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 the user to modify the query and exported fields. #114

Open
wants to merge 4 commits into
base: 1.2
Choose a base branch
from

Conversation

GautierDele
Copy link

Hello,

I saw this feature was a lot requested so I implemented it.
Feel free to give return and modify it to your need !

Thanks,
Gautier

@patrickbrouwers
Copy link
Member

Nice! I'll have a closer look soon. Takes for the contribution!

Copy link
Member

@patrickbrouwers patrickbrouwers left a comment

Choose a reason for hiding this comment

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

Thanks again for your contribution. AlterateQuery is currently not functioning. Also left some remarks about naming.

@@ -90,6 +100,10 @@ public function handleRequest(ActionRequest $request)
$this->handleOnly($this->request);
$this->handleHeadings($query, $this->request);

if (!is_null($this->alterateQuery)) {
Copy link
Member

Choose a reason for hiding this comment

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

is_callable

Copy link
Author

Choose a reason for hiding this comment

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

Much better, thanks !

*
* @return $this
*/
public function exportFields(array $fields)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this naming. This seems it would still refer to the Nova fields, while it skips it and uses the model attributes directly.

Maybe exportAttributes

*/
public function exportFields(array $fields)
{
$this->exportFields = $fields;
Copy link
Member

Choose a reason for hiding this comment

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

\is_array($fields) ? $fields : \func_get_args()

*
* @return $this
*/
public function alterateQuery(callable $callable)
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to tapQuery so it's more inline with Laravel-like naming

/**
* @var callable|null
*/
protected $alterateQuery;
Copy link
Member

Choose a reason for hiding this comment

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

queryCallback

Copy link
Author

Choose a reason for hiding this comment

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

I made callbackQuery to follow laravel naming

*/
public function alterateQuery(callable $callable)
{
$this->alterate = $callable;
Copy link
Member

Choose a reason for hiding this comment

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

Should have been $this->alterateQuery, currently not working

@patrickbrouwers
Copy link
Member

Hey @GautierDele can you have a look at my remarks?

@GautierDele
Copy link
Author

@patrickbrouwers Yeah sorry for the delay, i'll try my best to close this the quicker possible

@GautierDele
Copy link
Author

@patrickbrouwers sorry for the delay, i'm currently underwater 😅

Please feel free to provide feedback on this !

Gautier

@GautierDele
Copy link
Author

@patrickbrouwers any time to treat this ?

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