Skip to content

fjarfs/src-general

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRC General

Total Downloads Latest Stable Version License

SRC General merupakan package yang digunakan oleh aplikasi SRC dan berisi tentang function-function yang bersifat general

Cara Install

  • composer require fjarfs/src-general

    Laravel
    • Otomatis terdaftar oleh Laravel Package Discovery
    Lumen
    • Daftarkan service provider di bootstrap/app.php
       $app->register(Fjarfs\SrcGeneral\SrcGeneralProvider::class);

Function yang tersedia

Cara Penggunaan

  • Access

    Access Module

      use Fjarfs\SrcGeneral\Helpers\Access as AccessModule;
     
     AccessModule::module('http://localhost/api/v1/user/principal/user', $auth);

    contoh:

    <?php
    
    namespace App\Http\Middleware;
    
    use Closure;
    use App\Libraries\Services\Core\Auth;
    use Fjarfs\SrcGeneral\Helpers\Access as AccessModule;
    
    class Access
    {
        /**
         * Handle an incoming request.
         *
         * @param  \Illuminate\Http\Request  $request
         * @param  \Closure  $next
         * @return mixed
         */
        public function handle($request, Closure $next)
        {
            $auth = Auth::info();
            if ($auth) {
                if (AccessModule::module($request->path(), $auth) == false) {
                    return response()->json(['message' => 'Tidak ada otorisasi'], 401);
                }
            }
            
            return $next($request);
        }
    }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages