My laravel application route configured on routes/api.php is.
<?php
use Illuminate\Http\Request;
Route::post('see_all_product', 'API\ProductController@see_all_product');
?>
Issue is i want to sent list of product but if user authenticated then send product favorite flag 1, and if not authenticated then sent return favorite 0
But both case send product list with favorite flag.
If i logged in with my user id and password and send request for see_all_product that time i m getting blank user.
$user = $request->user();
But if i set route like below i m getting user details.
<?php
use Illuminate\Http\Request;
Route::group(['middleware' => 'auth:api'], function(){
Route::post('see_all_product', 'API\ProductController@see_all_product');
});
?>
Now if authorization set then i want user details.
API is same for both authenticated and guest user.
Please guide me where i can miss something?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2XorPUd
via IFTTT
Aucun commentaire:
Enregistrer un commentaire