deniskoronets / Laravel-GridView

Laravel package which allows to render cool tables
https://deniskoronets.github.io/Laravel-GridView/
20 stars 7 forks source link

Tests array has failed on Woo\GridView\Columns\ActionsColumn::value: Property should be an array #4

Closed vishalsinhadev closed 5 years ago

vishalsinhadev commented 5 years ago

I am using an action column in this way :

    [
        'class' => 'actions',
        'value' => '{show} {update}',
        'actionsUrls' => function($model) {
            return [
                'show' => route('course.show', ['id' => $model->id]),
                'update' => route('course.edit', ['id' => $model->id])
            ];
        }
    ]

But I am getting an error :

Tests array has failed on Woo\GridView\Columns\ActionsColumn::value: Property should be an array

deniskoronets commented 5 years ago

Good day, Sir! Which package version do you use? You seem read docs for v1.x but used 2.x, which have totally different action columns. Take a look here: https://deniskoronets.github.io/Laravel-GridView/getting-started

Now, action column has actions inside so in value you have to specify a list of actions:

[
    'class' => 'actions', // class option allows to change column class
    'value' => [
        'edit:/path/to/{id}', // {id} - will be replaced with an attribute from row
        'view:/path/{id}',
        'delete:/path/to/{id}',
        new \Woo\GridView\Columns\Actions\Action('copy/{id}', '<i class="fa fa-copy"></i>'),
    ]
]
deniskoronets commented 5 years ago

In your case it should look like this:

[
    'class' => 'actions', 
    'value' => [
        'edit:' . route('course.edit', ['id' => '{id}']),
        'view:' . route('course.show', ['id' => '{id}']),      
    ]
]

Let me know if you have any issues with it

vishalsinhadev commented 5 years ago

well, thanks, I followed the different documentation, I think you need to add this in the documentation. This package is really a great way for integration just like Yii2 grid view. This package just needs proper documentation for implementation.

deniskoronets commented 5 years ago

It has proper documentation by this url: https://deniskoronets.github.io/Laravel-GridView/

vishalsinhadev commented 5 years ago

Thanks @deniskoronets