codestudiohq/laravel-totem

Typed static property Studio\Totem\Totem::$authUsing must not be accessed before initialization

rushughes opened this issue · 1 comments

I've installed totem in to an existing project. Upon browing to /totem/ I get the following error:

Typed static property Studio\Totem\Totem::$authUsing must not be accessed before initialization

Stack trace etc is here https://flareapp.io/share/dmkY3zb7#F54

looks like i hadnt followed the instructions properly to install :)

adding Totem::auth to my AppServiceProvider.php solved this, thanks

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;
use Studio\Totem\Totem;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
      Totem::auth(function($request) {
        return Auth::check();
      });
    }
}