Here we explain how to make float dataType migration in laravel.
Laravel float data type migration
Laravel migration float() method create float type sql column in table. In float method we pass three arguments first name second total digits and third total digits after decimal.
Let an example float('amount', 8, 2) here we can save max 6 digit number and 2 points after decimal.
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateOrdersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('orders', function (Blueprint $table) { $table->float('amount', 8, 2); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('orders'); } };