I am using cyrildewit/eloquent-viewable to count views on a particular model which I am using uuids.
public function up(): void
{
Schema::create('listings', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->integer('rooms');
$table->text('amenities');
$table->float('rent');
$table->boolean('is_vacant')->default(false);
$table->string('image_1');
$table->string('image_2');
$table->string('image_3')->nullable();
$table->string('image_4')->nullable();
$table->foreignUuid('property_id');
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->timestamps();
});
}
Throught some testing, I’ve discovered the package works well with incremental ids which I don’t want to use for this model.
public function up()
{
$this->schema->create($this->table, function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('viewable');
$table->text('visitor')->nullable();
$table->string('collection')->nullable();
$table->timestamp('viewed_at')->useCurrent();
});
}
How can I modify this migration to suit uuids?
New contributor
blackbeaches is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.