PHP code example of felixdorn / onboard

1. Go to this page and download the library: Download felixdorn/onboard library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

felixdorn / onboard example snippets


    public function skip(Request $request): bool
    {
        if ($request->inertia()) {
            return false;
        }
        
        return parent::skip($request);
    }

    // ...

    protected $middlewareGroups = [
        'web' => [
            // ...
            \App\Http\Middleware\ResumeOnboarding::class
        ]   
    ]

use Felix\Onboard\Concerns\HasOnboarding;

class User extends Authenticatable {
    use HasOnboarding;
    
    // ...
}

use \App\Models\User;
use \Felix\Onboard\Facades\Onboard;

Onboard::add('verify_email')
    ->completedIf(function (User $user) {
        return $user->hasVerifiedEmail(); // or whatever    
    })
    ->skipIf(function () {
        return $user->github_id != null;
    })
    ->route('verification.notice')
    ->allowRoutes(['verification.verify']);

class HomeController extends Controller {
    public function index(\Illuminate\Http\Request $request) {
        return [
            'steps' => $request->user()->onboarding()->toArray()
        ];
    }
}

Onboard::add('create_team')
    ->route(fn () => route('teams.create'));

Onboard::allow(['/api/*']);

Onboard::allowRoutes(['logout', 'settings.billing']);
bash
php artisan onboard:middleware