| public function getDatabase(Request $request) | public function getDatabase(Request $request) | ||||
| { | { | ||||
| $subscriber = Subscriber::where('state', $request->state )->get(); | |||||
| $subscriber = Subscriber::groupBy('city')->get(); | |||||
| $city = array(); | |||||
| foreach ($subscriber as $key => $s) { | foreach ($subscriber as $key => $s) { | ||||
| # code.. | |||||
| $s->city = "CYBERJAYA"; | |||||
| $s->state = "SELANGOR"; | |||||
| $s->save(); | |||||
| # code... | |||||
| array_push($city, array( | |||||
| 'city' => $s->city | |||||
| )); | |||||
| } | } | ||||
| return count($subscriber) . $subscriber; | |||||
| return $city; | |||||
| } | } | ||||
| } | } |