mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
create migration for invoices, details and statuse
This commit is contained in:
@@ -36,7 +36,7 @@ class InvoiceController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function getSupplierPO($id)
|
||||
public function getSupplierDO($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsToInvoice extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->string('buyer_company', 50);
|
||||
$table->string('reg_no', 100);
|
||||
$table->string('address', 120);
|
||||
$table->string('contact_no', 20);
|
||||
$table->string('po_number', 20);
|
||||
$table->string('order_no', 20);
|
||||
$table->double('tax_rate')->default(0);
|
||||
$table->double('billing_charge_rate');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddInvoiceDetails extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_details', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order');
|
||||
$table->string('description');
|
||||
$table->integer('quantity');
|
||||
$table->double('unit_price');
|
||||
$table->string('stock_code');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_details');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddForeignIdToInvoiceDetails extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('invoice_details', function (Blueprint $table) {
|
||||
$table->integer('invoice_id')->unsigned();
|
||||
|
||||
$table->foreign('invoice_id')
|
||||
->references('id')
|
||||
->on('invoices')
|
||||
->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoice_details', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoiceStatus extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_statuses', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('status', 20);
|
||||
$table->string('comment');
|
||||
$table->timestamps();
|
||||
$table->integer('invoice_id')->unsigned();
|
||||
$table->foreign('invoice_id')
|
||||
->references('id')
|
||||
->on('invoices')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_statuses');
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -137,7 +137,7 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::patch('invoice/{id}/status', 'InvoiceController@updateStatus');
|
||||
Route::get('invoice/{id}/po', 'InvoiceController@getPO');
|
||||
Route::get('invoice/{id}/do', 'InvoiceController@getDO');
|
||||
Route::get('invoice/{id}/supplierpo', 'InvoiceController@supplierPO');
|
||||
Route::get('invoice/{id}/supplierdo', 'InvoiceController@supplierDO');
|
||||
|
||||
Route::get('admin/complete-orders', 'BookingController@adminShowCompletedOrders');
|
||||
// for both user and admin
|
||||
|
||||
Reference in New Issue
Block a user