Skip to content

Instantly share code, notes, and snippets.

@AbiruzzamanMolla
Last active December 24, 2022 15:27
Show Gist options
  • Save AbiruzzamanMolla/69e9a92272e437046ed529d000f919b8 to your computer and use it in GitHub Desktop.
Save AbiruzzamanMolla/69e9a92272e437046ed529d000f919b8 to your computer and use it in GitHub Desktop.
uuid laraevl
use Ramsey\Uuid\Uuid;
class Foo extends Model
{
protected $primaryKey = 'uuid';
protected $keyType = 'string';
public $incrementing = false;
protected static function boot()
{
parent::boot();
static::creating(function (Model $model) {
$model->setAttribute($model->getKeyName(), Uuid::uuid4());
});
}
}
https://laracasts.com/discuss/channels/laravel/uuid-as-primary-key-type
https://fakerphp.github.io/formatters/image/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment