-
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
[QUESTION/FEATURE] Nova Import tool #86
Comments
So I required the 2.0-dev version of the package with Now, how would one include the import tool so it can be used? |
I believe only the following steps are required:
|
Finally had the time again to work further on the project, but I think we're missing a step as right after changing my /**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
return [
\Maatwebsite\LaravelNovaExcel\Tools\Import::class
];
} |
My fault, registering it wrong... |
@patrickbrouwers is it possible to override which resource/model it uses? And we want to run the action from the |
Don't think I have accounted for something like that. |
as far as I can see in the code, you're not - still thinking about a way I can make it work -> maybe override the controller or something but I don't know how... -> maybe add some hooks/callbacks, just thinking out loud |
I wouldn't mind being able to configure the resource you want to import to on the action. Feel free to PR something like that. |
I would first have to use a different of way of getting the source code then, maybe as a submodule, so I can change code - any tips? |
nvm... the issue is with how I setup my docker instance |
I've got it partially working already, I can now call the action from my Any idea's @patrickbrouwers ? |
Big question @patrickbrouwers -> How does the ImportExcel action actually run? I don't see a |
It doesn't technically run the action (handle method), I only use the action to determine if it should show the button or not. Then it just goes via a controller call: https://github.com/Maatwebsite/Laravel-Nova-Excel/blob/2.0/src/Http/Controllers/UploadsImportsController.php#L47 |
I noticed - sorry for not mentioning it - I'm almost done, currently writing the after import hook - how can one get the models it created during the import after line https://github.com/Maatwebsite/Laravel-Nova-Excel/blob/2.0/src/Http/Controllers/UploadsImportsController.php#L47 |
Or do I need to use a different method on the importer for that? Maybe the toCollection? |
Got that working too -> I added a /**
* @return HasMany
*/
public function models()
{
$model = Nova::modelInstanceForKey($this->resource);
return $this->hasMany(get_class($model));
} |
Got it fully working now! Don't know if it's meant this way, but I can import from one resource, fill another and then link it up together |
I'll make a PR later on so you can see what I changed |
My changes can be seen here: ThaDaVos@76a5176 |
@patrickbrouwers here's the promised Pull-Request: #88 |
@patrickbrouwers I made some additional fixes regarding null values in excel sheets |
Hey thanks for the PR, I currently don't have a lot of time to look at it. Also releasing 2.0 will most likely also still take a while. Feel free to keep using your own fork, and if you have anymore improvements feel free to add them to the PR! :) |
Hi! any news on this? |
No sorry |
Thank you! I'm new to laravel and laravel nova, and I'm using this package to export my tables. Works really great :) Do you have a work around or a recommendation to make imports? this really seems a good way to go but as an alternative, do you know any other package that makes import from the data exported from this one? |
There are a few packages that have used the Laravel Excel base package like this one: https://packagist.org/packages/anaseqal/nova-import You can have a look at packagist: https://packagist.org/?query=laravel%20nova%20import I haven't tried or used any of them, so I'm not sure which one is good and works. |
Prerequisites
Description
There is progress being made for a Nova Import Tool. This issue is opened to serve as a point to ask questions.
PR: #70
Twitter: https://twitter.com/patrickbrouwers/status/1143467691577171968
The text was updated successfully, but these errors were encountered: