Can't `php artisan route:list`



  • Can't php artisan route:list :(

      [ErrorException]
      Trying to get property of non-object
    

    What can i do for solve its?

    #withArtur | obiv.it

    0

  • Global Moderator

    Usually, it's some piece of code left over from testing. Can be in any sort of places.
    Most common would be dd($something->somemethod()); in ServiceProvider or anything that loads on every request.

    I'm guessing that simple php artisan command also returns the same error?



  • No php artisan work well. And i can't find a dd() or exit() statment. :(

    #withArtur | obiv.it

    0

  • Global Moderator

    Is that a clean install you got there or you added some module?



  • I added my own, by scaffold comand.

    #withArtur | obiv.it

    0

  • Global Moderator

    @arturmamedov Okay, and did you setup anything related to routes? If so could you post that.



  • @armababy When i disable my custom module php artisan module:disable it return to work. This is my route in module: (aother thing is that i try to comment out all routes in it, and it not work, only after disable it work)

    <?php
    
    use Illuminate\Routing\Router;
    /** @var Router $router */
    
    $router->group(['prefix' =>'/pricelist'], function (Router $router) {
        // Price list
        $router->bind('pricelist', function ($id) {
            return app('Modules\Pricelist\Repositories\PricelistRepository')->find($id);
        });
        $router->get('pricelists', [
            'as' => 'admin.pricelist.pricelist.index',
            'uses' => 'PricelistController6',
            'middleware' => 'can:pricelist.pricelists.index'
        ]);
        $router->get('pricelists/create', [
            'as' => 'admin.pricelist.pricelist.create',
            'uses' => 'PricelistController@create',
            'middleware' => 'can:pricelist.pricelists.create'
        ]);
        $router->post('pricelists', [
            'as' => 'admin.pricelist.pricelist.store',
            'uses' => 'PricelistController@store',
            'middleware' => 'can:pricelist.pricelists.store'
        ]);
        $router->get('pricelists/{pricelist}/edit', [
            'as' => 'admin.pricelist.pricelist.edit',
            'uses' => 'PricelistController@edit',
            'middleware' => 'can:pricelist.pricelists.edit'
        ]);
        $router->put('pricelists/{pricelist}', [
            'as' => 'admin.pricelist.pricelist.update',
            'uses' => 'PricelistController@update',
            'middleware' => 'can:pricelist.pricelists.update'
        ]);
        $router->delete('pricelists/{pricelist}', [
            'as' => 'admin.pricelist.pricelist.destroy',
            'uses' => 'PricelistController@destroy',
            'middleware' => 'can:pricelist.pricelists.destroy'
        ]);
        // sync table data
        $router->post('pricelists/ajax_sync/{id}', [
            'as' => 'admin.pricelist.pricelist.ajax_sync',
            'uses' => 'PricelistController@ajax_sync',
            'middleware' => 'can:pricelist.pricelists.ajax_sync'
        ])->where('id', '[0-9]+');
        // Search for booking
        $router->match(['get', 'post'], 'pricelists/booking', 'PricelistController@booking')->name('admin.pricelist.pricelist.booking')->middleware('can:pricelist.pricelists.booking');
    
        // Service
        $router->bind('service', function ($id) {
            return app('Modules\Pricelist\Repositories\ServiceRepository')->find($id);
        });
        $router->get('services', [
            'as' => 'admin.pricelist.service.index',
            'uses' => 'ServiceController6',
            'middleware' => 'can:pricelist.services.index'
        ]);
        $router->get('services/create', [
            'as' => 'admin.pricelist.service.create',
            'uses' => 'ServiceController@create',
            'middleware' => 'can:pricelist.services.create'
        ]);
        $router->post('services', [
            'as' => 'admin.pricelist.service.store',
            'uses' => 'ServiceController@store',
            'middleware' => 'can:pricelist.services.store'
        ]);
        $router->get('services/{service}/edit', [
            'as' => 'admin.pricelist.service.edit',
            'uses' => 'ServiceController@edit',
            'middleware' => 'can:pricelist.services.edit'
        ]);
        $router->put('services/{service}', [
            'as' => 'admin.pricelist.service.update',
            'uses' => 'ServiceController@update',
            'middleware' => 'can:pricelist.services.update'
        ]);
        $router->delete('services/{service}', [
            'as' => 'admin.pricelist.service.destroy',
            'uses' => 'ServiceController@destroy',
            'middleware' => 'can:pricelist.services.destroy'
        ]);
    
        // Period
        $router->bind('period', function ($id) {
            return app('Modules\Pricelist\Repositories\PeriodRepository')->find($id);
        });
        $router->get('periods', [
            'as' => 'admin.pricelist.period.index',
            'uses' => 'PeriodController6',
            'middleware' => 'can:pricelist.periods.index'
        ]);
        $router->get('periods/create', [
            'as' => 'admin.pricelist.period.create',
            'uses' => 'PeriodController@create',
            'middleware' => 'can:pricelist.periods.create'
        ]);
        $router->post('periods', [
            'as' => 'admin.pricelist.period.store',
            'uses' => 'PeriodController@store',
            'middleware' => 'can:pricelist.periods.store'
        ]);
        $router->get('periods/{period}/edit', [
            'as' => 'admin.pricelist.period.edit',
            'uses' => 'PeriodController@edit',
            'middleware' => 'can:pricelist.periods.edit'
        ]);
        $router->put('periods/{period}', [
            'as' => 'admin.pricelist.period.update',
            'uses' => 'PeriodController@update',
            'middleware' => 'can:pricelist.periods.update'
        ]);
        $router->delete('periods/{period}', [
            'as' => 'admin.pricelist.period.destroy',
            'uses' => 'PeriodController@destroy',
            'middleware' => 'can:pricelist.periods.destroy'
        ]);
    // append
    
    
    
    });
    

    UPDATE: I have API ruotes to, and if i comment out booth, its work.

    <?php
    
    use Illuminate\Routing\Router;
    
    /** @var Router $router */
    $router->group(['prefix' =>'/pricelist'], function (Router $router) {
        // Period
        $router->resource('periods', 'PeriodController',
            ['except' =>
                [
                    'create',
                    'edit',
                ]
            ],
            ['names' =>
                 [
                    'index' => 'api.pricelist.period.index',
                    //'create' => 'api.pricelist.period.create',
                    'store' => 'api.pricelist.period.store',
                    'show' => 'api.pricelist.period.show',
                    //'edit' => 'api.pricelist.period.edit',
                    'update' => 'api.pricelist.period.update',
                    'destroy' => 'api.pricelist.period.destroy',
                 ]
            ]
        );
    
        // Service
        $router->resource('services', 'ServiceController',
            ['except' =>
                 [
                     'create',
                     'edit',
                 ]
            ],
            ['names' =>
                 [
                    'index' => 'api.pricelist.service.index',
                    //'create' => 'api.pricelist.service.create',
                    'store' => 'api.pricelist.service.store',
                    'show' => 'api.pricelist.service.show',
                    //'edit' => 'api.pricelist.service.edit',
                    'update' => 'api.pricelist.service.update',
                    'destroy' => 'api.pricelist.service.destroy',
                ]
            ]
        );
    });
    
    

    #withArtur | obiv.it

    0

Log in to reply