I'm having an issue with Laravel 5, the Request variable doesn't seem to be keeping the input headers I'm sending with postman, the headers do work to some extent because it still logs in with the token and restrict access with not provided. Also $request->path() returns the correct path. Any ideas?
For authentication I'm using TyMon\JWTAuth.
routes/api.php
use Illuminate\Http\Request;
Route::post('login', 'Auth\LoginController@login');
Route::group([
'prefix' => 'restricted',
'middleware' => 'auth:api',
], function () {
// Authentication Routes...
Route::get('logout', 'Auth\LoginController@logout');
Route::get('/test', function () {
return 'authenticated';
});
});
Route::group([
'prefix' => 'data',
'middleware' => 'auth:api',
], function () {
// Authenticated Routes...
// Other routes
Route::get('/icons', ['uses' => 'Api\Data\IconController@apiGet']);
Route::get('/test', function () {
return 'authenticated';
});
});
IconController.php:
namespace App\Http\Controllers\Api\Data;
use App\Http\Controllers\Controller as BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
class IconController extends BaseController
{
public function __construct()
{
$this->middleware('auth:api');
}
public function apiGet(Request $request)
{
$return = [
'return' => true,
'errors' => []
];
$jsonIn = $request->json;
var_dump(Input::get('json'));
var_dump($request->path());
var_dump($request->input('json'));
var_dump($jsonIn);
die();
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kKxT9y
via IFTTT
Aucun commentaire:
Enregistrer un commentaire