PHP code example of julianstark999 / laravel-model-iid
1. Go to this page and download the library: Download julianstark999/laravel-model-iid 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/ */
julianstark999 / laravel-model-iid example snippets
use JulianStark999\LaravelModelIid\Traits\HasIidColumn;
class Task extends Model
{
use HasIidColumn;
public $iidColumn = 'project_id';
...
}
$table->unsignedInteger('iid')->nullable();
// optional (should only be defined for new tables or after generating iids for existing entries)
$table->unique(['project_id', 'iid']);
bash
php artisan iid:generate {className}
# example
php artisan iid:generate "App\Models\Task"
bash
php artisan iid:generate {className}
# example
php artisan iid:init "App\Models\Task"