I am developing a product pricing calculator in laravel. Inside the <script> tag of blade.php i have some javascript variables like,
<script>
.........
front-end logics
.........
var country;
var product_type;
var product_link ;
var seller_shipping_fee;
var weight;
var dimensions;
........
........
</script>
I want to store those variables in the database. I have already created the table in database using laravel migration.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePriceCalculatorResponsesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('pgsql')->create('price_calculator__responses', function (Blueprint $table) {
$table->increments('id');
$table->string('country');
$table->string('product_type');
$table->string('product_link');
$table->string('seller_shipping_fee');
$table->string('weight');
$table->string('dimension');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('pgsql')->dropIfExists('price_calculator__responses');
}
}
How do I save those Javascipt variables in the database?