mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 12:34:06 +00:00
bug fixing
This commit is contained in:
@@ -16,33 +16,40 @@ class WarehouseController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$warehouse = Warehouse::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
|
||||
if (!$warehouse)
|
||||
$warehouses = Warehouse::where('com_id', Auth::user()->company())->get();
|
||||
|
||||
if (!$warehouses)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
$warehouse=Warehouse::all();
|
||||
$warehouse = Warehouse::all();
|
||||
|
||||
return response()->json($warehouse, 200);
|
||||
return response()->json($warehouses, 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display warehouse list from freight forwarder.
|
||||
* Display warehouse list from freight forwarder. can list the warehouse if it is from the freight forwarder
|
||||
* need to do DB query
|
||||
* show all the warehouse that belongs to the user company
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$warehouse=Warehouse::find($id);
|
||||
$response=[
|
||||
$warehouses = DB::table('warehouses')
|
||||
//->join('id', 'address', 'city', 'zip')
|
||||
->select('id', 'address', 'city', 'zip', 'state', 'contact_person', 'contact_person_no', 'branch', 'country', 'com_id')
|
||||
->where('com_id', Auth::user()->company())
|
||||
->get();
|
||||
|
||||
'warehouse'=>$warehouse
|
||||
if (!$warehouses)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
];
|
||||
return response()->json($warehouse, 200);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user