bestmomo / nice-artisan

This package is to add a web interface for Laravel 5 and earlier Artisan.
213 stars 23 forks source link

config('commands.commands') - array_keys() expects parameter 1 to be array, null given #14

Open Nowi5 opened 6 years ago

Nowi5 commented 6 years ago

Hello,

thank you very much for this great package. Unfortunately I have since a couple of weeks a issue. When I try to open nice artisan I get the error "array_keys() expects parameter 1 to be array, null given" from line 110 of /vendor/bestmomo/nice-artisan/src/Http/Controllers/NiceArtisanController.php.

  public function show($option = null)
    {
        $options = array_keys(config('commands.commands')); // HERE
        array_push($options, 'customs');

When I run config('commands.commands') in Artisan Tinker I get null as return. While config('commands') runs fine. php artisan list works also fine on console. Any idea why this could happen and how to solve this?

Thank you very much.

Nowi5 commented 6 years ago

I change the following lines and than it looks fine:

Around Line 110:

 if(config('commands.commands') === null){
               $options = array_keys(config('commands'));
       }
       else{
               $options = array_keys(config('commands.commands'));
      }

and a few lines below

if(config('commands.commands') === null){
                         $items = array_intersect_key(Artisan::all(), array_flip(config('commands.' . $option)));
                 }
                 else{
                        $items = array_intersect_key(Artisan::all(), array_flip(config('commands.commands.' . $option)));
                }

Maybe a change in newst version of laravel?

bestmomo commented 6 years ago

Just I didn't choice a good version number: https://github.com/bestmomo/nice-artisan/issues/12

Nowi5 commented 6 years ago

Sorry, should that be the solution or just a comment that both issues describe the same?

bestmomo commented 6 years ago

Bith issues describe the same.