I am trying to create a Laravel API project. So I have this project with basic laravel's scaffolding set up. In my user migration I have added:
$table->string('api_token', 60)->unique();
then in my User.php model i have added:
protected $fillable = [
'name', 'email', 'password','api_token'
];
Then in my api.php i have made a test route:
Route::group(['middleware' => ['auth:api']], function(){
Route::get('/test', function (Request $request){
return response()->json(['name' => 'test']);
});
});
so now i type this : with my api_token
localhost/project1/public/api/test?api_token='hsvdvhvsjhvasdvas8871238'
PLease help! thanks in advance
via Mohamed Manas