for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the EOffice project.
*
* (c) Anthonius Munthi <https://itstoni.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace EOffice\Core\Providers;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* Register any application services.
* @return void
public function register()
}
* Boot the authentication services for the application.
public function boot()
// Here you may define how you wish users to be authenticated for your Lumen
// application. The callback which receives the incoming request instance
// should return either a User instance or null. You're free to obtain
// the User instance via an API token or any other method necessary.
$this->app['auth']->viaRequest('api', function (Request $request) {
if ($request->input('token')) {
return User::where('token', $request->input('api_token'))->first();
});