PHP Classes

File: apps/MS-AvailableHotels/app/Providers/AuthServiceProvider.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Hotel Booking Available   apps/MS-AvailableHotels/app/Providers/AuthServiceProvider.php   Download  
File: apps/MS-AvailableHotels/app/Providers/AuthServiceProvider.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Hotel Booking Available
Search for hotels that are available for booking
Author: By
Last change:
Date: 2 years ago
Size: 1,023 bytes
 

Contents

Class file image Download
<?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()
    {
       
// 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) {
            if (
$request->input('api_token')) {
                return
User::where('api_token', $request->input('api_token'))->first();
            }
        });
    }
}