mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-21 13:24:27 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user