jeffgreco13 / filament-breezy

MIT License
760 stars 130 forks source link

Trying to access array offset on value of type null on slug() after update to filament 3 and breezy 2.2 #290

Open Gregsf89 opened 11 months ago

Gregsf89 commented 11 months ago

After I updated my filament to 3.0.97 and breezy to v2.2, I started getting this error:

Trying to access array offset on value of type null

  at vendor\jeffgreco13\filament-breezy\src\BreezyCore.php:144
    140▕     }
    141▕ 
    142▕     public function slug()
    143▕     {
  ➜ 144▕         return $this->myProfile['slug'];
    145▕     }
    146▕
    147▕     public function avatarUploadComponent(Closure $component)
    148▕     {

  1   vendor\jeffgreco13\filament-breezy\src\BreezyCore.php:144
      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}()

  2   vendor\jeffgreco13\filament-breezy\src\Pages\MyProfilePage.php:32
      Jeffgreco13\FilamentBreezy\BreezyCore::slug()
itsjustk commented 10 months ago

Same issue here Laravel: 10.29.0 Filament": 3.1.32 Breezy: 2.2.3

Gregsf89 commented 10 months ago

@itsjustk I've "solve it" by downgrading Brezzy to v2.1. I didn't went further to check why version v2.1+ don't work, I just fixed the version in composer

itsjustk commented 10 months ago

@Gregsf89 Yeah I may have to do that as well, ta for the reply :) :)

Saifallak commented 9 months ago

i guess it's broken because of https://github.com/jeffgreco13/filament-breezy/releases/tag/v2.2.7 ?

skills-up commented 5 months ago

I'm facing the same issue in v2.4, and downgrading to v2.1 didn't help

gustavobigardi commented 4 months ago

@itsjustk I've "solve it" by downgrading Brezzy to v2.1. I didn't went further to check why version v2.1+ don't work, I just fixed the version in composer

I fixed it here by adding the myProfile() method before enabling the two factor authentication. Seems that the myProfile internal variable is initialized by this method, so without it, when we call the enableTwoFactorAuthentication() method, it tries to use the BreezyCore->slug() method where the $myProfile var is still null.

image

etothepowerofitimespiequalsminusone commented 1 week ago

Yes, calling myProfile (as mentioned above) will initialize all the variables including slug and fix the error reported here. The docs might be improved to mention that this must happen, currently reading the docks you might the impression that calling myProfile is optional.

 BreezyCore::make()
         ->myProfile()
         ->enableTwoFactorAuthentication()