public function getAllResturantUsers($id)
 {
     $users = User::Where('resturant_id', '=', $id)->Where('role_id', '=', 2)->get();
     $response = array();
     if (sizeof($users) > 0) {
         foreach ($users as $user) {
             $user_locations = UserLocation::Where('user_id', '=', $user['id'])->lists('location_id');
             $alluserlocation = Location::WhereIn('id', $user_locations)->get();
             $user_actions = UserAction::Where('user_id', '=', $user['id'])->first();
             array_push($response, ["user" => $user, "locations" => $alluserlocation, "mainmenu" => unserialize($user_actions['maincard']), "weeklymenu" => unserialize($user_actions['weeklymenu']), "items" => unserialize($user_actions['items'])]);
         }
         $allresturantlocations = Location::Where('resturantId', '=', $id)->get();
         return response()->json(["Response" => 'success', "data" => $response, "AllLocations" => $allresturantlocations]);
     }
     return response()->json(['Response' => 'error', 'message' => 'There was an error processing your request']);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     //
     $franchises = Franchise::Where('resturantId', '=', $id)->get();
     $location = Location::Where('resturantId', '=', $id)->get();
     $response = array();
     if (sizeof($franchises) > 0) {
         foreach ($franchises as $franchise) {
             $user = User::Where('franchise_id', '=', $franchise['id'])->get();
             array_push($response, ["Franchise" => $franchise, "users" => $user]);
         }
         return response()->json(['Response' => 'success', 'data' => $response, 'locations' => $location]);
     } else {
         return response()->json(['Response' => 'error']);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $locationid)
 {
     //
     $allLocations = UserLocation::Where('location_id', '=', $locationid)->lists('user_id');
     UserAction::WhereIn('user_id', $allLocations)->delete();
     UserLocation::WhereIn('user_id', $allLocations)->delete();
     User::WhereIn('id', $allLocations)->delete();
     Location::Where('id', '=', $locationid)->delete();
     return response()->json(["Response" => "success", "message" => "Location Deleted"]);
 }