<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/test', function (Request $request){
//var_dump($request->all());
var_dump($request->headers->get('Authorization'));
return response()->json(['msg' => 'Minha primeira resposta de API']);
});
Route::namespace('Api')->group(function (){
//PRODUCT ROUTE
Route::prefix('products')->group(function (){
Route::get('/', 'ProductController@index');
Route::get('/{id}', 'ProductController@show');
Route::post('/', 'ProductController@store');
Route::put('/{id}', 'ProductController@update');
Route::delete('/{id}', 'ProductController@destroy');
});
//USERS ROUTE
Route::resource('/user', 'UserController');
});