fjarfs / src-general
Function General SRC environment
Installs: 22 788
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7
Requires (Dev)
- laravel/laravel: ^5.6
- laravel/lumen: ^5.8
This package is auto-updated.
Last update: 2025-01-07 17:06:51 UTC
README
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);
- Otomatis terdaftar oleh
Function yang tersedia
- Helper
Cara Penggunaan
-
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); } }