From eb8726f1d95b7517fc8404c9fce17981ef94967f Mon Sep 17 00:00:00 2001 From: Arko Elsenaar Date: Tue, 18 Apr 2023 11:20:13 +0200 Subject: [PATCH] Update README.md --- README.md | 80 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index ba1cc63..4bcf60e 100644 --- a/README.md +++ b/README.md @@ -93,24 +93,24 @@ class AppServiceProvider extends ServiceProvider public function boot() { - Onboard::addStep('Complete Profile') - ->link('/profile') - ->cta('Complete') - /** + Onboard::addStep('Complete Profile') + ->link('/profile') + ->cta('Complete') + /** * The completeIf will pass the class that you've added the * interface & trait to. You can use Laravel's dependency * injection here to inject anything else as well. */ - ->completeIf(function (User $model) { - return $model->profile->isComplete(); - }); - - Onboard::addStep('Create Your First Post') - ->link('/post/create') - ->cta('Create Post') - ->completeIf(function (User $model) { - return $model->posts->count() > 0; - }); + ->completeIf(function (User $model) { + return $model->profile->isComplete(); + }); + + Onboard::addStep('Create Your First Post') + ->link('/post/create') + ->cta('Create Post') + ->completeIf(function (User $model) { + return $model->posts->count() > 0; + }); ``` The variable name passed to the `completeIf` callback must be `$model`. @@ -121,23 +121,23 @@ Now you can access these steps along with their state wherever you like. Here is ```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 -
+
+ @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 ``` @@ -154,11 +154,11 @@ $onboarding->percentageCompleted(); $onboarding->finished(); $onboarding->steps()->each(function($step) { - $step->title; - $step->cta; - $step->link; - $step->complete(); - $step->incomplete(); + $step->title; + $step->cta; + $step->link; + $step->complete(); + $step->incomplete(); }); ``` @@ -211,10 +211,10 @@ Definining custom attributes and accessing them: ```php // Defining the attributes Onboard::addStep('Step w/ custom attributes') - ->attributes([ - 'name' => 'Waldo', - 'shirt_color' => 'Red & White', - ]); + ->attributes([ + 'name' => 'Waldo', + 'shirt_color' => 'Red & White', + ]); // Accessing them $step->name;