Skip to content

v0.4.0

Latest
Compare
Choose a tag to compare
@avvertix avvertix released this 22 Feb 19:45
73f4a31

This release require Laravel 11. If you are upgrading from an older version follow the upgrade guide.

What's Changed

Upgrade guide

This release has two breaking changes and one minor change.

Default user model and identity model namespace (breaking change)

It is assumed that a User model exists and it is in the App\Models namespace. Additionally the Identity model, generated by the package, is assumed to be the Models directory. If you previously set models namespace manually to use the models folder you can now remove the configuration.

You can move both the User and Identity models to the App/Models directory or explicitly configure the package to use your model location.

To configure the location of the models include the following in the AppServiceProvider's boot method.

\Oneofftech\Identities\Facades\Identity::useIdentityModel(\App\Identity::class);
\Oneofftech\Identities\Facades\Identity::useUserModel(\App\User::class);

Default redirect URL

The default redirect after login/registration is now to /. Previously it was pointing to the RouteServiceProvider::HOME constant. To retain the previous behavior define, on each controller, the redirectTo() method returning the route. The redirectTo method is now the preferred way of telling the package where to redirect after successful actions.

protected function redirectTo(): string
{
    return RouteServiceProvider::HOME;
}

Switch to casts method in models

The generated Identity model used to have the casts property. This should be changed to use the cast method

/**
  * Get the attributes that should be cast.
  *
  * @return array<string, string>
  */
protected function casts(): array
{
    return [
        'expires_at' => 'datetime',
        'registration' => 'bool',
    ];
}

Full Changelog: v0.3.4...v0.4.0