You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
723 B
35 lines
723 B
3 years ago
|
<?php
|
||
|
|
||
|
namespace App\Providers;
|
||
|
|
||
|
use App\Models\User;
|
||
|
use Illuminate\Support\Facades\Gate;
|
||
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
||
|
class AuthServiceProvider extends ServiceProvider
|
||
|
{
|
||
|
/**
|
||
|
* Register any application services.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function register()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Boot the authentication services for the application.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function boot()
|
||
|
{
|
||
|
|
||
|
$this->app['auth']->viaRequest('api', function ($request) {
|
||
|
if ($request->input('api_token')) {
|
||
|
return User::where('api_token', $request->input('api_token'))->first();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|