Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into too/gitlabci

# Conflicts:
#	app/Http/Controllers/BookingController.php
#	app/Http/Kernel.php
#	composer.lock
This commit is contained in:
Jack Goh
2018-07-31 16:30:26 +08:00
180 changed files with 24784 additions and 7056 deletions
+7
View File
@@ -1,2 +1,9 @@
vendor
node_modules
.git
.idea
.env
storage/framework/cache/**
storage/framework/sessions/**
storage/framework/views/**
+11 -10
View File
@@ -1,5 +1,4 @@
APP_NAME=EXCHANGE
APP_NAME=Exchange
APP_NAME=IZYIM
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
@@ -8,11 +7,11 @@ APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=exchange
DB_USERNAME=root
DB_PASSWORD=
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@@ -47,11 +46,11 @@ APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secr
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@@ -77,3 +76,5 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
+80
View File
@@ -0,0 +1,80 @@
APP_NAME=IZYIM
APP_ENV=production
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_NAME=exchange
APP_ENV=local
APP_KEY=base64:Fu2YulXExzm9HJ5LgVmZUmcbRkchHkc82q02MorN5GQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
JWT_SECRET=FwYZ3SPFgjpEDqAwcaSIV6eEmQiMtGWt
+5 -1
View File
@@ -3,6 +3,7 @@
/public/storage
/public/js
/public/css
/public/mix-manifest.json
/storage/*.key
/vendor/**
/.idea
@@ -15,4 +16,7 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.env
.env.prod
vendor/composer/autoload_static.php
vendor/composer/autoload_classmap.php
package-lock.json
+3
View File
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
+7
View File
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\laradock",
"PreviewInSolutionExplorer": false
}
Binary file not shown.
BIN
View File
Binary file not shown.
+8 -2
View File
@@ -4,10 +4,16 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install pdo pdo_mysql zip gd
WORKDIR /app
COPY . /app
ADD . /app
RUN chown -R www-data:www-data /app
RUN chmod 755 /app/storage
RUN composer install
RUN php artisan clear-compiled
COPY wait.sh /usr/local/bin/wait.sh
RUN chmod +x /usr/local/bin/wait.sh
CMD /usr/local/bin/wait.sh && composer dumpautoload && php artisan migrate && php artisan db:seed && php artisan serve --host=0.0.0.0 --port=8000
RUN php artisan storage:link
CMD /usr/local/bin/wait.sh && composer update --no-scripts && composer dumpautoload && php artisan migrate && php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000
+1
View File
@@ -0,0 +1 @@
web: vendor/bin/heroku-php-apache2 public/ && npm run production
+22 -3
View File
@@ -7,7 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class Booking extends Model
{
// protected $guarded = [];
protected $hidden = array('user_id',
protected $hidden = array( "user",
"user_id",
"rate_id",
"rmb_book_amount",
"rmb_book_pay_method",
@@ -27,13 +28,31 @@ class Booking extends Model
'bank_branch', 'company_name'];
public $timestamps = true;
public function user(){
return $this->belongsTo('app\User');
return $this->belongsTo(User::class);
}
public function supplierBooking(){
return $this->hasOne(SupplierBooking::class);
}
public function chinaBankSlip(){
return $this->hasMany(ChinaBankSlip::class);
}
public function userBankSlip(){
return $this->hasOne(UserBankSlip::class);
}
public function purchaseOrder(){
return $this->hasOne(PurchaseOrder::class);
}
public function invoice(){
return $this->hasOne(Invoice::class);
}
}
+6 -1
View File
@@ -6,5 +6,10 @@ use Illuminate\Database\Eloquent\Model;
class ChinaBankSlip extends Model
{
protected $fillable = ['actual_transfer_amount','date','details','china_bank_slips'];
protected $fillable = ['actual_transfer_amount','date','details','china_bank_slip_path'];
public function booking()
{
return $this->belongsTo(Booking::class);
}
}
@@ -46,7 +46,7 @@ class RegisterController extends Controller
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'marking' => 'required|max:255|unique:markings',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
@@ -60,22 +60,33 @@ class RegisterController extends Controller
*/
protected function create(Request $data)
{
$this->validate($data, [
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
$marking = Marking::Where('email',$data['email'])->first();
if(!$marking){
return response()->json('Access Denied', 401);
return response()->json(["message"=>"Marking does not exist, please contact sales team to get one"], 400);
}
if($marking->marking != $data['marking']){
return response()->json('Wrong Marking', 400);
return response()->json(["message"=>"Incorrect marking"], 400);
}
if(User::Where('email',$data['email'])->first()){
return response()->json(["message"=>"Email already exist in the system"], 400);
}
$role = Role::where('name','=','member')->first();
$user = new User();
$user->name = $data['name'];
$user->email = $data['email'];
$user->marking = $marking->marking;
$user->password = bcrypt($data['password']);
$user->save();
$user->attachRole($role);
return response()->json($user, 201);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,178 @@
<?php
namespace App\Http\Controllers;
use Auth;
use App\SupplierBooking;
use App\Booking;
use App\Rate;
use App\User;
use App\UserBankSlip;
use App\SettingBeneficiary;
use App\SupplierBookingItem;
use App\SettingSupplier;
use App\SettingTaxRate;
use App\SettingActiveBank;
use Illuminate\Http\Request;
class BookingSupplierController extends Controller
{
public function index()
{
$bookingsupplier = SupplierBooking::all();
$response = [
'supplier-booking' => $bookingsupplier
];
return response()->json($response, 200);
}
public function show($id)
{
$booking = Booking::where('id', $id)->first();
$bankin_amount = round($booking->amount / $booking->rate, 2);
if (!$booking){
return response()->json(['message' => 'Booking not found'], 404);
}
switch ($booking->term) {
case "x1_cash":
$payment_method = "CASH";
break;
case "x1_cheque":
$payment_method = "CHEQUE";
break;
case "x1_ba":
$payment_method = "BA";
break;
case "x2_cash":
$payment_method = "CASH";
break;
case "x2_cheque":
$payment_method = "CHEQUE";
break;
case "x2_ba":
$payment_method = "BA";
break;
default:
return response()->json([
'success' => false,
'message' => 'Invalid input',
], 422);
break;
}
$supplier_booking = $booking->supplierBooking()->first();
$dt = new \DateTime($supplier_booking->created_at);
$supplier_booking->date = $dt->format('j F Y');
$supplier_booking->marking = $booking->user->marking;
$supplier_booking->payment_for = $booking->payment_for;
$supplier_booking->order_no = $booking->order_no;
$supplier_booking->payment_method = $payment_method;
$active_bank = SettingActiveBank::first();
// if setting is set to use customer's beneficiary
if ($active_bank->beneficiary_id == 0){
$supplier_booking->acc_name = $booking->account_name;
$supplier_booking->acc_no = $booking->account_num; // TODO : standardize acc_no
$supplier_booking->bank_name = $booking->bank_name;
}
else{
$beneficiary = SettingBeneficiary::find($active_bank->beneficiary_id);
$supplier_booking->acc_name = $beneficiary->company_name;
$supplier_booking->acc_no = $beneficiary->acc_no;
$supplier_booking->bank_name = $beneficiary->bank_name;
}
return response()->json($supplier_booking ,200);
}
// Only for single booking
// TODO : Multiple booking
public function store(Request $request)
{
//$transfer_amount = $request->input("transfer_amount");
$supplier_id = $request->input("supplier_id");
$booking_id = $request->input("booking_id");
$rate = $request->input('rate'); // costing rate
$rebate = $request->input('rebate');
$supplier = SettingSupplier::find($supplier_id);
$booking = Booking::find($booking_id);
// Calculation (backup)
// $amountInRMB = $transfer_amount * $rate;
// $billing = 0.015 * $transfer_amount;
// $sales_tax = 0.0 * $transfer_amount;
// $gst = 0 * $transfer_amount; // do we still need this ?
// $customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
// $rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// Update: changes in 1.1 according to new supplier booking report
$transfer_amount = $booking->amount;
$amount_in_myr = round($transfer_amount / $rate, 2);
$amountInRMB = $transfer_amount;
$tax_rate = SettingTaxRate::latest()->first()->tax_rate;
$sales_tax = round($tax_rate * $amount_in_myr - $amount_in_myr, 2);
$amount_after_tax = round($amount_in_myr * $tax_rate,2);
//$billing = 0.015 * $transfer_amount;
//
//$gst = 0 * $transfer_amount; // do we still need this ?
//$customerBankInAmount = round($transfer_amount + $gst + $sales_tax + $billing,2);
//$rmbBankAmount = round($customerBankInAmount + $rebate, 2);
// update existing booking supplier if exist
$bookingsupplier = SupplierBooking::where('booking_id', $booking_id)->first();
if (!$bookingsupplier){
$bookingsupplier = new SupplierBooking();
}
$bookingsupplier->supplier_id = $supplier->id;
$bookingsupplier->amountInRMB = $amountInRMB; // TODO : rename to underscore
$bookingsupplier->amount_in_myr = $amount_in_myr;
$bookingsupplier->tax_rate = $tax_rate;
$bookingsupplier->amount_after_tax = $amount_after_tax;
$bookingsupplier->rate = $rate;
$bookingsupplier->rebate = $rebate;
$bookingsupplier->salestax_amount = $sales_tax;
//$bookingsupplier->payment_method = $request->input('payment_method'); // TODO : remove from db
//$bookingsupplier->transfer_amount = $transfer_amount; // TODO : remove from db
//$bookingsupplier->billing_amount = $billing; // TODO : remove from db
//$bookingsupplier->rmbBankAmount = $rmbBankAmount; // TODO : remove from db
$bookingsupplier->booking_id = $booking->id;
$bookingsupplier->save();
// update booking status
$booking->status = 4;
$booking->admin_status = 4;
$booking->save();
return response()->json($bookingsupplier, 201);
}
public function report(Request $request, $id)
{
$supplier_booking = Booking::firstOrFail($id)->supplierBooking()->firstOrFail();
return response()->json($supplier_booking ,200);
}
}
@@ -3,105 +3,93 @@
namespace App\Http\Controllers;
use App\ChinaBankSlip;
use App\Booking;
use App\User;
use App\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Validator;
class ChinaBankSlipController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// Handle File Upload
if($request->hasFile('china_bank_slips')){
// Get filename with the extension
$filenameWithExt = $request->file('china_bank_slips')->getClientOriginalName();
// Get just filename
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
// Get just ext
$extension = $request->file('china_bank_slips')->getClientOriginalExtension();
// Filename to store
$fileNameToStore= $filename.'_'.time().'.'.$extension;
// Upload Image
$path = $request->file('china_bank_slips')->storeAs('public/bankslip', $fileNameToStore);
} else {
$fileNameToStore = 'hello.jpg';
public function store(Request $request, $id)
{
$booking = Booking::where('id',$id)->firstOrFail();
if (!$booking) {
return response()->json(['message'=>'Access denied'], 403);
}
// Create Post
$post = new ChinaBankSlip;
$post->actual_transfer_amount = $request->input('actual_transfer_amount');
$post->date = $request->input('date');
$post->details = $request->input('details');
$post->china_bank_slips = $fileNameToStore;
$post->save();;
}
// TODO : put this after check file exist
// validate file format
$validator = Validator::make($request->all(), [
'file' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
]);
if($validator->fails()){
return response()->json(['message'=>'Incorrect format'],400);
}
$validator = Validator::make($request->all(), [
'china_bank_slips' => 'max:10000'
]);
if($validator->fails()){
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
}
if($bankslip_file = $request->file('file')){
$filename = $bankslip_file->getClientOriginalName();
$ext = $bankslip_file->getClientOriginalExtension();
$unique_name = 'cnbank_slip_' . md5($filename. time()); // probably not a good idea
$unique_image_path = $unique_name. '.' .$ext;
// Upload Image
$upload_path = Storage::disk('public')->putFileAs(
'china_bank_slip', $bankslip_file, $unique_image_path
);
/**
* Display the specified resource.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function show(ChinaBankSlip $chinaBankSlip)
{
//
} else {
return response()->json(['message'=>'file not found'],200);
}
$china_bankslip = new ChinaBankSlip;
$china_bankslip->booking_id = $booking->id;
$china_bankslip->china_bank_slip_path = $upload_path;
$china_bankslip->save();
return response()->json(['message'=>'success'], 201);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function edit(ChinaBankSlip $chinaBankSlip)
{
//
public function update(Request $request, $id){
$booking = Booking::where('id',$id)->first();
$china_bankslip = $booking->chinaBankSlip()->first();
// TODO: first or fail
if(!$china_bankslip){
return response()->json(["message"=> "China bankslip not found. Please upload first."],400);
}
$china_bankslip->actual_transfer_amount = $request->input('actual_transfer_amount');
$china_bankslip->date = $request->input('date');
$china_bankslip->details = $request->input('details');
$china_bankslip->save();
// update booking status
$booking->status = 5;
$booking->admin_status = 6;
$booking->save();
$userNotification = new Notification;
$userNotification->detail = "Your china bankslip for booking " . $booking->id . " is uploaded.";
$userNotification->link = "/booking/" . $booking->id . "/upload-po";
$userNotification->user_id = $booking->user_id;
$userNotification->save();
return response()->json(["message"=> "Success"],200);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ChinaBankSlip $chinaBankSlip)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\ChinaBankSlip $chinaBankSlip
* @return \Illuminate\Http\Response
*/
public function destroy(ChinaBankSlip $chinaBankSlip)
{
//
}
}
@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Notification;
use Illuminate\Support\Facades\DB;
use Auth;
class NotificationController extends Controller
{
public function index()
{
return Notification::all()->orderby('updated_at','desc');
}
public function show(Notification $notification)
{
return $notification;
}
public function store(Request $request)
{
$notification = Notification::create($request->all());
return response()->json($notification, 201);
}
public function update(Request $request, Notification $notification)
{
$notification->update($request->all());
return response()->json($notification, 200);
}
public function delete(Notification $notification)
{
$notification->delete();
return response()->json(null, 204);
}
public function getUserMessage()
{
$user_all_notification = Notification::Where("user_id",Auth::user()->id)
->orderby('updated_at','desc')
->paginate(5);
$user_unread_notification = Notification::Where([["user_id",Auth::user()->id],["is_read",0]])
->orderby('updated_at','desc')
->get();
return response()->json([
"message" =>$user_all_notification,
"unread_message" =>$user_unread_notification
],200);
}
public function readNotification($notification_id){
$affected = DB::table('notifications')
->Where('id', $notification_id)
->update(array('is_read' => 1));
return response()->json("Read message", 200);
}
}
+7 -5
View File
@@ -12,11 +12,6 @@ class RateController extends Controller
return Rate::all();
}
public function show(Rate $rate)
{
return $rate;
}
public function store(Request $request)
{
$rate = Rate::create($request->all());
@@ -37,4 +32,11 @@ class RateController extends Controller
return response()->json(null, 204);
}
public function show()
{
$rate = Rate::latest()->first();
return response()->json($rate, 200);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingActiveBank;
class SettingActiveBankController extends Controller
{
public function index()
{
$active_bank_setting = SettingActiveBank::latest()->first();
return response()->json($active_bank_setting, 200);
}
public function update(Request $request)
{
if($active_bank_setting = SettingActiveBank::latest()->first())
$active_bank_setting->update($request->all());
else
$active_bank_setting = SettingActiveBank::create($request->all());
return response()->json($active_bank_setting, 200);
}
}
@@ -12,8 +12,12 @@ class SettingBeneficiaryController extends Controller
return SettingBeneficiary::all();
}
public function show(SettingBeneficiary $beneficiary)
public function show($beneficiary)
{
if ($beneficiary == 0){
response()->json(["company_name"=>"123", "account_number"=>"123"] , 201);
}
$beneficiary = SettingBeneficiary::find($beneficiary);
return $beneficiary;
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingBillingCharge;
class SettingBillingChargeController extends Controller
{
public function index()
{
$billing_charge_setting = SettingBillingCharge::latest()->first();
return response()->json($billing_charge_setting, 201);
}
public function update(Request $request)
{
if($billing_charge_setting = SettingBillingCharge::latest()->first())
$billing_charge_setting->update($request->all());
else
$billing_charge_setting = SettingBillingCharge::create($request->all());
return response()->json($billing_charge_setting, 200);
}
}
@@ -9,7 +9,8 @@ class SettingCreditController extends Controller
{
public function index()
{
return SettingCredit::all();
$credit_setting = SettingCredit::latest()->first();
return response()->json($credit_setting, 201);
}
public function show(SettingCredit $credit)
@@ -24,11 +25,12 @@ class SettingCreditController extends Controller
return response()->json($credit, 201);
}
public function update(Request $request, SettingCredit $credit)
public function update(Request $request)
{
$credit->update($request->all());
$credit_setting = SettingCredit::latest()->first();
$credit_setting->update($request->all());
return response()->json($credit, 200);
return response()->json($credit_setting, 200);
}
public function delete(SettingCredit $credit)
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingMalaysiaBank;
class SettingMalaysiaBankController extends Controller
{
public function index()
{
return SettingMalaysiaBank::all();
}
public function show(SettingMalaysiaBank $malaysiaBank)
{
return $malaysiaBank;
}
public function store(Request $request)
{
$malaysiaBank = SettingMalaysiaBank::create($request->all());
return response()->json($malaysiaBank, 201);
}
public function update(Request $request, SettingMalaysiaBank $malaysiaBank)
{
$malaysiaBank->update($request->all());
return response()->json($malaysiaBank, 200);
}
public function delete(SettingMalaysiaBank $malaysiaBank)
{
$malaysiaBank->delete();
return response()->json(null, 204);
}
}
@@ -9,7 +9,13 @@ class SettingSupplierController extends Controller
{
public function index()
{
return SettingSupplier::all();
$suppliers = SettingSupplier::all();
foreach ($suppliers as $supplier) {
$supplier->value = $supplier->id;
$supplier->label = $supplier->company_name;
}
return $suppliers;
}
public function show(SettingSupplier $supplier)
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SettingTaxRate;
class SettingTaxRateController extends Controller
{
public function index()
{
$setting_tax = SettingTaxRate::latest()->first();
return response()->json($setting_tax, 201);
}
public function update(Request $request)
{
if($setting_tax = SettingTaxRate::latest()->first())
$setting_tax->update($request->all());
else
$setting_tax = SettingTaxRate::create($request->all());
return response()->json($setting_tax, 200);
}
}
+5 -2
View File
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
class UserController extends Controller
{
@@ -15,7 +16,9 @@ class UserController extends Controller
* @return \Illuminate\Http\Response
*/
public function show(Request $request)
{
return $request->user();
{
$user = Auth::user();
return $user;
}
}
+3 -2
View File
@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
],
'api' => [
'throttle:60,1',
// 'throttle:60,1',
'bindings',
],
];
@@ -61,6 +61,7 @@ class Kernel extends HttpKernel
'ability' => 'App\Http\Middleware\TokenEntrustAbility',
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'jwt' => \App\Http\Middleware\RefreshToken::class
'jwt' => \App\Http\Middleware\RefreshToken::class,
'ability' => 'App\Http\Middleware\TokenEntrustAbility'
];
}
+4
View File
@@ -7,4 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
protected $fillable = ['invoice_url','amount','booking_id'];
public function booking(){
return $this->hasOne('App\Booking');
}
}
+5
View File
@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Marking extends Model
{
protected $fillable = ['email','marking'];
public function user()
{
return $this->belongsTo('app\User');
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = ['detail','user_id','is_read'];
protected $appends = ['time_interval'];
public function getTimeIntervalAttribute()
{
$created_time = $this->created_at;
date_default_timezone_set('Asia/Kuala_Lumpur'); //Change as per your default time
$str = strtotime($created_time);
$today = strtotime(date('Y-m-d H:i:s'));
// It returns the time difference in Seconds...
$time_differnce = $today-$str;
// To Calculate the time difference in Years...
$years = 60*60*24*365;
// To Calculate the time difference in Months...
$months = 60*60*24*30;
// To Calculate the time difference in Days...
$days = 60*60*24;
// To Calculate the time difference in Hours...
$hours = 60*60;
// To Calculate the time difference in Minutes...
$minutes = 60;
if(intval($time_differnce/$years) > 1)
{
return intval($time_differnce/$years)." years ago";
}else if(intval($time_differnce/$years) > 0)
{
return intval($time_differnce/$years)." year ago";
}else if(intval($time_differnce/$months) > 1)
{
return intval($time_differnce/$months)." months ago";
}else if(intval(($time_differnce/$months)) > 0)
{
return intval(($time_differnce/$months))." month ago";
}else if(intval(($time_differnce/$days)) > 1)
{
return intval(($time_differnce/$days))." days ago";
}else if (intval(($time_differnce/$days)) > 0)
{
return intval(($time_differnce/$days))." day ago";
}else if (intval(($time_differnce/$hours)) > 1)
{
return intval(($time_differnce/$hours))." hours ago";
}else if (intval(($time_differnce/$hours)) > 0)
{
return intval(($time_differnce/$hours))." hour ago";
}else if (intval(($time_differnce/$minutes)) > 1)
{
return intval(($time_differnce/$minutes))." minutes ago";
}else if (intval(($time_differnce/$minutes)) > 0)
{
return intval(($time_differnce/$minutes))." minute ago";
}else if (intval(($time_differnce)) > 1)
{
return intval(($time_differnce))." seconds ago";
}else
{
return "few seconds ago";
}
}
}
+5
View File
@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class PurchaseOrder extends Model
{
protected $fillable = ['image_url','amount','booking_id'];
public function booking()
{
return $this->belongsTo(Booking::class);
}
}
+1
View File
@@ -7,4 +7,5 @@ use Illuminate\Database\Eloquent\Model;
class Rate extends Model
{
protected $fillable = ['x1_cash','x1_cheque','x1_ba','x2_cash','x2_cheque','x2_ba'];
protected $hidden = ['id'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingActiveBank extends Model
{
protected $fillable = ['x1_bank_id','x2_bank_id','beneficiary_id'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingBillingCharge extends Model
{
protected $fillable = ['billing_charge_rate'];
}
+1 -1
View File
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class SettingCredit extends Model
{
protected $fillable = ['rmb_credit_limit','usd_credit_limit'];
protected $fillable = ['rmb_credit_limit','usd_credit_limit','time_limit'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingMalaysiaBank extends Model
{
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingTaxRate extends Model
{
protected $fillable = ['tax_rate'];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SupplierBooking extends Model
{
// protected $guarded = [];
protected $fillable = ['rate','rebate','payment_amount','payment_method'];
public $timestamps = true;
public function user()
{
return $this->belongsTo('app\User');
}
public function booking(){
return $this->belongTo('App\Booking');
}
public function supplierBookingTtem()
{
return $this->hasMany('App\SupplierBookingItem');
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SupplierBookingItem extends Model
{
protected $fillable = [
'id',
'china_bankslip_url',
'book_id',
'bank_in_amount',
'date',
'details',
'supplierbooking_id'
];
public function bookingsupplier()
{
return $this->belongsTo('App\BookingSupplier');
}
}
+7 -3
View File
@@ -29,7 +29,7 @@ class User extends Authenticatable implements JWTSubject
* @var array
*/
protected $hidden = [
'password', 'remember_token',
'password', 'remember_token'
];
/**
@@ -58,7 +58,7 @@ class User extends Authenticatable implements JWTSubject
*/
public function getRoleAttribute()
{
// return $this->roles->first()->name;
return $this->roles->first()->name;
}
/**
@@ -98,8 +98,12 @@ class User extends Authenticatable implements JWTSubject
return [];
}
public function booking(){
public function bookings(){
return $this->hasMany(Booking::class);
}
public function marking(){
return $this->hasOne(Booking::class);
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class UserBankSlip extends Model
{
protected $fillable = ['bank_slip_type','bankslip_url','transfer_amount','booking_id','cust_marking'];
protected $fillable = ['bank_slip_type','bankslip_url','transfer_amount','booking_id','cust_marking','estimated_arrival_time'];
public function booking()
{
Executable → Regular
View File
+35
View File
@@ -0,0 +1,35 @@
# Save latest Git commit message
MESSAGE=$(git log -1 --pretty=%B)
# Add it as a secret variable on CI environment
git remote set-url origin $REMOTE_REPOSITORY
git config user.email $DEPLOY_GIT_EMAIL
git config user.name $DEPLOY_GIT_USERNAME
if git ls-remote $REMOTE_REPOSITORY | grep -sw "deploy" 2>&1>/dev/null; then
git checkout . && git checkout deploy;
else
git checkout --orphan deploy;
fi
# Remove all files except .git, node_modules and vendor folder
find . -path ./.git -prune -o \( \! -path ./dist \) -prune -o \( \! -path ./vendor \) -exec rm -rf {} \; 2> /dev/null
# Add master branch files
git archive master | tar x -C .
# Generate i18n string for the front-end
composer install -n --prefer-dist
php artisan vue-i18n:generate
# Compile front-end stuff
yarn --pure-lockfile
yarn production
# Those files are ignored on master branch, force add it
git add -f public/css
git add -f public/js
# Push to the deploy branch
git add .
git commit -am "[${CI_COMMIT_SHA:0:8}]: $MESSAGE"
git push -u origin deploy
+35
View File
@@ -0,0 +1,35 @@
https://exchange-staging.izyim.com {
root /var/www/public
fastcgi / 127.0.0.1:9000 php {
index index.php
}
header / {
Cache-Control no-cache
}
# To handle .html extensions with laravel change ext to
# ext / .html
rewrite {
r .*
ext /
to /index.php?{query}
}
gzip
# browse
log stdout
errors stdout
on startup php-fpm --nodaemonize
# Uncomment to enable TLS (HTTPS)
# Change the first list to listen on port 443 when enabling TLS
tls admin@izyim.com
# To use Lets encrpt tls with a DNS provider uncomment these
# lines and change the provider as required
#tls {
# dns cloudflare
#}
}
+18
View File
@@ -0,0 +1,18 @@
FROM php:7.1-fpm
LABEL maintainer="Paul Redmond <paul@bitpress.io>"
# Install application dependencies
RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?plugins=http.expires,http.realip&license=personal" \
| tar --no-same-owner -C /usr/bin/ -xz caddy \
&& chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version \
&& docker-php-ext-install mbstring pdo pdo_mysql
COPY Caddyfile /etc/Caddyfile
WORKDIR /var/www
RUN ln -sf /var/www/storage/app/public /var/www/public
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "cretueusebiu/laravel-vue-spa",
"description": "A Laravel-Vue SPA starter project template.",
"keywords": ["spa", "laravel", "vue"],
"name": "IZYIM Exchange",
"description": "A currency exchange system.",
"keywords": ["exchange", "izyim", "vue"],
"license": "MIT",
"type": "project",
"require": {
Generated
+240 -335
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -13,7 +13,7 @@ return [
|
*/
'name' => env('APP_NAME', 'Laravel'),
'name' => env('APP_NAME', 'Exchange'),
/*
|--------------------------------------------------------------------------
@@ -65,7 +65,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'Asia/Kuala_Lumpur',
/*
|--------------------------------------------------------------------------
+1 -1
View File
@@ -96,7 +96,7 @@ return [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'expire' => 3000,
],
],
+1 -1
View File
@@ -100,7 +100,7 @@ return [
|
*/
'ttl' => env('JWT_TTL', 60),
'ttl' => env('JWT_TTL', 60 * 12),
/*
|--------------------------------------------------------------------------
-1
View File
@@ -1 +0,0 @@
*.sqlite
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(Model::class, function (Faker $faker) {
return [
//
];
});
+3 -1
View File
@@ -4,6 +4,8 @@ use Faker\Generator as Faker;
$factory->define(App\SettingCredit::class, function (Faker $faker) {
return [
//
'rmb_credit_limit' => $faker->randomDigit,
'usd_credit_limit' => $faker->randomDigit,
'time_limit' => $faker->randomDigit
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(Model::class, function (Faker $faker) {
return [
//
];
});
@@ -4,6 +4,10 @@ use Faker\Generator as Faker;
$factory->define(App\SettingSupplier::class, function (Faker $faker) {
return [
//
'company_name' => $faker->name,
'gst_no' => $faker->unique()->randomDigit,
'supplier_reg_no' => $faker->unique()->randomDigit,
'bank_name' => $faker->name,
'acc_no' => $faker->unique()->randomDigit
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SupplierBookingItem::class, function (Faker $faker) {
return [
//
];
});
@@ -11,5 +11,6 @@ $factory->define(App\UserBankSlip::class, function (Faker $faker) {
'transfer_amount' => $faker->randomDigit,
'cust_marking' => str_random(10),
'booking_id' => $faker->randomElement($book_id),
'estimated_arrival_time' => $faker->randomDigit
];
});
+1
View File
@@ -21,5 +21,6 @@ $factory->define(App\User::class, function (Faker $faker) {
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'marking' => $faker->name,
];
});
@@ -29,7 +29,7 @@ class CreateUsersTable extends Migration
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
{
Schema::drop('users');
}
}
@@ -17,7 +17,7 @@ class CreateSettingBeneficiariesTable extends Migration
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no');
$table->string('acc_no')->unique();
$table->string('bank_address');
$table->string('swift');
$table->string('cnap');
@@ -41,7 +41,13 @@ class CreateBookingsTable extends Migration
* @return void
*/
public function down()
{
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_rate_id_foreign');
$table->dropColumn('rate_id');
});
Schema::dropIfExists('bookings');
}
@@ -29,6 +29,10 @@ class ChangeUserIdInBookingsTable extends Migration
*/
public function down()
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_user_id_foreign');
$table->dropColumn('user_id');
});
}
}
@@ -28,11 +28,7 @@ class AddBookingsTable extends Migration
$table->string('usd_book_swift_code')->default(' ');
$table->string('usd_book_cnap')->default(' ');
$table->string('usd_book_bank_branch')->default(' ');
$table->boolean('verification_status')->default('1'); // Results in a default value of 1.
// $table->foreign('status_id')
// ->references('id')->on('status')
// ->onDelete('cascade');
$table->boolean('verification_status')->default('1');
});
}
@@ -43,8 +39,6 @@ class AddBookingsTable extends Migration
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -28,11 +28,7 @@ class MakeNullableFieldBookingsTable extends Migration
$table->string('usd_book_swift_code')->nullable()->change();
$table->string('usd_book_cnap')->nullable()->change();
$table->string('usd_book_bank_branch')->nullable()->change();
$table->boolean('verification_status')->nullable()->change(); // Results in a default value of 1.
// $table->foreign('status_id')
// ->references('id')->on('status')
// ->onDelete('cascade');
$table->boolean('verification_status')->nullable()->change();
});
}
@@ -19,7 +19,6 @@ class CreateUserBankSlipsTable extends Migration
$table->string('bankslip_url')->nullable();
$table->double('transfer_amount')->nullable();
$table->string('cust_marking')->nullable();
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
@@ -34,6 +33,11 @@ class CreateUserBankSlipsTable extends Migration
*/
public function down()
{
Schema::table('user_bank_slips', function(Blueprint $table)
{
$table->dropForeign('user_bank_slips_book_id_foreign');
});
Schema::dropIfExists('user_bank_slips');
}
}
@@ -30,6 +30,11 @@ class CreatePurchaseOrdersTable extends Migration
*/
public function down()
{
Schema::table('purchase_orders', function(Blueprint $table)
{
$table->dropForeign('purchase_orders_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('purchase_orders');
}
}
@@ -28,6 +28,6 @@ class CreateMarkingTable extends Migration
*/
public function down()
{
Schema::dropIfExists('marking');
Schema::dropIfExists('markings');
}
}
@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SupplierBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplier_bookings', function (Blueprint $table) {
$table->increments('id');
$table->string('payment_method');
$table->double('transfer_amount');
$table->double('rate');
$table->double('rebate');
$table->double('amountInRMB');
$table->double('rmbBankAmount');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
$table->integer('supplier_id')->unsigned();
$table->foreign('supplier_id')->references('id')->on('setting_suppliers');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplier_bookings');
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SupplierbookingCustomerbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplierbooking_customerbooking', function (Blueprint $table) {
$table->integer('supplierbooking_id')->unsigned();
$table->integer('booking_id')->unsigned();
$table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings');
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplierbooking_customerbooking');
}
}
@@ -30,6 +30,12 @@ class CreateInvoiceTable extends Migration
*/
public function down()
{
Schema::table('invoices', function(Blueprint $table)
{
$table->dropForeign('invoices_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('invoices');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdminstatusToBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(1);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('admin_status');
// $table->dropColumn('reject_reason');
});
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAdminstatusDefaultBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(0)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAdminstatusDefaultTo1OnBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(1)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimeLimitSettingCreditTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_credits', function (Blueprint $table) {
$table->integer('time_limit');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setting_credits', function (Blueprint $table) {
// $table->dropColumn('time_limit');
});
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSupplierBookingItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplier_booking_items', function (Blueprint $table) {
$table->increments('id');
$table->string('china_bankslip_url');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
$table->double('bank_in_amount');
$table->integer('supplierbooking_id')->unsigned();
$table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplier_booking_items');
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddEtaUserBankSlipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->integer('estimated_arrival_time');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('user_bank_slips', 'estimated_arrival_time')) {
Schema::table('user_bank_slips', function (Blueprint $table) {
// $table->dropColumn('estimated_arrival_time');
});
}
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBankslipUrlToChinabanksliPathInChinaBankSlipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function($table)
{
$table->renameColumn('bankslip_url', 'china_bank_slip_path');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakePaymentmethodNulltableInSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->string('payment_method')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBookingidForeignkeyToChinabankslipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function($table)
{
$table->integer('booking_id')->unsigned();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('china_bank_slips', function(Blueprint $table)
{
$table->dropForeign('china_bank_slips_booking_id_foreign');
$table->dropColumn('booking_id');
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBookingForeignkeyInPoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('purchase_orders', function($table)
{
$table->dropForeign(['book_id']);
$table->dropColumn('book_id');
$table->integer('booking_id')->unsigned();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveUserInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('name');
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBookingForeignkeyFromSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->dropForeign(['book_id']);
$table->dropColumn('book_id');
$table->integer('booking_id')->unsigned();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBillingFieldToSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->double('billing_amount');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSalestaxFieldToSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->double('salestax_amount');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNameInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name');
});
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateNameToNullableInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('name')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMarkingToUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('marking');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_malaysia_banks', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no')->unique();
$table->string('bank_address');
$table->string('swift');
$table->string('cnap');
$table->string('bank_branch');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_malaysia_banks');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function(Blueprint $table) {
$table->string('company_name')->nullable()->change();
$table->string('bank_name')->nullable()->change();
$table->string('acc_no')->nullable()->change();
$table->string('bank_address')->nullable()->change();
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('bank_branch')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingActiveBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_active_banks', function (Blueprint $table) {
$table->increments('id');
$table->string('x1_bank_id')->unique();
$table->string('x2_bank_id')->unique();
$table->string('beneficiary_id')->unique();
$table->foreign('x1_bank_id')
->references('acc_no')->on('setting_malaysia_banks')
->onDelete('cascade');
$table->foreign('x2_bank_id')
->references('acc_no')->on('setting_malaysia_banks')
->onDelete('cascade');
$table->foreign('beneficiary_id')
->references('acc_no')->on('setting_beneficiaries')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_active_banks');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeForeignkeyTypeInActivebankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function(Blueprint $table)
{
$table->dropForeign('setting_active_banks_x1_bank_id_foreign');
$table->foreign('x1_bank_id')
->references('acc_no')->on('setting_malaysia_banks');
$table->dropForeign('setting_active_banks_x2_bank_id_foreign');
$table->foreign('x2_bank_id')
->references('acc_no')->on('setting_malaysia_banks');
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
$table->foreign('beneficiary_id')
->references('acc_no')->on('setting_beneficiaries');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNotNullableSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function(Blueprint $table) {
$table->string('company_name')->nullable(false)->change();
$table->string('bank_name')->nullable(false)->change();
$table->string('acc_no')->nullable()->change(); // reference key at select active bank
$table->string('bank_address')->nullable(false)->change();
$table->string('swift')->nullable(false)->change();
$table->string('cnap')->nullable(false)->change();
$table->string('bank_branch')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,51 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateAccnoToIdSettingActiveTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function(Blueprint $table)
{
$table->dropForeign('setting_active_banks_x1_bank_id_foreign');
$table->dropForeign('setting_active_banks_x2_bank_id_foreign');
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
$table->dropColumn('x1_bank_id');
$table->dropColumn('x2_bank_id');
$table->dropColumn('beneficiary_id');
});
Schema::table('setting_active_banks', function(Blueprint $table)
{
$table->unsignedInteger('x1_bank_id')->unique();
$table->foreign('x1_bank_id')
->references('id')->on('setting_malaysia_banks');
$table->unsignedInteger('x2_bank_id')->unique();
$table->foreign('x2_bank_id')
->references('id')->on('setting_malaysia_banks');
$table->unsignedInteger('beneficiary_id')->unique();
$table->foreign('beneficiary_id')
->references('id')->on('setting_beneficiaries');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateAutoincrementStartFrom2000InBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("ALTER TABLE bookings AUTO_INCREMENT = 2000;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeChinaBeneficiaryAccNulabbleInBeneficiarysettingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function (Blueprint $table) {
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
$table->integer('beneficiary_id')->nullable()->unsigned()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('beneficiarysetting', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingBillingChargeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_billing_charges', function (Blueprint $table) {
$table->increments('id');
$table->double('billing_charge_rate');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_billing_charges');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOrdernoNPaymentforFieldToBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->string('order_no')->nullable();
$table->string('payment_for');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingTaxRateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_tax_rates', function (Blueprint $table) {
$table->increments('id');
$table->double('tax_rate');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_tax_rates');
}
}
@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('detail');
$table->string('link');
$table->unsignedInteger('user_id');
$table->boolean('is_read')->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddFieldsIntoSupplierBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->string('amount_in_myr')->nullable();
$table->string('tax_rate')->nullable();
$table->string('amount_after_tax')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

Some files were not shown because too many files have changed in this diff Show More