PHP code example of touhidurabir / laravel-model-uuid
1. Go to this page and download the library: Download touhidurabir/laravel-model-uuid 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/ */
touhidurabir / laravel-model-uuid example snippets
use Touhidurabir\ModelUuid\HasUuid;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
use HasUuid;
}
use Touhidurabir\ModelUuid\HasUuid;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
use HasUuid;
public function uuidable() : array {
return [
'column' => 'uuid',
'event' => 'created',
];
}
}
User::findByUuid($uuid); // single uuid
User::findByUuid([$uuid1, $uuid2]); // multiple uuid
User::disbaleUuidGeneration(true) // this will diable uuid generation temporarily for model
User::disbaleUuidGeneration(false) // this will enable uuid generation for model again