PHP code example of tadasei / laravel-statuses

1. Go to this page and download the library: Download tadasei/laravel-statuses 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/ */

    

tadasei / laravel-statuses example snippets


// in routes/api.php or routes/web.php

use App\Models\{Status, User};

$status = Status::create([
    "statusable_type" => User::class,
    "name" => "Initial status",
    "color" => "#858662",
    "is_initial" => true,
    "is_final" => false,
]);

$user = User::first();

$status->users()->save($user);
bash
php artisan statuses:install
bash
php artisan migrate