### Add GetsOnboarded trait and read progress Source: https://github.com/roundly-consulting/onboarding-for-laravel/blob/main/README.md Add the GetsOnboarded trait to a model to enable onboarding progress methods. The example shows how to get the completion percentage, the next step title, and a JSON-ready array. ```php use RoundlyConsulting\Onboarding\Traits\GetsOnboarded; class User extends Authenticatable { use GetsOnboarded; } $user->onboardingProgress(); // 33.33 $user->nextOnboardingStep()?->title; // "Upload photo" Onboarding::for($user)?->toArray(); // title, percentage, next step, every step ``` -------------------------------- ### Install package with Composer Source: https://github.com/roundly-consulting/onboarding-for-laravel/blob/main/README.md Requires PHP 8.4 and Laravel 12 or 13. Run this command to install the package. ```bash composer require roundly-consulting/onboarding-for-laravel ``` -------------------------------- ### Apply onboarding middleware to routes Source: https://github.com/roundly-consulting/onboarding-for-laravel/blob/main/README.md Wrap routes with the 'onboarding' middleware to send users who haven't finished to their current step. ```php Route::middleware(['auth', 'onboarding'])->group(function () { Route::get('/dashboard', DashboardController::class); }); ``` -------------------------------- ### Register an onboarding flow in a service provider Source: https://github.com/roundly-consulting/onboarding-for-laravel/blob/main/README.md Define a flow with ordered steps, each with a route and completion condition. Use completeWhenFilled for a field, completeIf for a custom callback, and optional() to mark a step as optional. ```php use App\Models\User; use RoundlyConsulting\Onboarding\Facades\Onboarding; use RoundlyConsulting\Onboarding\Flow; use RoundlyConsulting\Onboarding\Step; Onboarding::register(Flow::make('Profile Onboarding')->of([ Step::make('Verify email')->route('verification.notice')->completeWhenFilled('email_verified_at'), Step::make('Upload photo')->cta('Upload now')->route('profile.photo')->completeWhenFilled('avatar_path'), Step::make('Add a bio')->optional()->completeIf(fn (?User $user) => filled($user?->bio)), ])); ```