d

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567
ouroffice@aware.com

 

KMF

A Package for Onboarding Users in Laravel Apps

Laravel Onboard is a Laravel package to help track user onboarding steps created by Spatie:

Here’s a quick example taken from the project readme on using this package to create onboarding steps:

1use AppUser;

2use SpatieOnboardFacadesOnboard;

3 

4// You can add onboarding steps in a `boot()` method within a service provider

5Onboard::addStep('Complete Profile')

6 ->link('/profile')

7 ->cta('Complete')

8 ->completeIf(function (User $user) {

9 return $user->profile->isComplete();

10 });

11 

12Onboard::addStep('Create Your First Post')

13 ->link('/post/create')

14 ->cta('Create Post')

15 ->completeIf(function (User $user) {

16 return $user->posts->count() > 0;

17 });

To get a user’s onboarding status—among other things—the package has a nice API for accessing things like percentage complete, in progress, finished, and details about individual steps:

1/** @var SpatieOnboardOnboardingManager $onboarding **/

2$onboarding = Auth::user()->onboarding();

3 

4$onboarding->inProgress();

5 

6$onboarding->percentageCompleted();

7 

8$onboarding->finished();

9 

10$onboarding->steps()->each(function($step) {

11 $step->title;

12 $step->cta;

13 $step->link;

14 $step->complete();

15 $step->incomplete();

16});

Additionally, this package supports features such as:

  • Conditionally excluding steps with custom logic
  • Defining custom attributes on a step
  • Use middleware to ensure a user completes onboarding before they are allowed to use certain features
  • And more

You can get started with this package by checking it out on GitHub at spatie/laravel-onboard. Their blog post can also give you some examples and further details on how you can use this package.


Credit: Source link

Previous Next
Close
Test Caption
Test Description goes like this