Hi guys I am working on a small laravel project and I dont understand why something isnt working. I have a web side that sends a ajax call to a REST API. When the server code takes a request such as
public function createUser(Request $request)
{
$username = $request->get('username');
$password = $request->get('password');
$password2 = $request->get('password2');
$email = $request->get('emailAddress');
$phone = $request->get('phoneNumber');
$librarian = $request->get('librarian');
Log::info($request);
}
It prints this out in the logs
[2017-11-28 03:20:39] local.INFO: array (
'{"username":"sdrafahl","password":"st","password2":"st","emailAddress":"shanedrafahl@gmail_com","phoneNumber":"6414171599","librarian":0}' => NULL,
)
I have trouble trying to access these attributes. On the server side when I try.
public function createUser(Request $request)
{
$username = $request->get('username');
$password = $request->get('password');
$password2 = $request->get('password2');
$email = $request->get('emailAddress');
$phone = $request->get('phoneNumber');
$librarian = $request->get('librarian');
$req = $request->get('username');
Log::info($req);
}
It does not print anything?