serverfireteam / panel

An easily configurable admin panel for Laravel applications.
MIT License
427 stars 144 forks source link

Trying to get property of non-object on mainTemplate.blade.php #355

Closed miguelmsoler closed 6 years ago

miguelmsoler commented 7 years ago

Hi, I'm trying to run the "serverfireteam/panel": "1.4." on "laravel/framework": "5.2.", but after I log in with default username and password, I get this:

Trying to get property of non-object (View: /Users/macbookpro/workspace/winwins/backend/resources/views/vendor/panelViews/mainTemplate.blade.php) (View: /Users/macbookpro/workspace/winwins/backend/resources/views/vendor/panelViews/mainTemplate.blade.php)

Any hints?

miguelmsoler commented 7 years ago

The problem is that Auth::guard('panel')->user() is returning null in line 40 of mainTemplate.blade.php.

Does this panel need some specific Auth configs? 'cause Auth seems to work in every other place in my project.

If I get rid of those lines with Auth::guard('panel')->user() calls I can see the panel after logging in.

AlirezaAlgo commented 7 years ago

This line check username etc to show in the dashboard, I'm not sure why is not working for you.

Do you still have this problem?

miguelmsoler commented 7 years ago

Yes, I still can't use the panel.

Could it be something related to middleware and the fact that I use a custom namespace?

This is my kernel file:

<?php namespace Winwins\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel {

    protected $middleware = [
        'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
        'Illuminate\Cookie\Middleware\EncryptCookies',
        'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
        'Illuminate\Session\Middleware\StartSession',
        'Illuminate\View\Middleware\ShareErrorsFromSession',
        'Winwins\Http\Middleware\VerifyCsrfToken',
        'Barryvdh\Cors\HandleCors',
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \Winwins\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \Winwins\Http\Middleware\VerifyCsrfToken::class,
        ],
        'api' => [
            'throttle:60,1',
        ],
    ];

    protected $routeMiddleware = [
        'auth' => 'Winwins\Http\Middleware\Authenticate',
        'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
        'guest' => 'Winwins\Http\Middleware\RedirectIfAuthenticated',
    ];

}
AlirezaAlgo commented 7 years ago

It could be custom namespace or custom middleware, try a fresh install of laravel and code your code, that way you can find the problem