/** * Remove the user. * * @param int $id * @return Response */ public function destroy($id, Request $request) { $user = User::findOrFail($id); $user->delete(); $request->session()->flash('status', $user->name . ' has been deleted!'); return redirect()->route('users.index'); }
/** * Execute the console command. * * @return mixed */ public function handle() { // Get every user. $users = User::getUsers(); // Get the message. foreach ($users as $user) { $message = Message::getMessage($user); $client = new \GuzzleHttp\Client(['base_uri' => 'http://localhost:3001']); // Send a request to the node server to post the message. $client->request('POST', '/post', ['json' => ['user' => $user, 'message' => $message]]); } }