✨ Ajoute les 2 controllers et l'authentification
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -30,9 +31,11 @@ class AuthServiceProvider extends ServiceProvider
|
||||
// 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) {
|
||||
if ($request->input('api_token')) {
|
||||
return User::where('api_token', $request->input('api_token'))->first();
|
||||
$this->app['auth']->viaRequest('api', function ( Request $request) {
|
||||
if ($request->input('token') && $request->input('email')) {
|
||||
return User::where('token', $request->input('token'))
|
||||
->where('email', $request->input('email'))
|
||||
->first();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user