Link to the repository
[Only for premium members]
[Only for premium members]
Let's start implementing features into our Application:
By the end, we should have a working Login/Registration system.
First thing we need to do is add our API URL to our .env
file:
.env.
# ... API_URL=http://nativephp-events-app-api.test/api
Of course, we should never load the .env
file in our code, so let's set up a config file for this:
config/services.php
// ... 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), ], ], 'api' => [ 'url' => env('API_URL'), ], ];
Now, we will be able to get our API URL by calling:
config('services.api.url')
Now we have to think about our sessions. The typical auth
middleware won't work here, as we are authenticated via token. So let's create a new one:
php artisan make:middleware ApiTokenExists
And inside it, we'll add:
token
set in our session