Skip to content

✨ Allow the user to modify the query and exported fields.#114

Open
GautierDele wants to merge 4 commits intoSpartnerNL:1.2from
GautierDele:1.2
Open

✨ Allow the user to modify the query and exported fields.#114
GautierDele wants to merge 4 commits intoSpartnerNL:1.2from
GautierDele:1.2

Conversation

@GautierDele
Copy link
Copy Markdown

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
Copy Markdown
Member

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

Copy link
Copy Markdown
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.

Comment thread src/Actions/ExportToExcel.php Outdated
$this->handleOnly($this->request);
$this->handleHeadings($query, $this->request);

if (!is_null($this->alterateQuery)) {
Copy link
Copy Markdown
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
Copy Markdown
Author

Choose a reason for hiding this comment

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

Much better, thanks !

Comment thread src/Actions/ExportToExcel.php Outdated
*
* @return $this
*/
public function exportFields(array $fields)
Copy link
Copy Markdown
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

Comment thread src/Actions/ExportToExcel.php Outdated
*/
public function exportFields(array $fields)
{
$this->exportFields = $fields;
Copy link
Copy Markdown
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()

Comment thread src/Actions/ExportToExcel.php Outdated
*
* @return $this
*/
public function alterateQuery(callable $callable)
Copy link
Copy Markdown
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

Comment thread src/Actions/ExportToExcel.php Outdated
/**
* @var callable|null
*/
protected $alterateQuery;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

queryCallback

Copy link
Copy Markdown
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

Comment thread src/Actions/ExportToExcel.php Outdated
*/
public function alterateQuery(callable $callable)
{
$this->alterate = $callable;
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@GautierDele
Copy link
Copy Markdown
Author

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

@GautierDele
Copy link
Copy Markdown
Author

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

Please feel free to provide feedback on this !

Gautier

@GautierDele
Copy link
Copy Markdown
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