fetching branchname and popup

This commit is contained in:
Asif
2018-07-02 22:25:51 +08:00
parent c917811978
commit c8a79a40fe
2 changed files with 34 additions and 13 deletions
@@ -11,7 +11,8 @@ class DeliveryinfoController extends Controller
{
public function index()
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
$com_id = Auth::user()->company()->first()->id;
$deliveryinfo = Deliveryinfo::where('com_id', $com_id)->get();
return response()->json($deliveryinfo, 200);
}
@@ -23,7 +24,9 @@ class DeliveryinfoController extends Controller
*/
public function show(Deliveryinfo $id)
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
// TODO : make user company not array
$com_id = Auth::user()->company()->get()[0]['id'];
$deliveryinfo = Deliveryinfo::where('com_id', $com_id)->where('id', $id)->firstOrFail();
return response()->json($deliveryinfo, 200);
}