diff --git a/README.md b/README.md index b96486f..0011ab1 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,53 @@ [![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-onboard/Check%20&%20fix%20styling?label=code%20style)](https://github.com/spatie/laravel-onboard/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-onboard.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-onboard) +This package lets you set up an onboarding flow for your application's users. + +Here's an example of how it's set up: + +```php +use App\User; +use Spatie\Onboard\Facades\Onboard; + +Onboard::addStep('Complete Profile') + ->link('/profile') + ->cta('Complete') + ->completeIf(function (User $model) { + return $user->profile->isComplete(); + }); + +Onboard::addStep('Create Your First Post') + ->link('/post/create') + ->cta('Create Post') + ->completeIf(function (User $model) { + return $user->posts->count() > 0; + }); +``` + +You can then render this onboarding flow however you want in your templates: + +```blade +@if (auth()->user()->onboarding()->inProgress()) +
+ @foreach (auth()->user()->onboarding()->steps as $step) + + @if($step->complete()) + + {{ $loop->iteration }}. {{ $step->title }} + @else + + {{ $loop->iteration }}. {{ $step->title }} + @endif + + + complete() ? 'disabled' : '' }}> + {{ $step->cta }} + + @endforeach +
+@endif +``` + ## Support us [](https://spatie.be/github-ad-click/laravel-onboard)