Git Product home page Git Product logo

nova-import's People

Contributors

anaseqal avatar anditsung avatar beebmx avatar drsdre avatar lotuashvili avatar spekulatius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nova-import's Issues

Button doesn't appear

anaseqal/nova-import: "^0.0.6"
laravel nova:3.16.3

i do all what in documentation but the button doesn't appear

Screenshot from 2021-01-25 11-46-45

queue issue

Hi,
in your DispatchAction class line 58

protected static function queueForModels(ActionRequest $request, Action $action, $method, Collection $models)

you typehint $models with Collection, but you use

use Illuminate\Support\Collection;

instead of

use Illuminate\Database\Eloquent\Collection;

this cause this issue:
Argument 4 passed to Anaseqal\NovaImport\Actions\CallQueuedAction::__construct() must be an instance of Illuminate\Database\Eloquent\Collection, instance of Illuminate\Support\Collection given, called in ...
thank you for your great job

Button is always displaying in english but my app is in French

Hi,

Plugin seems to be working great, but my app is in French, and Button sticks with the text : "Import Users". At side, the create user buttons says: "Créer Utilisateur", because I named my resource "Utilisateur".

Is there a way to change this ???

I'm using Nova 2.x with Laravel 6

method name not working

I try to specify a different value in the method name, but the import button is not displayed.

Example

File ImportUsers.php:

class ImportUsers extends Action
{
...
...
    public function name() {
        return __('ImportTestUsers');
    }
...
...
}

File en.json:

{
    "ImportTestUsers": "Custom Button Name",
}

If that's the way it's meant to be, then it's a very bad idea.

Drop dependency to maatwebsite/excel ?

Thanks for a great package!

I am using this package to import data from JSON-files instead of Excel, which works great. From my point of view, the dependency to maatwebsite/excel isn't really necessary. It can be required in the project when needed. maatwebsite/excel requires phpoffice/phpspreadsheet which in turn requires the PHP zip extension, which in my case is totally unnecessary.

Could the dependency be dropped?

Nova v3.10.0+ Import "standalone" action

Hello,

Nova v3.10.0 introduce a new standalone action for running actions without selecting resources. which make a good use case to import data to your resource without using this package.

Result:

Screenshot

Step by step:

  1. create new action:
    php artisan nova:action ImportUsers

  2. enable stand alone option by adding:

    public $standalone = true;
  1. create an import class for your resource using Laravel Excel.
    composer require maatwebsite/excel
    php artisan make:import UsersImport --model=User
    then in action file:
   public function handle(ActionFields $fields)
    {
        \Maatwebsite\Excel\Facades\Excel::import(new \App\Imports\UsersImport, $fields->file);
        return Action::message('It worked!');
    }

    public function fields()
    {
        return [
            \Laravel\Nova\Fields\File::make('File')
                ->rules('required'),
        ];
    }
  1. register the action into your resource.
public function actions(Request $request)
{
    return [new Actions\ImportUsers];
}

Happy coding!

Add action log in action_events

It seems that since the action doesn't applies on models. It didn't has record in action_event when the action is triggered.

I tried to add Laravel\Nova\Nova::actionEvent()->forResourceUpdate($user, $model)->save();
it's not working.

Resource issues

Hi @anaseqal,

Is this package only work with the User resource? I have tried with a newly created resource on Nova v3.3.2 but doesn't appear Import button near.

  • User resource preview
    User resource preview

  • Others resource preview
    Others resource preview

Feature Request

Hi, Awesome package by the way,

I was wondering if there was a way to pass the Resource type and ID to the action so I can avoid having the ID and type within the CSV itself and just deduct it from where the Request is coming from (which resource page)

Reload page after import

Hi,

How about reload the page after the import in order to see the resources imported.
It seems to me very odd not seeing any results after the import.

Nova data import to JSON database fields from CSV / XLS file

Sharing a solution here for all those who attempt to use this package to import CSV or XLS(X) data into a JSON database field:

Use Case:
Import cell values (e.g. address details) from CSV or XLS files into destination JSON columns.

Bildschirmfoto vom 2022-04-03 03-38-42

Solution:
Wrap the array mapping between the database JSON child node and the CSV / XLS column within the following function:

response()->json([ Add array here ])->getData()

Place address code example:

public function model(array $row)
    {
        return new Client([
            'name' => $row['client'],
            'location' => response()->json([
                'address' => $row['address'],
                'street'=> $row['street'],
                'house_no'=> $row['house_no'],
                'postcode'=> $row['postcode'],
                'city'=> $row['city'],
                'county'=> $row['county'],
                'country'=> $row['country']
            ])->getData(),
        ]);

@anaseqal
Would be great to have this somewhere in the readme / documentation as this might be useful for others too.

Error with uploading files

I have a problem with uploading files, keep getting this error can you help?
call to undefined method App\Nova\Actions\importUsers::show onIndex[]

SoftDeletes

When enabled on resource SoftDeletes is lost
latest version on nova is used

Undefined index 1 / Undefined offset 1

Hi,

I'm trying to import a CSV, button is displaying well, but when I import I get:

Undefined index 1

Here is my csv file:

papa, [email protected], pipi, 2, 2, 2
mama, [email protected], popo, 1, 1, 1

And here is the associated code:

public function model(array $row)
    {
        $profiles = Profile::where('id', '>=', 2)->get()->pluck('name', 'id');
        $companyId = auth()->user()->company_id;
        $operations = Operation::where('company_id', $companyId)->get()->pluck('name', 'id');

        return new User([
            'name' => $row[0],
            'email' => $row[1],
            'password' => Hash::make($row[2]),
            'profile_id' => $profiles[$row[3]],
            'company_id' => $companyId,
            'operation_id' => $operations[$row[4]],
        ]);
    }

If I change delimiter coma to semicomas, I get:

Undefined offset 1

What should I do about it ???

I'm using Nova 2.x with Laravel 6

Call to undefined method App\Nova\Actions\Import{Resource}::shownOnIndex()

Hi all, I came across this issue following the installation instructions in this package.
I found that one important dependency was missing in the "use statements" which is causing the issue:

161376389-a8c17145-35a3-4f7d-8a26-3957163a1a2f

While searching for a solution I found this YouTube Video which helped me to track down the root cause.
I am sharing the solution to all who have the same problem getting started with this really amazing package.

Error:
Call to undefined method App\Nova\Actions\ImportResource}::shownOnIndex()

Impact:

  1. Error message keeps popping up whenever viewing the resource list
  2. Detail page of a resource is not opening with the following similar error message
    Call to undefined method App\Nova\Actions\ImportResource}::shownOnDetail()

Cause:
The use statement "use Laravel\Nova\Actions\Action;" is missing in the example import action "\Nova\Actions\Import{Resource}.php"

Solution:
Add "use Laravel\Nova\Actions\Action;" to the use statements:

Remark:
Please add the use of "use Laravel\Nova\Actions\Action;" to your documentation.
I have added this and made a commit request to get this added. Thanks for the package!

Missing Traits

When trying to use the package I'm getting:
Trait 'Laravel\\Nova\\Metable' not found at /var/www/vendor/anaseqal/nova-import/src/Actions/Action.php:19
And Trait 'Laravel\\Nova\\AuthorizedToSee' not found at /var/www/vendor/anaseqal/nova-import/src/Actions/Action.php:20
Did you forget to include this traits, or am I missing something?

Button doesn't appear in relationship

Nova: 2.9.4
Laravel: 5.8.*
Nova-import: 0.0.2


Am I missing something here?

Problem: Action not appearing on HasMany relationship.

I have an 'import keys' action on my key resource. Works fine.

The keys have a label group. On the label resource, I have a HasMany that displays attached keys correctly, but doesn't give me the action to import keys to said label.

There's nothing in the Action class that would lead me to believe I'm missing a function.

Feature request

Good day, thank you so much for the work, it's nice to have action button which not refers to specific item of resource!

Do you plan to add action name customization? When I'm trying apply custom name with
public $name
within Action class, then button will just disappear, and thus in javascript need to be implemented some dirty things. The same goes for the title.

Excuse me for bad English :)

Authorization issue causes an error to occur when you don't have any resource saved in the database

Related Issue

laravel/nova-issues#542

Currently experiencing this weird behavior as described by @vincenzoraco

Issue

I had the same problem, I was using this package https://novapackages.com/packages/anaseqal/nova-import which helps me to import resources. The error occurs when you don't have any resource saved on the database.

It seems that Nova is checking if there are any saved resourced, is it the right behavior? It does make sense to me, but it stops us to import the initial data, if any.

Proposed Solution

So for those who are facing this issue, create a dummy record on the table, then import, and then delete the dummy row

Thanks

TypeError: Cannot set property 'fields' of undefined

I got this error when updating to Nova 2.0.9. I already run `` after update but it still shows that error.

vendor.js?id=eaffe66c3a2800ae7df2:1 TypeError: Cannot set property 'fields' of undefined
    at app.js?id=af7f60e144c36d0eb627:1
    at Function.pr.tap (nova-import:1)
    at p.createPanelForField (app.js?id=af7f60e144c36d0eb627:1)
    at app.js?id=af7f60e144c36d0eb627:1
    at Array.forEach (<anonymous>)
    at p.availablePanels (app.js?id=af7f60e144c36d0eb627:1)
    at ln.get (vendor.js?id=eaffe66c3a2800ae7df2:1)
    at ln.evaluate (vendor.js?id=eaffe66c3a2800ae7df2:1)
    at p.availablePanels (vendor.js?id=eaffe66c3a2800ae7df2:1)
    at p.render (app.js?id=af7f60e144c36d0eb627:1)

[Enhancement] Responsive button

I use a responsive theme.

When checking on my phone, create button turns into a small (+) button, but Import button doesn't, so it doesn't fit the screen.

It is possible to consider the responsiveness of the button in CSS ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.