-
Notifications
You must be signed in to change notification settings - Fork 74
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
base: 1.2
Are you sure you want to change the base?
Conversation
Nice! I'll have a closer look soon. Takes for the contribution! |
There was a problem hiding this 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.
src/Actions/ExportToExcel.php
Outdated
@@ -90,6 +100,10 @@ public function handleRequest(ActionRequest $request) | |||
$this->handleOnly($this->request); | |||
$this->handleHeadings($query, $this->request); | |||
|
|||
if (!is_null($this->alterateQuery)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_callable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thanks !
src/Actions/ExportToExcel.php
Outdated
* | ||
* @return $this | ||
*/ | ||
public function exportFields(array $fields) |
There was a problem hiding this comment.
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
src/Actions/ExportToExcel.php
Outdated
*/ | ||
public function exportFields(array $fields) | ||
{ | ||
$this->exportFields = $fields; |
There was a problem hiding this comment.
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()
src/Actions/ExportToExcel.php
Outdated
* | ||
* @return $this | ||
*/ | ||
public function alterateQuery(callable $callable) |
There was a problem hiding this comment.
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
src/Actions/ExportToExcel.php
Outdated
/** | ||
* @var callable|null | ||
*/ | ||
protected $alterateQuery; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryCallback
There was a problem hiding this comment.
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
src/Actions/ExportToExcel.php
Outdated
*/ | ||
public function alterateQuery(callable $callable) | ||
{ | ||
$this->alterate = $callable; |
There was a problem hiding this comment.
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
Hey @GautierDele can you have a look at my remarks? |
@patrickbrouwers Yeah sorry for the delay, i'll try my best to close this the quicker possible |
@patrickbrouwers sorry for the delay, i'm currently underwater 😅 Please feel free to provide feedback on this ! Gautier |
@patrickbrouwers any time to treat this ? |
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