Код: Выделить всё
public function productData(Request $request)
{
$product_no = $request->product_no;
$response = array();
if($request->product_no)
{
try
{
$header = $request->header();
$Authorization = $request->header('Authorization');
dd($Authorization);
if (empty($Authorization))
{
$data = "Authorization key invalid";
return $data;
}
else
{
$sp_token = str_replace("Bearer ", "", $Authorization);
$varify_token = 'ZQWmRjUyNDJDQUFGRjBBOUMzMUZGQUVEOTA4QkYzOEU2RENBNEQ4OTIwMzRGQzY1NDA0QzIyMjk3RkJENkRzdsg=====';
if($sp_token == $varify_token)
{
$response = array(
'status' => 200,
'message' => 'success',
);
}
else
{
$response = array(
'status' => 300,
'message' => 'Invalid Bearer Token',
);
}
}
}
catch (\Exception $e)
{
$response = array(
'status' => 500,
'message' => 'Data Not Found',
'msgErr' => 'Something went wrong',
'result' => '0');
}
}
else
{
$response = array(
'status' => 0,
'message' => 'product Number Empty',
);
}
return response()->json($response);
}
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/709 ... ng-laravel