mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-23 22:44:06 +00:00
redo deli info testing
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Deliveryinfo;
|
||||
use App\User;
|
||||
use App\Company;
|
||||
use Auth;
|
||||
|
||||
class DeliveryinfoController extends Controller
|
||||
@@ -11,6 +13,11 @@ class DeliveryinfoController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
|
||||
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
@@ -23,7 +30,18 @@ class DeliveryinfoController extends Controller
|
||||
*/
|
||||
public function show(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->first();
|
||||
|
||||
if (!$deliveryinfo)
|
||||
{
|
||||
return response()->json(['message'=>'Access Denied!'], 404);
|
||||
}
|
||||
|
||||
$deliveryinfos = DB::table('deliveryinfos')
|
||||
->select('id', 'branch', 'deli_info', 'address', 'city', 'postcode', 'state', 'country', 'contact_person', 'contact_person_no', 'com_id')
|
||||
->where('com_id', Auth::user()->company())
|
||||
->get();
|
||||
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user