PHP code example of support / remote-auth

1. Go to this page and download the library: Download support/remote-auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

support / remote-auth example snippets

config/app.php
config/app.php

php artisan vendor:publish
RemoteAuth.php

php artisan key:generate
php artisan config:cache


php artisan make:middleware RemoteAuth



namespace App\Http\Middleware;

use Closure;
use Remote;

class RemoteAuth
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        /*check token is received or not*/
        if(empty($request->header('Authorization'))){

            return response()->json(array('token is 

 public function get_detail(Request $request){
    
   //get user
   $user = $request->r_user;
   //token
   $token = $request->r_token;
   
   dd($user); //dump $user variable
 }
config\RemoteAuth.php
config\RemoteAuth.php

array:2 [
  "identifire" => 1
  "login_date" => Carbon @1524373176 {#186
    date: 2018-04-22 04:59:36.389266 UTC (+00:00)
  }
]
kernal.php
kernal.php

 protected $routeMiddleware = [
     ...
     ...
     ...
     remote_auth' =>  \App\Http\Middleware\RemoteAuth::class
  ];

Route::group(['middleware'=>'remote_auth'],function(){

        //route list 
});
config\RemoteAuth.php