Skip to content

Commit

Permalink
Merge pull request #22 from ninja5pizza/expand-collection-stats
Browse files Browse the repository at this point in the history
Expand collection stats
  • Loading branch information
mvdnbrk authored Dec 21, 2024
2 parents 1ebccd0 + 6ec2b55 commit ed311f9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Jobs/CacheOrdinalsCollectionStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function handle(): void

$model = new FloorPrice;
$model->symbol = $response->json('symbol');
$model->owners = $response->json('owners');
$model->supply = $response->json('supply');
$model->listed = $response->json('totalListed');
$model->price_in_sats = $response->json('floorPrice');
$model->save();
}
Expand Down
6 changes: 6 additions & 0 deletions app/Models/FloorPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@
class FloorPrice extends Model
{
const UPDATED_AT = null;

protected $casts = [
'owners' => 'integer',
'supply' => 'integer',
'listed' => 'integer',
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('floor_prices', function (Blueprint $table) {
$table->integer('owners')->unsigned()->nullable()->after('symbol');
$table->integer('supply')->unsigned()->nullable()->after('owners');
$table->integer('listed')->unsigned()->nullable()->after('supply');
});
}

public function down(): void
{
Schema::table('floor_prices', function (Blueprint $table) {
$table->dropColumn([
'owners',
'supply',
'listed',
]);
});
}
};

0 comments on commit ed311f9

Please sign in to comment.