Skip to content

Commit

Permalink
Merge pull request #14 from Xoshbin/master
Browse files Browse the repository at this point in the history
Add uuid check for polymorphic tables in the config
  • Loading branch information
umutphp authored Mar 15, 2023
2 parents 5be5c4d + da1fddd commit f5d5db1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/laravel_model_recommendation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
// These are the default settings for models
return [
'recommendation_count' => 5,
'recommendation_order' => 'asc' // possible values asc, desc, random
'recommendation_order' => 'asc', // possible values asc, desc, random
'uuids' => false //Use uuid as primary key
];
12 changes: 10 additions & 2 deletions database/migrations/create_model_recommendation_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ class CreateModelRecommendationTable extends Migration
$table->id();

$table->string('recommendation_name', 100)->default('default');
$table->morphs('source');
$table->morphs('target');
if (config('laravel_model_recommendation.uuids')) {
$table->uuidMorphs('source');
} else {
$table->morphs('source');
}
if (config('laravel_model_recommendation.uuids')) {
$table->uuidMorphs('target');
} else {
$table->morphs('target');
}
$table->unsignedInteger('order_column')->default(0);

$table->timestamps();
Expand Down

0 comments on commit f5d5db1

Please sign in to comment.