Compare commits

..

2 Commits

Author SHA1 Message Date
b1ek e78f0a6fae
feat: accept double values in CLI 2024-09-17 23:03:29 +10:00
b1ek 1f65330a73
feat: switch balance to double 2024-09-17 23:03:04 +10:00
2 changed files with 31 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class AddBalance extends Command
*/ */
public function handle() public function handle()
{ {
$balance = (int) $this->argument('balance'); $balance = (double) $this->argument('balance');
$id = (int) $this->argument('id'); $id = (int) $this->argument('id');
if ($balance == 0 || $id == 0) { if ($balance == 0 || $id == 0) {
$this->fail('Balance or Id must be non zero value!'); $this->fail('Balance or Id must be non zero value!');

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('balance');
$table->double('balance')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('balance');
$table->bigInteger('balance')->default(0);
});
}
};