mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
change
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class CurrencyType {
|
||||
public const CASH = 1;
|
||||
public const CHEQUE = 2;
|
||||
public const PA = 3;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CurrencyRate extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CurrencyRateLog extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\CurrencyType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCurrencyRatesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('currency_rates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('currency_id')->unsigned()->nullable();
|
||||
$table->foreign('currency_id')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->decimal('selling', 20, 5)->nullable();
|
||||
$table->integer('currency_type')->default(CurrencyType::CASH);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('currency_rates');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCurrencyRateLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('currency_rate_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('currency_rate_id')->unsigned()->nullable();
|
||||
$table->foreign('currency_rate_id')->references('id')->on('currency_rates')->onDelete('cascade');
|
||||
$table->decimal('selling', 20, 5)->nullable();
|
||||
$table->bigInteger('created_by')->unsigned()->nullable();
|
||||
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('currency_rate_logs');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user