Ver código fonte

Add snowflake ids to Collection models

Daniel Supernault 6 anos atrás
pai
commit
4f14a7dd74
2 arquivos alterados com 20 adições e 0 exclusões
  1. 10 0
      app/Collection.php
  2. 10 0
      app/CollectionItem.php

+ 10 - 0
app/Collection.php

@@ -3,9 +3,19 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Pixelfed\Snowflake\HasSnowflakePrimary;
 
 class Collection extends Model
 {
+	use HasSnowflakePrimary;
+
+    /**
+     * Indicates if the IDs are auto-incrementing.
+     *
+     * @var bool
+     */
+    public $incrementing = false;
+
 	public function profile()
 	{
 		return $this->belongsTo(Profile::class);

+ 10 - 0
app/CollectionItem.php

@@ -3,9 +3,19 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Pixelfed\Snowflake\HasSnowflakePrimary;
 
 class CollectionItem extends Model
 {
+	use HasSnowflakePrimary;
+
+    /**
+     * Indicates if the IDs are auto-incrementing.
+     *
+     * @var bool
+     */
+    public $incrementing = false;
+    
 	public function collection()
 	{
 		return $this->belongsTo(Collection::class);