repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/server.php | server.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans.
*
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ('/' !== $uri && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/functions.php | app/functions.php | <?php
use Illuminate\Support\Facades\Redis;
if (!function_exists('get_tree')) {
/**
* @param $list
* @param string $pk
* @param string $pid
* @param string $child
* @param int $root
*
* @return array
*/
function get_tree($list, $pk = 'id', $pid = 'p_id', $child = 'children', $root = 0)
{
$tree = [];
foreach ($list as $key => $val) {
if ($val[$pid] === $root) {
// 获取当前$pid所有子类
unset($list[$key]);
if (!empty($list)) {
$child = get_tree($list, $pk, $pid, $child, $val[$pk]);
if (!empty($child)) {
$val['children'] = $child;
}
}
$tree[] = $val;
}
}
return $tree;
}
}
if (!function_exists('redis')) {
function redis()
{
return Redis::connection()->client();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Exceptions/Handler.php | app/Exceptions/Handler.php | <?php
namespace App\Exceptions;
use App\Enum\MessageCode;
use App\Traits\ResponseApi;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Throwable;
class Handler extends ExceptionHandler
{
use ResponseApi;
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @throws \Throwable
*/
public function report(Throwable $exception): void
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
*
* @throws \Throwable
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function render($request, Throwable $exception)
{
if ('api' === Str::lower($request->segment(1))) {
if ($exception instanceof ValidationException) {
return $this->fail($exception->validator->errors()->first());
}
if ($exception instanceof ModelNotFoundException) {
return $this->fail('一不小心数据走丢了~~~', MessageCode::DATA_ERROR, [], MessageCode::HTTP_OK);
}
if ($exception instanceof NotFoundHttpException) {
return $this->fail('路由未找到', MessageCode::ROUTE_EXITS, [], $exception->getStatusCode());
}
if ($exception instanceof MethodNotAllowedHttpException) {
return $this->fail('请求方法不存在', MessageCode::FUNCTION_EXITS, []);
}
if ($exception instanceof UnauthorizedHttpException) { // 这个在jwt.auth 中间件中抛出
return $this->fail('无效的访问令牌', MessageCode::PERMISSION_EXITS, null, MessageCode::HTTP_PERMISSION);
}
if ($exception instanceof AuthenticationException) { // 这个异常在 auth:api 中间件中抛出
return $this->fail('无效的访问令牌', MessageCode::PERMISSION_EXITS, null, MessageCode::HTTP_PERMISSION);
}
if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException
&& MessageCode::HTTP_REFUSED === $exception->getStatusCode()) {
return $this->fail('没有访问权限,请联系管理员', MessageCode::PERMISSION_EXITS, null, $exception->getStatusCode());
}
return $this->fail($exception->getMessage().' '.$exception->getFile().' '.$exception->getLine(), MessageCode::CODE_ERROR, null);
}
return parent::render($request, $exception);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Exceptions/ValidationException.php | app/Exceptions/ValidationException.php | <?php
namespace App\Exceptions;
class ValidationException extends \Illuminate\Foundation\Exceptions\Handler
{
/**
* 错误响应.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
protected function invalidJson($request, \Illuminate\Validation\ValidationException $exception)
{
return response()->json([
'message' => $exception->getMessage(),
'errors' => $exception->errors(),
], $exception->status);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Kernel.php | app/Http/Kernel.php | <?php
namespace App\Http;
use App\Http\Middleware\ApiLog;
use App\Http\Middleware\PermissionsAuth;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'log' => ApiLog::class,
'permission' => PermissionsAuth::class,
// 'refresh.token' => \App\Http\Middleware\RefreshToken::class
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/UserUpdateRequest.php | app/Http/Requests/UserUpdateRequest.php | <?php
namespace App\Http\Requests;
class UserUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|min:2|max:20',
'avatar' => 'required',
'password' => 'min:6|max:20',
'confirm_password' => 'min:6|max:20',
'new_password' => 'min:6|max:20|confirmed:confirm_password',
];
}
public function messages()
{
return [
'name.required' => '用户名不能为空',
'name.min' => '用户名长度不能小于6位',
'name.max' => '用户名长度不能大于20位',
'new_password.min' => '密码长度不能小于6位',
'new_password.max' => '密码长度不能大于20位',
'password.confirm_password' => '新密码与重复密码不一致',
'password.min' => '新密码长度不能小于6位',
'password.max' => '新密码长度不能大于20位',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/FormRequest.php | app/Http/Requests/FormRequest.php | <?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest as Request;
use Illuminate\Http\Exceptions\HttpResponseException;
use Symfony\Component\HttpFoundation\JsonResponse;
class FormRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
// 自定义TestRequest的错误响应格式
// TestRequest.php 修改继承方法
protected function failedValidation(Validator $validator): void
{
$message = $validator->getMessageBag()->first();
// $response = JsonResponse::create(['data' => [], 'code' => 400, 'message' => "warning | $message"],500);
$response = JsonResponse::fromJsonString(collect(['data' => [], 'code' => 400, 'message' => "{$message}"]), 200);
throw new HttpResponseException($response);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/RoleStoreRequest.php | app/Http/Requests/RoleStoreRequest.php | <?php
namespace App\Http\Requests;
class RoleStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|min:2|max:20',
'node' => 'required',
// 'status'=>'required|boolean',
'description' => 'required',
];
}
/**
* 错误信息.
*
* @return array|string[]
*/
public function messages()
{
return [
'name.required' => '角色名不能为空',
'name.min' => '角色名长度不能低于2位',
'name.max' => '角色名长度不能高于20位',
'permissions.required' => '权限不能为空',
// 'status.required'=>'状态不能为空',
// 'status.boolean'=>'状态应该是个boolean值',
'description.required' => '角色描述不能为空',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/UserStoreRequest.php | app/Http/Requests/UserStoreRequest.php | <?php
namespace App\Http\Requests;
class UserStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|min:5|max:20|unique:users,name',
'email' => 'required|email|unique:users,email',
// 'avatar'=>'required',
'password' => 'required|min:6|max:20|confirmed:password_confirmation',
'roles' => 'required',
// 'password_confirmation'=>'required|min:6|max:20'
];
}
public function messages()
{
return [
'name.required' => '用户名不能为空',
'name.min' => '用户名不能低于5位数',
'name.max' => '用户名不能大于20位数',
'name.unique' => '该用户名已存在',
'email.required' => '邮箱不能为空',
'roles.required' => '角色不能为空',
'email.email' => '不是一个正确的邮箱',
'email.unique' => '该邮箱已存在',
'avatar.required' => '头像不能为空',
'password.required' => '密码不能为空',
'password.min' => '密码不能低于6位数',
'password.max' => '密码不能大于20位数',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/LoginRequest.php | app/Http/Requests/LoginRequest.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2022/1/19
* Time : 4:48 PM.
*/
namespace App\Http\Requests;
class LoginRequest extends FormRequest
{
public function rules()
{
return
[
'key' => 'required',
'captcha' => 'required',
'email' => 'required|min:2|max:20',
'password' => 'required|min:6|max:20',
];
}
public function messages()
{
return [
'key.required' => '参数不合格',
'email.required' => '邮箱不能为空',
'email.email' => '不是一个正确的邮箱',
'password.required' => '密码不能为空',
'password.min' => '密码不能低于6位',
'password.max' => '密码不能高于20位',
'captcha.required' => '验证码不能为空',
'captcha.min' => '验证码不能为空',
'key.captcha' => '验证码不合格',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/TaskRequest.php | app/Http/Requests/TaskRequest.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/8/3
* Time : 6:03 下午.
*/
namespace App\Http\Requests;
use Illuminate\Validation\Rule;
class TaskRequest extends FormRequest
{
public function rules()
{
$rules = [
'task_type' => ['required', Rule::in([1, 2, 3])],
'task_name' => ['required', 'max:40'],
'textarea' => ['required', 'max:255'],
];
if (3 === $this->input('task_type')) {
$rules = array_merge($rules, ['email' => 'required|email']);
}
return $rules;
}
public function messages()
{
return [
'task_name.required' => '任务名称不能为空',
'task_name.max' => '任务名称不能超过40个字',
'textarea.required' => '脚本内容不能为空',
'textarea.max' => '脚本内容不能超过255个字符',
'email.required' => '邮箱不能为空',
'email.email' => '不是一个可用邮箱',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Requests/PermissionStoreRequest.php | app/Http/Requests/PermissionStoreRequest.php | <?php
namespace App\Http\Requests;
use Illuminate\Http\Request;
class PermissionStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(Request $request)
{
if (1 === $request->status) {
return [
'name' => 'required|min:2',
'icon' => 'required',
'path' => 'required',
'status' => 'required|boolean',
'method' => 'required',
'p_id' => 'required',
'hidden' => 'required',
];
}
return [
'name' => 'required|min:2',
'url' => 'required',
'method' => 'required',
'p_id' => 'required',
'hidden' => 'required',
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Controller.php | app/Http/Controllers/Controller.php | <?php
namespace App\Http\Controllers;
use App\Traits\ResponseApi;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ResponseApi;
use ValidatesRequests;
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/WeiBoController.php | app/Http/Controllers/Auth/WeiBoController.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/6/3
* Time : 5:56 下午.
*/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Services\RoleService;
use Illuminate\Support\Facades\Hash;
use Pl1998\ThirdpartyOauth\SocialiteAuth;
class WeiBoController extends Controller
{
public function weiboCallBack(RoleService $service)
{
$auth = new SocialiteAuth(config('oauth.weibo'));
$user = $auth->driver('weibo')->user();
$users = User::query()->where('oauth_id', $user->id)->first();
if (!$users) {
$users = User::query()->create([
'name' => $user->name,
'email' => '',
'password' => Hash::make(123456), // 默认给个密码呗
'avatar' => $user->avatar_large,
'oauth_id' => $user->id,
'bound_oauth' => 1,
]);
}
$service->setRoles([4], $users->id);
// 关于授权可以了解一下js的窗口通信 window.postMessage
return view('loading', [
'token' => auth('api')->login($users),
'domain' => env('APP_CALLBACK', 'https://pltrue.top/'),
'app_name' => '微博',
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/AuthController.php | app/Http/Controllers/Auth/AuthController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Enum\MessageCode;
use App\Http\Controllers\Controller;
use App\Http\Requests\LoginRequest;
use App\Http\Requests\UserUpdateRequest;
use App\Models\User;
use App\Services\PermissionService;
use App\Services\RoleService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class AuthController extends Controller
{
public function __construct()
{
$this->middleware('auth:api', ['except' => ['login', 'DingLogin']]);
}
public function login(LoginRequest $request)
{
if (!captcha_api_check(request('captcha'), $request->input('key'))) {
return $this->fail('验证码错误', MessageCode::USER_ERROR);
}
$credentials = $request->all(['email', 'password']);
if (!$token = auth('api')->attempt($credentials)) {
return $this->fail('账号或密码错误');
}
return $this->respondWithToken($token);
}
/**
* 获取用户信息.
*
* @return JsonResponse
*/
public function me(PermissionService $permissionService, RoleService $roleService)
{
$menu = $roleService->getRoles(auth('api')->id());
$permissionsMenus = [];
$nodes = [];
foreach ($menu as $value) {
[$permissionsMenu, $permissions] = $permissionService->getPermissionMenu($value->id);
$permissionsMenus[] = $permissionsMenu;
[$node_id, $node] = $permissionService->getPermissions($value->id);
$nodes = array_merge($nodes, $node);
}
$user = auth('api')->user();
$user->node = $nodes;
$user->menu = array_reduce($permissionsMenus, 'array_merge', []);
return $this->success($user);
}
public function logout()
{
auth('api')->logout();
return $this->success([], 'Successfully logged out');
}
public function refresh()
{
return $this->respondWithToken(auth('api')->refresh());
}
/**
* @param UserUpdateRequest $request
*
* @return JsonResponse
* 更新用户信息
*/
public function update(Request $request)
{
$request->validate([
'name' => ['min:2', 'max:20'],
'password' => ['min:6', 'max:20', 'confirmed'],
'old_password' => ['min:6', 'max:20'],
'password_confirmation' => ['min:6', 'max:20', 'same:password'],
], [
'name.confirmed' => '昵称应该在2-20个字符之间',
'name.password' => '新密码应该在6-20个字符之间',
'password.confirmed' => '确认密码不一致',
]);
if (!empty($request->old_password) && !empty($request->password)) {
$credentials = ['email' => auth('api')->user()->email, 'password' => $request->old_password];
if (!$token = auth('api')->attempt($credentials)) {
return $this->fail('旧密码错误');
}
$update['password'] = Hash::make($request->password);
}
$update['name'] = $request->name;
$update['avatar'] = $request->avatar;
if ('admin@gmail.com' !== (int) auth('api')->user()->email) {
User::query()->where('id', auth('api')->user()->id)
->update($update)
;
}
return $this->success([
'name' => $request->name,
'avatar' => $request->avatar,
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/DingController.php | app/Http/Controllers/Auth/DingController.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/6/3
* Time : 2:48 下午.
*/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\Ding;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use ThinkCar\DingTalk\Facades\DingAuth;
class DingController extends Controller
{
public function __construct()
{
$this->middleware('auth:api', ['except' => ['dingLogin', 'bindQrcode']]);
}
public function bindQrcode()
{
$redirect_uri = env('DING_REDIRECT_URL');
return view('code', compact('redirect_uri'));
}
/**
* 用户绑定钉钉.
*
* @return \Illuminate\Http\JsonResponse
*/
public function DingBing(Request $request)
{
if ($request->code) {
$res = $this->httpDing($request->code);
$data = $res->json();
if ($res->successful() && 0 === $data['errcode']) {
$user = $res['user_info'];
$d = Ding::where('unionid', $user['unionid'])->first();
if ($d) {
return $this->fail('钉钉账号 该账号已绑定');
}
$userid = DingAuth::getUseridByUnionid($user['unionid']);
$id = auth('api')->id();
$ding = Ding::create([
'openid' => $user['openid'],
'nick' => $user['nick'],
'ding_id' => $user['dingId'],
'user_id' => $id,
'unionid' => $user['unionid'],
'ding_user_id' => $userid,
]);
$ding_user = DingAuth::user($userid);
if (0 === $ding_user['errcode']) {
$user = $ding->User;
if (isset($ding_user['email']) && $email = $ding_user['email']) {
$user->email = $email;
}
if (isset($ding_user['mobile']) && $mobile = $ding_user['mobile']) {
$user->phone = $mobile;
}
if (isset($ding_user['avatar']) && $avatar = $ding_user['avatar']) {
if (!$user->avatar) {
$user->avatar = $avatar;
}
}
$user->save();
}
return $this->success([], '钉钉账号 绑定成功');
}
return $this->fail('钉钉账号 绑定失败');
}
return $this->fail('相关凭证错误');
}
/**
* 钉钉授权登录.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Http\JsonResponse|void
*/
public function DingLogin(Request $request)
{
if ($request->code) {
$res = $this->httpDing($request->code);
$data = $res->json();
if ($res->successful() && 0 === $data['errcode']) {
$user = $res['user_info'];
$ding = Ding::where('unionid', $user['unionid'])->first();
if ($ding && $ding->User) {
$token = auth('api')->login($ding->User);
return view('loading', [
'token' => $token,
'domain' => env('APP_CALLBACK', 'https://pltrue.top/'),
'app_name' => '钉钉',
]);
}
}
return $this->fail('用户不存在', 403, [
'redirect_url' => 'login',
]);
}
}
/**
* 请求钉钉api.
*
* @param $code
*
* @return \Illuminate\Http\Client\Response
*/
protected function httpDing($code)
{
$time = (int) now()->getPreciseTimestamp(3);
$gateway = 'https://oapi.dingtalk.com/sns/getuserinfo_bycode';
$sign = hash_hmac('sha256', $time, env('DT_AUTH_SECRET'), true);
$signature = base64_encode($sign);
$urlencode_signature = urlencode($signature);
$key = env('DT_AUTH_APPID');
$url = "{$gateway}?accessKey={$key}×tamp={$time}&signature={$urlencode_signature}";
return Http::post($url, [
'tmp_auth_code' => $code,
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/SystemController.php | app/Http/Controllers/Auth/SystemController.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/5/31
* Time : 3:52 下午.
*/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
class SystemController extends Controller
{
public function info()
{
$server_config = [
['name' => '服务器IP地址', 'value' => $_SERVER['SERVER_ADDR']],
['name' => '服务器域名', 'value' => $_SERVER['SERVER_NAME']],
['name' => '服务器端口', 'value' => $_SERVER['SERVER_PORT']],
['name' => '服务器版本', 'value' => php_uname('s').php_uname('r')],
['name' => '服务器操作系统', 'value' => php_uname()],
['name' => 'PHP版本', 'value' => PHP_VERSION],
['name' => '获取PHP安装路径', 'value' => DEFAULT_INCLUDE_PATH],
['name' => 'Zend版本', 'value' => zend_version()],
['name' => 'Laravel版本', 'value' => $laravel = app()::VERSION],
['name' => 'PHP运行方式', 'value' => PHP_SAPI],
['name' => '服务器当前时间', 'value' => date('Y-m-d H:i:s')],
['name' => '最大上传限制', 'value' => get_cfg_var('upload_max_filesize') ? get_cfg_var('upload_max_filesize') : '不允许'],
['name' => '最大执行时间', 'value' => get_cfg_var('max_execution_time').'秒 '],
['name' => '脚本运行占用最大内存', 'value' => get_cfg_var('memory_limit') ? get_cfg_var('memory_limit') : '无'],
['name' => '服务器解译引擎', 'value' => $_SERVER['SERVER_SOFTWARE']],
['name' => '请求页面时通信协议的名称和版本', 'value' => $_SERVER['SERVER_PROTOCOL']],
];
return $this->success($server_config);
}
/**
* 系统终端认证接口 该接口由node服务调用 验证成功创建ws链接终端.
*
* @return \Illuminate\Http\JsonResponse
*/
public function terminal()
{
return $this->success();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/CaptchaController.php | app/Http/Controllers/Auth/CaptchaController.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/5/27
* Time : 3:52 下午.
*/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
class CaptchaController extends Controller
{
public function captcha()
{
return $this->success(['captcha' => app('captcha')->create('default', true)]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/RolesController.php | app/Http/Controllers/Auth/RolesController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\RoleStoreRequest;
use App\Models\Roles;
use App\Services\PermissionService;
use Illuminate\Http\Request;
class RolesController extends Controller
{
/**
* 获取角色列表.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request, PermissionService $service)
{
$page = $request->get('page', 1);
$pageSize = $request->get('pageSize', 10);
$query = Roles::query();
if ($keyword = request('keyword')) {
$query = $query->where('name', 'like', "%{$keyword}%");
}
$total = $query->count();
$list = $query->forPage($page, $pageSize)->get();
foreach ($list as &$value) {
$value->node = $service->getRolePermissions([$value->id]);
}
return $this->success([
'list' => $list,
'total' => $total,
]);
}
/**
* 添加角色.
*
* @return \Illuminate\Http\JsonResponse
*/
public function store(RoleStoreRequest $request, PermissionService $service)
{
$name = $request->get('name');
$status = $request->get('status');
$description = $request->get('description');
$node = $request->get('node', []);
$created_at = now()->toDateTimeString();
$updated_at = now()->toDateTimeString();
if (Roles::query()->where(compact('name', 'status'))->exists()) {
return $this->fail('角色已存在');
}
$id = Roles::query()->insertGetId(compact('name', 'status', 'description', 'created_at', 'updated_at'));
abort_if(!$id, 500, '添加角色错误');
!empty($node) && $service->setPermissions($node, $id);
return $this->success([], '角色添加成功');
}
public function update($id, Request $request, PermissionService $service)
{
$name = $request->get('name');
$status = $request->get('status');
$description = $request->get('description');
$node = $request->get('node', []);
$updated_at = now()->toDateTimeString();
if (Roles::query()->where(compact('id'))->doesntExist()) {
return $this->fail('角色不存在');
}
Roles::query()->where(compact('id'))->update(compact('name', 'description', 'updated_at', 'status'));
if (!empty($node)) {
$service->setPermissions($node, $id);
}
return $this->success([], '更新成功');
}
/**
* 删除角色.
*
* @param $id
*
* @return \Illuminate\Http\JsonResponse
*/
public function destroy($id, PermissionService $service)
{
Roles::destroy($id);
$service->delPermissions($id);
return $this->success();
}
/**
* 获取所有的角色.
*
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function allRule()
{
$list = Roles::query()->where('status', 1)->get(['id', 'name']);
return $this->success($list);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/LogController.php | app/Http/Controllers/Auth/LogController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\Log;
use Illuminate\Http\Request;
class LogController extends Controller
{
/**
* 获取日志列表.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request)
{
$page = $request->get('page', 1);
$limit = $request->get('limit', 10);
$direction = $request->get('direction') === 'asc' ? 'asc': 'desc';
$query = Log::query();
$total = $query->count();
$list = $query->forPage($page, $limit)
->orderBy('id', $direction)
->get(['url', 'ip', 'method', 'name', 'u_id', 'created_at', 'address', 'id']);
return $this->success(
[
'list' => $list,
'mate' => [
'total' => $total,
'pageSize' => $limit,
],
]
);
}
public function destroy(Request $request)
{
$request->validate([
'id' => 'required',
]);
Log::query()->whereIn('id', explode(',', $request->id))->delete();
return $this->success($request->id);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/UsersController.php | app/Http/Controllers/Auth/UsersController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\UserStoreRequest;
use App\Http\Requests\UserUpdateRequest;
use App\Models\User;
use App\Services\RoleService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class UsersController extends Controller
{
/**
* 获取用户列表.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request, RoleService $service)
{
$page = $request->get('page', 1);
$pageSize = $request->get('limit', 10);
$email = $request->get('email');
$name = $request->get('name');
$query = User::query();
if ($email) {
$query->where('email', $email);
}
if ($name) {
$query->where('name', 'like', "%{$name}%");
}
$total = $query->count();
$list = $query->forPage($page, $pageSize)->get();
foreach ($list as &$value) {
$value->roles_node = $service->getRoles($value->id);
}
return $this->success([
'list' => $list,
'mate' => [
'total' => $total,
'pageSize' => $pageSize,
],
]);
}
/**
* 新增用户.
*
* @return \Illuminate\Http\JsonResponse
*/
public function store(UserStoreRequest $request, RoleService $service)
{
$avatar = $request->post('avatar');
$email = $request->post('email');
$name = $request->post('name');
$roles = array_column($request->post('roles'),'id');
$password = Hash::make($request->post('password'));
$created_at = now()->toDateTimeString();
$id = User::query()->insertGetId(compact('avatar', 'email', 'name', 'password', 'created_at'));
abort_if(!$id, 500, '添加用户错误');
$service->setRoles($roles, $id);
return $this->success();
}
/**
* 更新用户信息.
*
* @param $id
*
* @return \Illuminate\Http\JsonResponse
*/
public function update($id, UserUpdateRequest $request, RoleService $service)
{
$email = $request->post('email');
$name = $request->post('name');
$roles = $request->post('roles');
$password = $request->post('password');
$user = User::query()->where(compact('id'))->first();
$user->email = $email;
$user->name = $name;
!empty($password) && $user->password = Hash::make($password);
$user->save();
if (!empty($roles)) {
$roles = array_column($roles, 'id');
$service->setRoles($roles, $id);
}
return $this->success([], '更新成功');
}
public function updateImg(Request $request)
{
$request->validate([
'file' => ['required', 'image'],
]);
$path = $request->file('file')->store('public');
return $this->success([
'url' => env('APP_URL').'/storage/'.explode('/', $path)[1],
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Auth/PermissionsController.php | app/Http/Controllers/Auth/PermissionsController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\PermissionStoreRequest;
use App\Models\CasbinRules;
use App\Models\Permissions;
use App\Services\PermissionService;
use Illuminate\Http\Request;
class PermissionsController extends Controller
{
/**
* 获取权限列表.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request, PermissionService $service)
{
$keyword = $request->get('keyword');
$allPermission = $service->getAllPermission($keyword);
$list = $service->permissionTreeNode($allPermission);
return $this->success([
'list' => $list,
]);
}
/**
* 获取所有权限节点.
*
* @return \Illuminate\Http\JsonResponse
*/
public function allPermissions(Request $request, PermissionService $service)
{
$keyword = $request->get('keyword');
$allPermission = $service->getAllPermission($keyword);
$list = $service->permissionTreeNode($allPermission);
return response()->json([
'code' => 200,
'message' => 'success',
'data' => [
'list' => $list,
],
]);
}
/**
* 添加权限.
*
* @return \Illuminate\Http\JsonResponse
*/
public function store(PermissionStoreRequest $request)
{
$hidden = $request->post('hidden', 1);
$icon = $request->post('icon');
$method = $request->post('method', '*');
$name = $request->post('name');
$p_id = $request->post('p_id');
$path = $request->post('path');
$is_menu = $request->post('is_menu');
$url = $request->post('url');
$title = $request->post('name');
if ($path && Permissions::query()
->where(compact('path', 'method', 'p_id', 'is_menu'))
->exists()) {
return $this->fail('权限不存在');
}
Permissions::query()->insert(compact('hidden', 'icon', 'method', 'name', 'path', 'p_id', 'is_menu', 'method', 'url', 'title'));
return $this->success();
}
/**
* 更新权限.
*
* @param $id
*
* @return \Illuminate\Http\JsonResponse
*/
public function update($id, Request $request)
{
$hidden = $request->post('hidden', 1);
$icon = $request->post('icon');
$method = $request->post('method', '*');
$name = $request->post('name');
$p_id = $request->post('p_id');
$path = $request->post('path');
$is_menu = $request->post('is_menu');
$title = $request->post('name');
$url = $request->post('url');
if ($path && Permissions::query()->where(compact('id'))->doesntExist()) {
return $this->fail('权限不存在');
}
// 更新权限
CasbinRules::query()->where('p_type', 'p')
->where('v1', $url)
->update([
'v2' => $method,
])
;
Permissions::query()->where('id', $id)
->update(compact('hidden', 'icon', 'method', 'name', 'path', 'p_id', 'is_menu', 'method', 'title', 'url'))
;
return $this->success();
}
/**
* 删除权限.
*
* @param $id
*
* @return \Illuminate\Http\JsonResponse
*/
public function destroy($id)
{
Permissions::destroy($id);
return $this->success();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Controllers/Service/TaskController.php | app/Http/Controllers/Service/TaskController.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/8/3
* Time : 5:04 下午.
*/
namespace App\Http\Controllers\Service;
use App\Http\Controllers\Controller;
use App\Http\Requests\TaskRequest;
use App\Models\Task;
use App\Services\TaskService;
use Illuminate\Http\Request;
class TaskController extends Controller
{
public function index(Request $request)
{
$page = $request->input('page', 1);
$pageSize = $request->input('limit', 10);
$query = Task::query();
$total = Task::query()->count();
$list = $query->forPage($page, $pageSize)->get();
return $this->success(
[
'list' => $list,
'mate' => [
'total' => $total,
'pageSize' => $pageSize,
], ]
);
}
public function store(TaskRequest $request, TaskService $service)
{
$resp = Task::query()->create([
'task_name' => $request->input('task_name'),
'status' => 1,
'op_name' => auth('api')->user()->name,
'type' => $request->input('task_type'),
'cycle' => '*/1 * * * *',
'email' => $request->input('email'),
'textarea' => $request->input('textarea'),
]);
// $service->add($resp->id,'*/1 * * * *',$request->input('textarea'));
return $this->success([$resp->id]);
}
public function update($id, Request $request)
{
$request->validate([
'id' => 'required',
'status' => 'required',
]);
$task = Task::query()->find($id);
$task->status = $request->input('status');
$resp = $task->save();
return $this->success([$resp]);
}
public function destroy($id)
{
Task::destroy($id);
return $this->success();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/PermissionsAuth.php | app/Http/Middleware/PermissionsAuth.php | <?php
namespace App\Http\Middleware;
use App\Services\AuthService;
use Closure;
class PermissionsAuth
{
/**
* 权限控制中间件
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$id = auth('api')->id();
$authService = new AuthService();
$bool = $authService->checkPermission($id, $request->method(), $request->route()->uri());
abort_if(!$bool, 403, '没有访问权限');
return $next($request);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/Authenticate.php | app/Http/Middleware/Authenticate.php | <?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
*
* @return null|string
*/
protected function redirectTo($request)
{
if (!$request->expectsJson()) {
}
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/RedirectIfAuthenticated.php | app/Http/Middleware/RedirectIfAuthenticated.php | <?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param null|string $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/TrustProxies.php | app/Http/Middleware/TrustProxies.php | <?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var null|array|string
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/TrimStrings.php | app/Http/Middleware/TrimStrings.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/TrustHosts.php | app/Http/Middleware/TrustHosts.php | <?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/ApiLog.php | app/Http/Middleware/ApiLog.php | <?php
namespace App\Http\Middleware;
use App\Models\Log;
use Closure;
class ApiLog
{
// 过滤路由
protected static $url = [
'api/admin/log',
'api/admin/log/{id}',
];
// 记录访问的方法
protected static $method = ['DELETE', 'POST', 'PUT', 'PUTCH', 'GET'];
/**
* 日志访问中间件
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function handle($request, Closure $next)
{
// 是否开启日志记录
if (false === env('OPERATION_LOG')) {
return $next($request);
}
// 功能过滤
if (!\in_array($request->route()->uri(), static::$url, true) && \in_array($request->method(), static::$method, true)) {
Log::query()->create([
'url' => $request->route()->uri(),
'method' => $request->method(),
'ip' => $request->getClientIp(),
'u_id' => auth('api')->id(),
'address' => '',
'name' => auth('api')->user()->name,
]);
}
return $next($request);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/CheckForMaintenanceMode.php | app/Http/Middleware/CheckForMaintenanceMode.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/EncryptCookies.php | app/Http/Middleware/EncryptCookies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Http/Middleware/VerifyCsrfToken.php | app/Http/Middleware/VerifyCsrfToken.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Traits/ResponseApi.php | app/Traits/ResponseApi.php | <?php
namespace App\Traits;
use App\Enum\MessageCode;
use Illuminate\Http\JsonResponse;
trait ResponseApi
{
/**
* @param null|array $data
* @param $httpCode
* @param mixed $msgCode
*
* @return \Illuminate\Http\JsonResponse
*/
public function success($data = [], string $message = 'success', $msgCode = MessageCode::HTTP_OK, int $httpCode = MessageCode::HTTP_OK)
{
return response()->json([
'code' => $msgCode,
'message' => $message,
'data' => $data,
], $httpCode);
}
public function fail($message = 'error', $msgCode = MessageCode::HTTP_ERROR, $data = [], $httpCode = MessageCode::HTTP_OK)
{
return response()->json([
'code' => $msgCode,
'message' => $message,
'data' => $data,
], $httpCode);
}
/**
* @param $token
*
* @return JsonResponse
*/
public function respondWithToken($token)
{
return response()->json([
'code' => MessageCode::HTTP_OK,
'access_token' => $token,
'token_type' => 'bearer',
'expires_in' => auth('api')->factory()->getTTL() * 60,
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Enum/MessageCode.php | app/Enum/MessageCode.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2022/8/4
* Time : 22:54.
*/
namespace App\Enum;
class MessageCode
{
public const HTTP_OK = 200; // 正常响应
public const HTTP_ERROR = 500; // 服务端异常
public const HTTP_PERMISSION = 401; // 无效的访问令牌
public const HTTP_REFUSED = 403; // 拒绝访问
public const CODE_ERROR = 10001; // 代码异常
public const DATA_ERROR = 10003; // 数据异常
public const FUNCTION_EXITS = 10005; // 方法不存在
public const ROUTE_EXITS = 10004; // 路由404
public const TOKEN_EXITS = 10006; // TOKEN不存在
public const PERMISSION_EXITS = 10007; // 无权限访问
public const USER_ERROR = 40001;
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Listeners/QuerySqlListener.php | app/Listeners/QuerySqlListener.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2022/1/19
* Time : 4:46 PM.
*/
namespace App\Listeners;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Support\Facades\Log;
class QuerySqlListener
{
/**
* Create the event listener.
*/
public function __construct()
{
}
/**
* Handle the event.
*/
public function handle(QueryExecuted $event): void
{
if (env('APP_DEBUG')) {
$sql = str_replace('?', '%s', $event->sql);
$log = vsprintf($sql, $event->bindings);
Log::channel('sql')->info($log);
}
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Services/AuthService.php | app/Services/AuthService.php | <?php
namespace App\Services;
use App\Models\Permissions;
use Illuminate\Support\Facades\Log;
class AuthService
{
public $permissionService;
public $roleService;
public function __construct()
{
$this->permissionService = new PermissionService();
$this->roleService = new RoleService();
}
public function getRoles($id)
{
return $this->roleService->getRoles($id);
}
public function checkPermission($id, $method, $route): bool
{
$roles = $this->roleService->getUserRoles();
if($roles->isEmpty()) return false;
$nodeMaps = $this->permissionService->getRolePermissions($roles);
if($nodeMaps->isEmpty()) return false;
$where['url'] = $route;
return
Permissions::query()->whereIn('id', $nodeMaps)
->where('is_menu', Permissions::IS_MENU_NO)->where($where)
->where(function ($query) use ($method): void {
$query->where('method', $method)->orWhere('method', '*');
})
->exists()
;
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Services/TaskService.php | app/Services/TaskService.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/8/7
* Time : 2:15 下午.
*/
namespace App\Services;
use Illuminate\Support\Facades\Http;
class TaskService
{
public function add($id, $cycle, $textarea)
{
$url = env('CRON_HOST').'/api/addJob';
$resp = Http::post($url, [
'id' => $id,
'cycle' => $cycle,
'textarea' => $textarea,
]);
if ($resp->ok()) {
return true;
}
return false;
}
public function delete($id)
{
$url = env('CRON_HOST').'/api/addJob';
$resp = Http::delete($url, [
'id' => $id, ]);
if ($resp->ok()) {
return true;
}
return false;
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Services/RoleService.php | app/Services/RoleService.php | <?php
namespace App\Services;
use App\Models\CasbinRules;
use App\Models\Roles;
use Lauthz\Facades\Enforcer;
class RoleService
{
/**
* @param $id
*
* @return string
*/
public function getIdentifier($id)
{
return 'roles_'.$id;
}
/**
* 设置用户角色.
*
* @param $roleId
* @param $id
*/
public function setRoles($roleId, $id): void
{
$id = $this->getIdentifier($id);
Enforcer::deleteRolesForUser($id);
Roles::query()
->where('status', Roles::STATUS_OK)
->whereIn('id', $roleId)
->get(['id', 'name'])->map(function ($value) use ($id): void {
Enforcer::addRoleForUser($id, $value->id, $value->name);
});
}
/**
* 获取用户角色.
*
* @param $id
*
* @return mixed
*/
public function getRoles($id)
{
$id = $this->getIdentifier($id);
$roles = Enforcer::getRolesForUser($id);
if (empty($roles)) {
return [];
}
return Roles::query()->where('status', 1)
->whereIn('id', $roles)
->get(['id', 'name'])
;
}
/**
* 获取用角色
* @return \Illuminate\Support\Collection
*/
public function getUserRoles()
{
$nodes = CasbinRules::query()
->where('v0',$this->getIdentifier(auth('api')->id()))
->where('p_type','g')
->pluck('v1');
return $nodes;
}
/**
* 删除用户所有角色.
*
* @param $id
*/
public function delRoles($id): void
{
$id = $this->getIdentifier($id);
Enforcer::deleteRolesForUser($id);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Services/PermissionService.php | app/Services/PermissionService.php | <?php
namespace App\Services;
use App\Models\CasbinRules;
use App\Models\Permissions;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Lauthz\Facades\Enforcer;
class PermissionService
{
protected $allPermissions =[];
public function __construct()
{
if(empty($allPermissions)) {
$this->allPermissions = Permissions::query()->pluck('is_menu','id')->toArray();
}
}
public function permissionTreeNode($permission): array
{
$permissions = get_tree($permission);
foreach ($permissions as &$permission) {
if (0 === $permission['p_id']) {
$permission['root'] = true;
} else {
$permission['root'] = false;
}
}
return $permissions;
}
public function getPermissionMenu($id): array
{
[$node, $permissions] = $this->getPermissions($id);
Log::info('test',$node);
if ('demo' === auth('api')->user()->name) {
$query = Permissions::with('getPid')
->where('status', Permissions::STATUS_OK)
->where('is_menu', Permissions::IS_MENU_YES)
;
$permissions = $query->where(function ($query) use ($permissions): void {
foreach ($permissions as $value) {
$query->whereOr('id', $value[2]);
}
})->get(['id', 'p_id', 'path', 'name', 'title', 'icon', 'method', 'url'])->toArray();
$permissionsMenu = get_tree($permissions);
return [$permissionsMenu, $permissions];
}
if (!empty($permissions)) {
$query = Permissions::query()
->where('status', Permissions::STATUS_OK)
->where('is_menu', Permissions::IS_MENU_YES)
;
$permissionsMap = [];
$query->whereIn('id', $node)
->get(['id', 'p_id', 'path', 'name', 'title', 'icon', 'method', 'url'])
->map(function ($val) use (&$permissionsMap): void {
$getPid = $val->get_pid;
$val->get_pid = null;
$permissionsMap[$val->id] = $val->toArray();
if ($getPid) {
$permissionsMap[$getPid->id] = $getPid;
}
})->toArray();
$permissionsMenu = get_tree($permissionsMap);
return [$permissionsMenu, $permissionsMap];
}
return [[], []];
}
/**
* 获取节点数据.
*
* @param $permissions
*
* @return array
*/
public function getNodeId($permissions)
{
$node = array_column($permissions, '0');
$nodeId = [];
foreach ($node as $value) {
$nodeId[] = $this->setIdentifier($value);
}
return $nodeId;
}
/**
* 设置用户权限.
*
* @param $nodeId
* @param $id
*/
public function setPermissions($nodeId, $id): void
{
$id = $this->getIdentifier($id);
$permissions = Permissions::query()->with('getPid')
->whereIn('id', $nodeId)
->groupBy('id')
->get(['path', 'method', 'p_id', 'id', 'name', 'is_menu', 'url']);
Enforcer::deletePermissionsForUser($id);
$permissions->map(function ($value) use ($id): void {
$path = Permissions::IS_MENU_NO === $value->is_menu ? $value->url : $value->path;
Enforcer::addPermissionForUser($id, $path ?? '', $value['method'], $value['id']);
});
}
/**
* 根据角色id获取权限.
*
* @param $id
*/
public function getPermissions($id): array
{
$id = $this->getIdentifier($id);
$permissions = Enforcer::getPermissionsForUser($id);
if (empty($permissions)) {
return [[], []];
}
return [array_column($permissions,3), $permissions];
}
/**
* 根据角色获取权限
* @param $roleIds
* @return \Illuminate\Support\Collection
*/
public function getRolePermissions( $roleIds)
{
$permissions=[];
foreach ($roleIds as $roleId) {
$permissions[]=$this->getIdentifier($roleId);
}
$nodes = CasbinRules::query()->whereIn('v0',$permissions)
->where('p_type','p')
->pluck('v3');
return $nodes;
}
/**
* 获取角色的菜单和权限
* @param $roleId
* @return array[]
*/
public function getRolePermissionAndMenu( $roleId)
{
$nodes = $this->getRolePermissions([$roleId]);
$permissions=[];
$menus=[];
foreach ($nodes as $node) {
if(!isset($this->allPermissions[$node])) continue;
if($this->allPermissions[$node] == Permissions::IS_MENU_NO) {
$permissions[]=$node;
}else{
$menus[]=$node;
}
}
return [$menus,$permissions];
}
// 获取所有权限
public function getAllPermission($keyword = null)
{
return Permissions::query()
->where('status', Permissions::STATUS_OK)
->get(['id', 'name', 'icon', 'path', 'url', 'method', 'p_id', 'hidden', 'is_menu', 'title', 'status'])
->toArray()
;
}
/**
* 删除所属角色的权限.
*
* @param $id
*/
public function delPermissions($id): void
{
$id = $this->getIdentifier($id);
Enforcer::deletePermissionsForUser($id);
}
protected function getIdentifier($id)
{
return 'permission_'.$id;
}
protected function setIdentifier($id)
{
return explode('_', $id)[1];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Console/Kernel.php | app/Console/Kernel.php | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
];
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Console/Commands/AdminInstall.php | app/Console/Commands/AdminInstall.php | <?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class AdminInstall extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'admin:install';
/**
* The console command description.
*
* @var string
*/
protected $description = '初始化部署命令';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->call('key:gen');
$this->call('migrate');
$this->call('db:seed');
$this->call('create:roles:to:users');
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Console/Commands/AdminCreateUser.php | app/Console/Commands/AdminCreateUser.php | <?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class AdminCreateUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update:password';
/**
* The console command description.
*
* @var string
*/
protected $description = '重置admin用户密码';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$users = User::query()->where('name', 'admin')->first();
if ($users) {
$users->password = Hash::make('123456');
$users->save();
$this->info('Success 密码重置成功!');
} else {
$email = 'pltruenine@163.com';
$password = '123456';
User::query()->create([
'name' => 'admin',
'email' => $email,
'password' => Hash::make($password),
'email_verified_at' => now()->toDateTimeString(),
]);
$this->info("用户创建成功 ! 账号:{$email} 密码:{$password} !");
}
$result = User::query()->where('name', 'admin')
->update([
'password' => Hash::make(123456),
])
;
if ($result) {
} else {
$this->error('Error 用户不存在');
}
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Console/Commands/AdminCreateRoles.php | app/Console/Commands/AdminCreateRoles.php | <?php
namespace App\Console\Commands;
use App\Models\Permissions;
use App\Models\Roles;
use App\Models\User;
use App\Services\PermissionService;
use App\Services\RoleService;
use Illuminate\Console\Command;
class AdminCreateRoles extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'create:roles:to:users';
/**
* The console command description.
*
* @var string
*/
protected $description = '创建角色';
protected $permissionService;
protected $roleService;
protected const ADMIN_NAME='admin';
protected const DEMO_NAME='demo';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle(PermissionService $permissionService, RoleService $roleService)
{
$this->permissionService = $permissionService;
$this->roleService = $roleService;
$node = Permissions::query()
->where('status', Permissions::STATUS_OK)
->pluck('id')->toArray();
$this->createAdmin(self::ADMIN_NAME, $node);
$node = Permissions::query()
->where('status',Permissions::STATUS_OK)
->where('is_menu', Permissions::IS_MENU_YES)
->orWhere(function ($query){
$query
->where('is_menu', Permissions::IS_MENU_NO)
->where('method',Permissions::HTTP_REQUEST_GET);
})
->pluck('id')->toArray();
$this->createAdmin(self::DEMO_NAME, $node);
}
public function createAdmin($name, $node): void
{
$roles = Roles::query()->where('name', $name)->first();
$description = 'admin' === $name ? '超级管理员!' : 'demo角色';
if (!$roles) {
$roleId = Roles::query()->insertGetId([
'name' => $name,
'description' => $description,
'status' => Roles::STATUS_OK,
'created_at' => now()->toDateTimeString(),
'updated_at' => now()->toDateTimeString(),
]);
} else {
$roleId = $roles->id;
}
if (!empty($node)) {
// 添加角色
$this->permissionService->setPermissions($node, $roleId);
}
$userId = User::query()->where('name', $name)->value('id');
$this->roleService->setRoles([$roleId], $userId);
$this->info("给{$description}用户赋予角色: {$name}");
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Permissions.php | app/Models/Permissions.php | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Permissions extends Model
{
use SoftDeletes;
public const IS_MENU_YES = 1;
public const IS_MENU_NO = 0;
public const STATUS_DOWN = 0;
public const STATUS_OK = 1;
public const HIDDEN_YES = 1;
public const HIDDEN_NO = 0;
public const HTTP_REQUEST_ALL = '*';
public const HTTP_REQUEST_GET = 'GET';
public const HTTP_REQUEST_POST = 'POST';
public const HTTP_REQUEST_PUT = 'PUT';
public const HTTP_REQUEST_PATCH = 'PATCH';
public const HTTP_REQUEST_DELETE = 'DELETE';
protected $table = 'admin_permissions';
public function getIsMenuAttribute($key)
{
if (1 === $key) {
return true;
}
return false;
}
public function getPid()
{
return $this->hasOne(self::class, 'id', 'p_id')
->select(['id', 'p_id', 'path', 'name', 'title', 'icon', 'method', 'url'])
;
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/CasbinRules.php | app/Models/CasbinRules.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/6/22
* Time : 6:23 下午.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CasbinRules extends Model
{
public $table = 'casbin_rules';
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/User.php | app/Models/User.php | <?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Lauthz\Facades\Enforcer;
use Tymon\JWTAuth\Contracts\JWTSubject;
class User extends Authenticatable implements JWTSubject
{
use Notifiable;
public $appends = [
'roles',
'introduction',
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'avatar', 'email', 'password', 'created_at', 'ding_id', 'oauth_id', 'oauth_type',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
/**
* 获取会储存到 jwt 声明中的标识.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* 返回包含要添加到 jwt 声明中的自定义键值对数组.
*
* @return array
*/
public function getJWTCustomClaims()
{
return ['role' => 'user'];
}
/**
* @param $key
*
* @return string
*/
public function getAvatarAttribute($key)
{
if (empty($key)) {
$key = env('APP_URL').'/storage/default-avatar.jpg';
}
return $key;
}
/**
* 赋予用户角色.
*
* @param $key
*
* @return string
*/
public function getRolesAttribute($key)
{
$roles = Enforcer::getRolesForUser($this->id);
if (!empty($roles)) {
return explode(',', $roles);
}
if (empty($key) && 'admin' === $this->name || $this->name = 'test1') {
$key = 'admin';
}
if (empty($key)) {
$key = 'users';
}
return $key;
}
public function getIntroductionAttribute($key)
{
return $key;
}
public function getUseridByUnionid(): void
{
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Admin.php | app/Models/Admin.php | <?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Tymon\JWTAuth\Contracts\JWTSubject;
class Admin extends Authenticatable implements JWTSubject
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
/**
* 获取会储存到 jwt 声明中的标识.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* 返回包含要添加到 jwt 声明中的自定义键值对数组.
*
* @return array
*/
public function getJWTCustomClaims()
{
return ['role' => 'admin'];
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Log.php | app/Models/Log.php | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Log extends Model
{
use SoftDeletes;
public $table = 'admin_logs';
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
];
protected $fillable = [
'url', 'ip', 'method', 'name', 'u_id',
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/BaseModel.php | app/Models/BaseModel.php | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Roles.php | app/Models/Roles.php | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Roles extends Model
{
use SoftDeletes;
public const STATUS_DOWN = 0;
public const STATUS_OK = 1;
protected $table = 'admin_roles';
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Ding.php | app/Models/Ding.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/6/3
* Time : 2:25 下午.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Ding extends Model
{
public $table = 'dings';
public function User()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Models/Task.php | app/Models/Task.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/8/3
* Time : 5:02 下午.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Task extends Model
{
protected $connection = 'sqlite';
// use SoftDeletes;
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
];
protected $fillable = ['task_name', 'status', 'op_name', 'type', 'email', 'textarea', 'cycle'];
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Providers/BroadcastServiceProvider.php | app/Providers/BroadcastServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Providers/RouteServiceProvider.php | app/Providers/RouteServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* @var string
*/
public const HOME = '/home';
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'))
;
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'))
;
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Providers/EventServiceProvider.php | app/Providers/EventServiceProvider.php | <?php
namespace App\Providers;
use App\Listeners\QuerySqlListener;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
QueryExecuted::class => [
QuerySqlListener::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
parent::boot();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Providers/AppServiceProvider.php | app/Providers/AppServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/app/Providers/AuthServiceProvider.php | app/Providers/AuthServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
$this->registerPolicies();
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/bootstrap/app.php | bootstrap/app.php | <?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/tests/TestCase.php | tests/TestCase.php | <?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/tests/CreatesApplication.php | tests/CreatesApplication.php | <?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/tests/Feature/ExampleTest.php | tests/Feature/ExampleTest.php | <?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/tests/Unit/ExampleTest.php | tests/Unit/ExampleTest.php | <?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$this->assertTrue(true);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/routes/web.php | routes/web.php | <?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function (): void {
echo "<h3 style='display: flex;justify-content: center'>
laravel-casbin-admin 基于laravel8.x开发前后端分离的后台通用框架
</h3>
";
});
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/routes/channels.php | routes/channels.php | <?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.User.{id}', fn ($user, $id) => (int) $user->id === (int) $id);
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/routes/api.php | routes/api.php | <?php
use App\Http\Controllers\Auth\AuthController;
use App\Http\Controllers\Auth\CaptchaController;
use App\Http\Controllers\Auth\DingController;
use App\Http\Controllers\Auth\LogController;
use App\Http\Controllers\Auth\PermissionsController;
use App\Http\Controllers\Auth\RolesController;
use App\Http\Controllers\Auth\SystemController;
use App\Http\Controllers\Auth\UsersController;
use App\Http\Controllers\Auth\WeiBoController;
use App\Http\Controllers\Service\TaskController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::group(['prefix' => 'auth'], function (): void {
Route::post('login', [AuthController::class, 'login']); // 登录
Route::any('dingLogin', [DingController::class, 'DingLogin']); // 钉钉授权登录
Route::any('dingBing', [DingController::class, 'dingBing']); // 钉钉绑定
Route::get('bindQrcode', [DingController::class, 'bindQrcode']); // 钉钉扫码
Route::get('weiboCallBack', [WeiBoController::class, 'weiboCallBack']); // 微博扫码
Route::post('logout', [AuthController::class, 'logout']); // 注销
Route::post('refresh', [AuthController::class, 'refresh']); // 刷新用户状态
Route::put('update', [AuthController::class, 'update']); // 更新用户信息
Route::post('me', [AuthController::class, 'me'])->name('me')->middleware(['jwt.auth']);
});
// 系统管理
Route::group(['middleware' => ['jwt.auth', 'log']], function (): void {
Route::group(['prefix' => 'admin', 'middleware' => ['permission']], function (): void {
Route::get('/users', [UsersController::class, 'index']); // 用户列表
Route::post('/users', [UsersController::class, 'store']); // 添加新用户;
Route::put('users/{id}', [UsersController::class, 'update']); // 更新用户信息
Route::get('/roles', [RolesController::class, 'index']); // 角色列表
Route::post('/roles', [RolesController::class, 'store']); // 添加角色
Route::put('/roles/{id}', [RolesController::class, 'update']); // 更新角色
Route::delete('/roles/{id}', [RolesController::class, 'destroy']); // 删除角色
Route::get('/permissions', [PermissionsController::class, 'index']); // 权限列表
Route::post('/permissions', [PermissionsController::class, 'store']); // 添加权限
Route::put('/permissions/{id}', [PermissionsController::class, 'update']); // 更新权限
Route::delete('/permissions/{id}', [PermissionsController::class, 'destroy']); // 删除权限
Route::get('/log', [LogController::class, 'index']); // 获取日志列表
Route::delete('/log', [LogController::class, 'destroy']); // 删除日志
Route::get('/system', [SystemController::class, 'info']); // 系统信息
Route::get('/terminal', [SystemController::class, 'terminal']); // 系统终端认证 注意防止漏洞
});
Route::get('/admin/all_permissions', [PermissionsController::class, 'allPermissions']); // 获取所有权限
Route::get('/admin/all_role', [RolesController::class, 'allRule']); // 获取所有角色
Route::post('upload_img', [UsersController::class, 'updateImg']); // 头像更新
Route::post('sshCertification', [UsersController::class, 'sshCertification']); // 头像更新
Route::group(['prefix' => 'server', 'middleware' => ['permission']], function (): void {
Route::get('/tasks', [TaskController::class, 'index']); // 任务列表
Route::post('/tasks', [TaskController::class, 'store']); // 添加新任务;
Route::put('/tasks/{id}', [TaskController::class, 'update']); // 更新任务;
Route::delete('/tasks/{id}', [TaskController::class, 'destroy']); // 删除任务;
});
});
Route::post('captcha', [CaptchaController::class, 'captcha']); // 获取验证码
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/routes/console.php | routes/console.php | <?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function (): void {
$this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/public/index.php | public/index.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/geoip.php | config/geoip.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for when a location is not found
| for the IP provided.
|
*/
'log_failures' => true,
/*
|--------------------------------------------------------------------------
| Include Currency in Results
|--------------------------------------------------------------------------
|
| When enabled the system will do it's best in deciding the user's currency
| by matching their ISO code to a preset list of currencies.
|
*/
'include_currency' => true,
/*
|--------------------------------------------------------------------------
| Default Service
|--------------------------------------------------------------------------
|
| Here you may specify the default storage driver that should be used
| by the framework.
|
| Supported: "maxmind_database", "maxmind_api", "ipapi"
|
*/
'service' => 'ipapi',
/*
|--------------------------------------------------------------------------
| Storage Specific Configuration
|--------------------------------------------------------------------------
|
| Here you may configure as many storage drivers as you wish.
|
*/
'services' => [
'maxmind_database' => [
'class' => \Torann\GeoIP\Services\MaxMindDatabase::class,
'database_path' => storage_path('app/geoip.mmdb'),
'update_url' => sprintf('https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz', env('MAXMIND_LICENSE_KEY')),
'locales' => ['zh-CN'],
],
'maxmind_api' => [
'class' => \Torann\GeoIP\Services\MaxMindWebService::class,
'user_id' => env('MAXMIND_USER_ID'),
'license_key' => env('MAXMIND_LICENSE_KEY'),
'locales' => ['zh-CN'],
],
'ipapi' => [
'class' => \Torann\GeoIP\Services\IPApi::class,
'secure' => true,
'key' => env('IPAPI_KEY'),
'continent_path' => storage_path('app/continents.json'),
'lang' => 'zh-CN',
],
'ipgeolocation' => [
'class' => \Torann\GeoIP\Services\IPGeoLocation::class,
'secure' => true,
'key' => env('IPGEOLOCATION_KEY'),
'continent_path' => storage_path('app/continents.json'),
'lang' => 'zh-CN',
],
'ipdata' => [
'class' => \Torann\GeoIP\Services\IPData::class,
'key' => env('IPDATA_API_KEY'),
'secure' => true,
],
'ipfinder' => [
'class' => \Torann\GeoIP\Services\IPFinder::class,
'key' => env('IPFINDER_API_KEY'),
'secure' => true,
'locales' => ['zh-CN'],
],
],
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| Here you may specify the type of caching that should be used
| by the package.
|
| Options:
|
| all - All location are cached
| some - Cache only the requesting user
| none - Disable cached
|
*/
'cache' => 'all',
/*
|--------------------------------------------------------------------------
| Cache Tags
|--------------------------------------------------------------------------
|
| Cache tags are not supported when using the file or database cache
| drivers in Laravel. This is done so that only locations can be cleared.
|
*/
'cache_tags' => ['torann-geoip-location'],
/*
|--------------------------------------------------------------------------
| Cache Expiration
|--------------------------------------------------------------------------
|
| Define how long cached location are valid.
|
*/
'cache_expires' => 30,
/*
|--------------------------------------------------------------------------
| Default Location
|--------------------------------------------------------------------------
|
| Return when a location is not found.
|
*/
'default_location' => [
'ip' => '127.0.0.0',
'iso_code' => 'US',
'country' => 'United States',
'city' => 'New Haven',
'state' => 'CT',
'state_name' => 'Connecticut',
'postal_code' => '06510',
'lat' => 41.31,
'lon' => -72.92,
'timezone' => 'America/New_York',
'continent' => 'NA',
'default' => true,
'currency' => 'USD',
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/captcha.php | config/captcha.php | <?php
return [
'characters' => ['2', '3', '4', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'm', 'n', 'p', 'q', 'r', 't', 'u', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'M', 'N', 'P', 'Q', 'R', 'T', 'U', 'X', 'Y', 'Z'],
'default' => [
'length' => 4,
'width' => 120,
'height' => 45,
'quality' => 90,
'math' => false,
'expire' => 120,
'encrypt' => false,
],
'math' => [
'length' => 9,
'width' => 120,
'height' => 36,
'quality' => 90,
'math' => true,
],
'flat' => [
'length' => 5,
'width' => 120,
'height' => 45,
'quality' => 90,
'lines' => 6,
'bgImage' => false,
'bgColor' => '#ecf2f4',
'fontColors' => ['#2c3e50', '#c0392b', '#16a085', '#c0392b', '#8e44ad', '#303f9f', '#f57c00', '#795548'],
'contrast' => -5,
],
'mini' => [
'length' => 3,
'width' => 60,
'height' => 32,
],
'inverse' => [
'length' => 5,
'width' => 120,
'height' => 36,
'quality' => 90,
'sensitive' => true,
'angle' => 12,
'sharpen' => 10,
'blur' => 2,
'invert' => true,
'contrast' => -5,
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/app.php | config/app.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Shanghai',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
// Laravel Framework Service Providers...
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
// Package Service Providers...
// Application Service Providers...
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Lauthz\LauthzServiceProvider::class,
Mews\Captcha\CaptchaServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'LogController' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Enforcer' => Lauthz\Facades\Enforcer::class,
'Captcha' => Mews\Captcha\Facades\Captcha::class,
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/logging.php | config/logging.php | <?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default LogController Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| LogController Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
],
'sql' => [
'driver' => 'daily',
'path' => storage_path('logs/database_sql.log'),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel LogController',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/session.php | config/session.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/l5-swagger.php | config/l5-swagger.php | <?php
return [
'default' => 'default',
'documentations' => [
'default' => [
'api' => [
'title' => 'L5 Swagger UI',
],
'routes' => [
// Route for accessing api documentation interface
'api' => 'api/documentation',
],
'paths' => [
// File name of the generated json documentation file
'docs_json' => 'api-docs.json',
// File name of the generated YAML documentation file
'docs_yaml' => 'api-docs.yaml',
// Set this to `json` or `yaml` to determine which documentation file to use in UI
'format_to_use_for_docs' => env('L5_FORMAT_TO_USE_FOR_DOCS', 'json'),
// Absolute paths to directory containing the swagger annotations are stored.
'annotations' => [
base_path('app'),
],
],
],
],
'defaults' => [
'routes' => [
// Route for accessing parsed swagger annotations.
'docs' => 'docs',
// Route for Oauth2 authentication callback.
'oauth2_callback' => 'api/oauth2-callback',
// Middleware allows to prevent unexpected access to API documentation
'middleware' => [
'api' => [],
'asset' => [],
'docs' => [],
'oauth2_callback' => [],
],
// Route Group options
'group_options' => [],
],
'paths' => [
// Absolute path to location where parsed annotations will be stored
'docs' => storage_path('api-docs'),
// Absolute path to directory where to export views
'views' => base_path('resources/views/vendor/l5-swagger'),
// Edit to set the api's base path
'base' => env('L5_SWAGGER_BASE_PATH', null),
// Edit to set path where swagger ui assets should be stored
'swagger_ui_assets_path' => env('L5_SWAGGER_UI_ASSETS_PATH', 'vendor/swagger-api/swagger-ui/dist/'),
// Absolute path to directories that should be exclude from scanning
'excludes' => [],
],
// API security definitions. Will be generated into documentation file.
'securityDefinitions' => [
'securitySchemes' => [
// Examples of Security schemes
/*
'api_key_security_example' => [ // Unique name of security
'type' => 'apiKey', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'A short description for security scheme',
'name' => 'api_key', // The name of the header or query parameter to be used.
'in' => 'header', // The location of the API key. Valid values are "query" or "header".
],
'oauth2_security_example' => [ // Unique name of security
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'A short description for oauth2 security scheme.',
'flow' => 'implicit', // The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
'authorizationUrl' => 'http://example.com/auth', // The authorization URL to be used for (implicit/accessCode)
//'tokenUrl' => 'http://example.com/auth' // The authorization URL to be used for (password/application/accessCode)
'scopes' => [
'read:projects' => 'read your projects',
'write:projects' => 'modify projects in your account',
]
],
*/
/* Open API 3.0 support
'passport' => [ // Unique name of security
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'Laravel passport oauth2 security.',
'in' => 'header',
'scheme' => 'https',
'flows' => [
"password" => [
"authorizationUrl" => config('app.url') . '/oauth/authorize',
"tokenUrl" => config('app.url') . '/oauth/token',
"refreshUrl" => config('app.url') . '/token/refresh',
"scopes" => []
],
],
],
*/
],
'security' => [
// Examples of Securities
[
/*
'oauth2_security_example' => [
'read',
'write'
],
'passport' => []
*/
],
],
],
/*
* Set this to `true` in development mode so that docs would be regenerated on each request
* Set this to `false` to disable swagger generation on production
*/
'generate_always' => env('L5_SWAGGER_GENERATE_ALWAYS', false),
// Set this to `true` to generate a copy of documentation in yaml format
'generate_yaml_copy' => env('L5_SWAGGER_GENERATE_YAML_COPY', false),
/*
* Edit to trust the proxy's ip address - needed for AWS Load Balancer
* string[]
*/
'proxy' => false,
/*
* Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle.
* See more at: https://github.com/swagger-api/swagger-ui#configs-plugin
*/
'additional_config_url' => null,
/*
* Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically),
* 'method' (sort by HTTP method).
* Default is the order returned by the server unchanged.
*/
'operations_sort' => env('L5_SWAGGER_OPERATIONS_SORT', null),
/*
* Pass the validatorUrl parameter to SwaggerUi init on the JS side.
* A null value here disables validation.
*/
'validator_url' => null,
// Uncomment to add constants which can be used in annotations
// 'constants' => [
// 'L5_SWAGGER_CONST_HOST' => env('L5_SWAGGER_CONST_HOST', 'http://my-default-host.com'),
// ],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/queue.php | config/queue.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/jwt.php | config/jwt.php | <?php
/*
* This file is part of jwt-auth.
*
* (c) Sean Tymon <tymon148@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| JWT Authentication Secret
|--------------------------------------------------------------------------
|
| Don't forget to set this in your .env file, as it will be used to sign
| your tokens. A helper command is provided for this:
| `php artisan jwt:secret`
|
| Note: This will be used for Symmetric algorithms only (HMAC),
| since RSA and ECDSA use a private/public key combo (See below).
|
*/
'secret' => env('JWT_SECRET'),
/*
|--------------------------------------------------------------------------
| JWT Authentication Keys
|--------------------------------------------------------------------------
|
| The algorithm you are using, will determine whether your tokens are
| signed with a random string (defined in `JWT_SECRET`) or using the
| following public & private keys.
|
| Symmetric Algorithms:
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
| Asymmetric Algorithms:
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
*/
'keys' => [
/*
|--------------------------------------------------------------------------
| Public Key
|--------------------------------------------------------------------------
|
| A path or resource to your public key.
|
| E.g. 'file://path/to/public/key'
|
*/
'public' => env('JWT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| A path or resource to your private key.
|
| E.g. 'file://path/to/private/key'
|
*/
'private' => env('JWT_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| The passphrase for your private key. Can be null if none set.
|
*/
'passphrase' => env('JWT_PASSPHRASE'),
],
/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour.
|
| You can also set this to null, to yield a never expiring token.
| Some people may want this behaviour for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
| Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
|
*/
'ttl' => env('JWT_TTL', 60),
/*
|--------------------------------------------------------------------------
| Refresh time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token can be refreshed
| within. I.E. The user can refresh their token within a 2 week window of
| the original token being created until they must re-authenticate.
| Defaults to 2 weeks.
|
| You can also set this to null, to yield an infinite refresh time.
| Some may want this instead of never expiring tokens for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
|
*/
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
/*
|--------------------------------------------------------------------------
| JWT hashing algorithm
|--------------------------------------------------------------------------
|
| Specify the hashing algorithm that will be used to sign the token.
|
| See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
| for possible values.
|
*/
'algo' => env('JWT_ALGO', 'HS256'),
/*
|--------------------------------------------------------------------------
| Required Claims
|--------------------------------------------------------------------------
|
| Specify the required claims that must exist in any token.
| A TokenInvalidException will be thrown if any of these claims are not
| present in the payload.
|
*/
'required_claims' => [
'iss',
'iat',
'exp',
'nbf',
'sub',
'jti',
],
/*
|--------------------------------------------------------------------------
| Persistent Claims
|--------------------------------------------------------------------------
|
| Specify the claim keys to be persisted when refreshing a token.
| `sub` and `iat` will automatically be persisted, in
| addition to the these claims.
|
| Note: If a claim does not exist then it will be ignored.
|
*/
'persistent_claims' => [
// 'foo',
// 'bar',
],
/*
|--------------------------------------------------------------------------
| Lock Subject
|--------------------------------------------------------------------------
|
| This will determine whether a `prv` claim is automatically added to
| the token. The purpose of this is to ensure that if you have multiple
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
| should prevent one authentication request from impersonating another,
| if 2 tokens happen to have the same id across the 2 different models.
|
| Under specific circumstances, you may want to disable this behaviour
| e.g. if you only have one authentication model, then you would save
| a little on token size.
|
*/
'lock_subject' => true,
/*
|--------------------------------------------------------------------------
| Leeway
|--------------------------------------------------------------------------
|
| This property gives the jwt timestamp claims some "leeway".
| Meaning that if you have any unavoidable slight clock skew on
| any of your servers then this will afford you some level of cushioning.
|
| This applies to the claims `iat`, `nbf` and `exp`.
|
| Specify in seconds - only if you know you need it.
|
*/
'leeway' => env('JWT_LEEWAY', 0),
/*
|--------------------------------------------------------------------------
| Blacklist Enabled
|--------------------------------------------------------------------------
|
| In order to invalidate tokens, you must have the blacklist enabled.
| If you do not want or need this functionality, then set this to false.
|
*/
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
/*
| -------------------------------------------------------------------------
| Blacklist Grace Period
| -------------------------------------------------------------------------
|
| When multiple concurrent requests are made with the same JWT,
| it is possible that some of them fail, due to token regeneration
| on every request.
|
| Set grace period in seconds to prevent parallel request failure.
|
*/
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
/*
|--------------------------------------------------------------------------
| Cookies encryption
|--------------------------------------------------------------------------
|
| By default Laravel encrypt cookies for security reason.
| If you decide to not decrypt cookies, you will have to configure Laravel
| to not encrypt your cookie token by adding its name into the $except
| array available in the middleware "EncryptCookies" provided by Laravel.
| see https://laravel.com/docs/master/responses#cookies-and-encryption
| for details.
|
| Set it to true if you want to decrypt cookies.
|
*/
'decrypt_cookies' => false,
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| Specify the various providers used throughout the package.
|
*/
'providers' => [
/*
|--------------------------------------------------------------------------
| JWT Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to create and decode the tokens.
|
*/
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
/*
|--------------------------------------------------------------------------
| Storage Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to store tokens in the blacklist.
|
*/
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/cache.php | config/cache.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/hashing.php | config/hashing.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/view.php | config/view.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/database.php | config/database.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('SQLITE_DATABASE_URL'),
'database' => database_path(env('SQLITE_DB_DATABASE', 'database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'blog' => [
'driver' => 'blog',
'url' => env('DATABASE_URL'),
'host' => env('BLOG_DB_HOST', '127.0.0.1'),
'port' => env('BLOG_DB_PORT', '3306'),
'database' => env('BLOG_DB_DATABASE', 'forge'),
'username' => env('BLOG_DB_USERNAME', 'forge'),
'password' => env('BLOG_DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/services.php | config/services.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/flare.php | config/flare.php | <?php
return [
/*
|
|--------------------------------------------------------------------------
| Flare API key
|--------------------------------------------------------------------------
|
| Specify Flare's API key below to enable error reporting to the service.
|
| More info: https://flareapp.io/docs/general/projects
|
*/
'key' => env('FLARE_KEY'),
/*
|--------------------------------------------------------------------------
| Reporting Options
|--------------------------------------------------------------------------
|
| These options determine which information will be transmitted to Flare.
|
*/
'reporting' => [
'anonymize_ips' => true,
'collect_git_information' => false,
'report_queries' => true,
'maximum_number_of_collected_queries' => 200,
'report_query_bindings' => true,
'report_view_data' => true,
'grouping_type' => null,
],
/*
|--------------------------------------------------------------------------
| Reporting LogController statements
|--------------------------------------------------------------------------
|
| If this setting is `false` log statements won't be send as events to Flare,
| no matter which error level you specified in the Flare log channel.
|
*/
'send_logs_as_events' => true,
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/ding.php | config/ding.php | <?php
return [
'robot' => [
'default' => 'DING',
'think007' => [
'access_token' => env('DING_TOKEN', ''),
'secret' => env('DING_SECRET', ''),
],
],
'work-notice' => [
'appkey' => env('DT_KEY'),
'appsecret' => env('DT_SECRET'),
'agent_id' => env('DT_AGENT_ID'),
],
'http' => [
'timeout' => env('DT_TIMEOUT', 2),
],
'log' => [
'robot' => [
'level' => \Monolog\Logger::INFO,
'channel_name' => 'robot',
'path' => storage_path('logs/ding-talk/robot.log'),
],
'work-notice' => [
'level' => \Monolog\Logger::INFO,
'channel_name' => 'work-notice',
'path' => storage_path('logs/ding-talk/work-notice.log'),
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/filesystems.php | config/filesystems.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/tinker.php | config/tinker.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
| but you may explicitly allow a subset of classes to get aliased by
| adding the names of each of those classes to the following list.
|
*/
'alias' => [
],
/*
|--------------------------------------------------------------------------
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [
'App\Nova',
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/octane.php | config/octane.php | <?php
use Laravel\Octane\Contracts\OperationTerminated;
use Laravel\Octane\Events\RequestHandled;
use Laravel\Octane\Events\RequestReceived;
use Laravel\Octane\Events\RequestTerminated;
use Laravel\Octane\Events\TaskReceived;
use Laravel\Octane\Events\TaskTerminated;
use Laravel\Octane\Events\TickReceived;
use Laravel\Octane\Events\TickTerminated;
use Laravel\Octane\Events\WorkerErrorOccurred;
use Laravel\Octane\Events\WorkerStarting;
use Laravel\Octane\Events\WorkerStopping;
use Laravel\Octane\Listeners\CollectGarbage;
use Laravel\Octane\Listeners\DisconnectFromDatabases;
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
use Laravel\Octane\Listeners\FlushUploadedFiles;
use Laravel\Octane\Listeners\ReportException;
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
use Laravel\Octane\Octane;
return [
/*
|--------------------------------------------------------------------------
| Octane Server
|--------------------------------------------------------------------------
|
| This value determines the default "server" that will be used by Octane
| when starting, restarting, or stopping your server via the CLI. You
| are free to change this to the supported server of your choosing.
|
| Supported: "roadrunner", "swoole"
|
*/
'server' => env('OCTANE_SERVER', 'roadrunner'),
/*
|--------------------------------------------------------------------------
| Force HTTPS
|--------------------------------------------------------------------------
|
| When this configuration value is set to "true", Octane will inform the
| framework that all absolute links must be generated using the HTTPS
| protocol. Otherwise your links may be generated using plain HTTP.
|
*/
'https' => env('OCTANE_HTTPS', false),
/*
|--------------------------------------------------------------------------
| Octane Listeners
|--------------------------------------------------------------------------
|
| All of the event listeners for Octane's events are defined below. These
| listeners are responsible for resetting your application's state for
| the next request. You may even add your own listeners to the list.
|
*/
'listeners' => [
WorkerStarting::class => [
EnsureUploadedFilesAreValid::class,
EnsureUploadedFilesCanBeMoved::class,
],
RequestReceived::class => [
...Octane::prepareApplicationForNextOperation(),
...Octane::prepareApplicationForNextRequest(),
//
],
RequestHandled::class => [
//
],
RequestTerminated::class => [
// FlushUploadedFiles::class,
],
TaskReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TaskTerminated::class => [
//
],
TickReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TickTerminated::class => [
//
],
OperationTerminated::class => [
FlushTemporaryContainerInstances::class,
// DisconnectFromDatabases::class,
// CollectGarbage::class,
],
WorkerErrorOccurred::class => [
ReportException::class,
StopWorkerIfNecessary::class,
],
WorkerStopping::class => [
//
],
],
/*
|--------------------------------------------------------------------------
| Warm / Flush Bindings
|--------------------------------------------------------------------------
|
| The bindings listed below will either be pre-warmed when a worker boots
| or they will be flushed before every new request. Flushing a binding
| will force the container to resolve that binding again when asked.
|
*/
'warm' => [
...Octane::defaultServicesToWarm(),
],
'flush' => [
//
],
/*
|--------------------------------------------------------------------------
| Octane Cache Table
|--------------------------------------------------------------------------
|
| While using Swoole, you may leverage the Octane cache, which is powered
| by a Swoole table. You may set the maximum number of rows as well as
| the number of bytes per row using the configuration options below.
|
*/
'cache' => [
'rows' => 1000,
'bytes' => 10000,
],
/*
|--------------------------------------------------------------------------
| Octane Swoole Tables
|--------------------------------------------------------------------------
|
| While using Swoole, you may define additional tables as required by the
| application. These tables can be used to store data that needs to be
| quickly accessed by other workers on the particular Swoole server.
|
*/
'tables' => [
'example:1000' => [
'name' => 'string:1000',
'votes' => 'int',
],
],
/*
|--------------------------------------------------------------------------
| File Watching
|--------------------------------------------------------------------------
|
| The following list of files and directories will be watched when using
| the --watch option offered by Octane. If any of the directories and
| files are changed, Octane will automatically reload your workers.
|
*/
'watch' => [
'app',
'bootstrap',
'config',
'database',
'public/**/*.php',
'resources/**/*.php',
'routes',
'composer.lock',
'.env',
],
/*
|--------------------------------------------------------------------------
| Garbage Collection Threshold
|--------------------------------------------------------------------------
|
| When executing long-lived PHP scripts such as Octane, memory can build
| up before being cleared by PHP. You can force Octane to run garbage
| collection if your application consumes this amount of megabytes.
|
*/
'garbage' => 50,
/*
|--------------------------------------------------------------------------
| Maximum Execution Time
|--------------------------------------------------------------------------
|
| The following setting configures the maximum execution time for requests
| being handled by Octane. You may set this value to 0 to indicate that
| there isn't a specific time limit on Octane request execution time.
|
*/
'max_execution_time' => 30,
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/mail.php | config/mail.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/ignition.php | config/ignition.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders",
| "sublime", "atom", "nova"
|
*/
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/
'theme' => env('IGNITION_THEME', 'light'),
/*
|--------------------------------------------------------------------------
| Sharing
|--------------------------------------------------------------------------
|
| You can share local errors with colleagues or others around the world.
| Sharing is completely free and doesn't require an account on Flare.
|
| If necessary, you can completely disable sharing below.
|
*/
'enable_share_button' => env('IGNITION_SHARING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Register Ignition commands
|--------------------------------------------------------------------------
|
| Ignition comes with an additional make command that lets you create
| new solution classes more easily. To keep your default Laravel
| installation clean, this command is not registered by default.
|
| You can enable the command registration below.
|
*/
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'ignored_solution_providers' => [
\Facade\Ignition\SolutionProviders\MissingPackageSolutionProvider::class,
],
/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. Runnable solutions are enabled when your app has
| debug mode enabled. You may also fully disable this feature.
|
*/
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', null),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', ''),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Housekeeping Endpoint Prefix
|--------------------------------------------------------------------------
|
| Ignition registers a couple of routes when it is enabled. Below you may
| specify a route prefix that will be used to host all internal links.
|
*/
'housekeeping_endpoint_prefix' => '_ignition',
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/cors.php | config/cors.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/lauthz.php | config/lauthz.php | <?php
return [
// Default Lauthz driver
'default' => 'basic',
'basic' => [
// Casbin model setting.
'model' => [
// Available Settings: "file", "text"
'config_type' => 'file',
'config_file_path' => config_path('lauthz-rbac-model.conf'),
'config_text' => '',
],
// Casbin adapter .
'adapter' => Lauthz\Adapters\DatabaseAdapter::class,
// Database setting.
'database' => [
// Database connection for following tables.
'connection' => '',
// Rule table name.
'rules_table' => 'casbin_rules',
],
'log' => [
// changes whether Lauthz will log messages to the Logger.
'enabled' => false,
// Casbin Logger, Supported: \Psr\Log\LoggerInterface|string
'logger' => 'log',
],
'cache' => [
// changes whether Lauthz will cache the rules.
'enabled' => false,
// cache store
'store' => 'default',
// cache Key
'key' => 'rules',
// ttl \DateTimeInterface|\DateInterval|int|null
'ttl' => 24 * 60,
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/trustedproxy.php | config/trustedproxy.php | <?php
return [
/*
* Set trusted proxy IP addresses.
*
* Both IPv4 and IPv6 addresses are
* supported, along with CIDR notation.
*
* The "*" character is syntactic sugar
* within TrustedProxy to trust any proxy
* that connects directly to your server,
* a requirement when you cannot know the address
* of your proxy (e.g. if using ELB or similar).
*
*/
'proxies' => null, // [<ip addresses>,], '*', '<ip addresses>,'
/*
* To trust one or more specific proxies that connect
* directly to your server, use an array or a string separated by comma of IP addresses:
*/
// 'proxies' => ['192.168.1.1'],
// 'proxies' => '192.168.1.1, 192.168.1.2',
/*
* Or, to trust all proxies that connect
* directly to your server, use a "*"
*/
// 'proxies' => '*',
/*
* Which headers to use to detect proxy related data (For, Host, Proto, Port)
*
* Options include:
*
* - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust)
* - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust)
* - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer)
*
* - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust)
* - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust)
* - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer)
*
* @link https://symfony.com/doc/current/deployment/proxies.html
*/
'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/broadcasting.php | config/broadcasting.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/oauth.php | config/oauth.php | <?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/4/9
* Time : 5:01 下午.
*/
// 其他平台请保持参数一致 microsoft 注意还有这个参数 region
return [
'github' => [
'client_id' => env('GITHUB_CLIENT_ID', ''),
'redirect_uri' => env('GITHUB_CALLBACK', ''),
'client_secret' => env('GITHUB_SECRET', ''),
],
'gitee' => [
'client_id' => env('GITEE_CLIENT_ID', ''),
'redirect_uri' => env('GITEE_CALLBACK', ''),
'client_secret' => env('GITEE_SECRET', ''),
],
'weibo' => [
'client_id' => env('WEIBO_CLIENT_ID', ''),
'redirect_uri' => env('WEIBO_CALLBACK', ''),
'client_secret' => env('WEIBO_SECRET', ''),
],
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/config/auth.php | config/auth.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
'hash' => false,
],
// 新增admins 模块
'admin' => [
'driver' => 'jwt',
'provider' => 'admins',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/seeds/UserSeeder.php | database/seeds/UserSeeder.php | <?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class UserSeeder extends Seeder
{
protected $users = [
['email' => 'pltruenine@163.com', 'password' => '123456', 'name' => 'admin'],
['email' => 'demo@163.com', 'password' => '123456', 'name' => 'demo'],
];
/**
* Run the database seeds.
*/
public function run(): void
{
foreach ($this->users as $user) {
$this->createUser($user['email'], $user['name'], $user['password']);
}
}
public function createUser($email, $name, $password): void
{
if (User::query()->where('email', $email)->doesntExist()) {
User::query()->create([
'name' => $name,
'email' => $email,
'password' => Hash::make($password),
'email_verified_at' => now()->toDateTimeString(),
]);
}
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/seeds/PermissionSeeder.php | database/seeds/PermissionSeeder.php | <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PermissionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('admin_permissions')->truncate();
DB::select("INSERT INTO `admin_permissions`(`id`, `name`, `icon`, `path`, `url`, `status`, `created_at`, `method`, `updated_at`, `p_id`, `hidden`, `is_menu`, `title`, `deleted_at`) VALUES
(1, '系统管理', 'fa fa-steam-square', '/admin', '/admin', 1, '2021-02-28 11:40:29', '*', '2022-07-13 16:11:06', 0, 1, 1, '系统管理', NULL),
(2, '权限管理', 'fa fa-pencil-square', '/permission', '/permission', 1, '2021-02-28 11:42:17', '*', '2021-02-28 12:12:08', 1, 1, 1, '权限管理', NULL),
(3, '角色管理', 'fa fa-user-secret', '/role', '/role', 1, '2021-02-28 11:43:15', '*', '2022-06-01 20:07:37', 1, 1, 1, '角色管理', NULL),
(4, '用户管理', 'fa fa-users', '/user', '/user', 1, '2021-02-28 11:43:59', '*', '2021-02-28 12:12:22', 1, 1, 1, '用户管理', NULL),
(5, '系统日志', 'fa fa-location-arrow', '/log', '/log', 1, '2021-03-01 07:02:04', '*', '2021-03-01 07:02:04', 1, 1, 1, '系统日志', NULL),
(6, '系统', NULL, NULL, 'api/admin', 1, '2021-03-03 02:08:23', '*', '2021-03-03 11:56:06', 0, 1, 0, '系统', NULL),
(7, '日志列表', NULL, NULL, 'api/admin/log', 1, '2021-03-03 02:19:14', 'GET', '2021-03-03 14:06:12', 6, 1, 0, '日志列表', NULL),
(8, '用户列表', NULL, NULL, 'api/admin/users', 1, '2021-03-03 05:33:21', 'GET', '2021-03-03 14:06:24', 6, 1, 0, '用户列表', NULL),
(9, '日志删除', NULL, NULL, 'api/admin/log/{id}', 1, '2021-03-03 05:44:09', 'DELETE', '2021-03-03 13:46:51', 6, 1, 0, '日志删除', NULL),
(10, '添加用户', NULL, NULL, 'api/admin/users', 1, '2021-03-03 06:03:04', 'POST', '2021-03-03 14:06:52', 6, 1, 0, '添加用户', NULL),
(11, '更新用户', NULL, NULL, 'api/admin/users/{id}', 1, '2021-03-03 06:05:41', 'PUT', '2021-03-03 06:05:41', 6, 1, 0, '更新用户', NULL),
(12, '权限列表', 'fa fa-user-secret', '*', '/api/admin/permissions', 1, '2021-03-13 12:51:32', '*', '2021-03-13 20:52:19', 6, 1, 1, '权限列表', '2021-03-13 20:52:19'),
(13, '权限列表', NULL, NULL, 'api/admin/permissions', 1, '2021-03-13 12:52:32', 'GET', '2021-03-13 20:56:41', 6, 1, 0, '权限列表', NULL),
(30, '添加权限', NULL, NULL, 'api/admin/permissions', 1, '2021-03-13 12:52:32', 'POST', '2021-03-13 20:56:41', 6, 1, 0, '添加权限', NULL),
(31, '移除权限', NULL, NULL, 'api/admin/permissions/{id}', 1, '2021-03-13 12:52:32', 'DELETE', '2021-03-13 20:56:41', 6, 1, 0, '移除权限', NULL),
(32, '更新权限', NULL, NULL, 'api/admin/permissions/{id}', 1, '2021-03-13 12:52:32', 'PUT', '2021-03-13 20:56:41', 6, 1, 0, '更新权限', NULL),
(33, '角色列表', NULL, NULL, 'api/admin/roles', 1, '2021-03-13 12:53:58', 'GET', '2021-03-13 20:57:25', 6, 1, 0, '角色列表', NULL),
(27, '添加角色', NULL, NULL, 'api/admin/roles', 1, '2021-03-13 12:53:58', 'POST', '2021-03-13 20:57:25', 6, 1, 0, '添加角色', NULL),
(28, '删除角色', NULL, NULL, 'api/admin/roles/{id}', 1, '2021-03-13 12:53:58', 'DELETE', '2021-03-13 20:57:25', 6, 1, 0, '删除角色', NULL),
(29, '更新角色', NULL, NULL, 'api/admin/roles/{id}', 1, '2021-03-13 12:53:58', 'PUT', '2021-03-13 20:57:25', 6, 1, 0, '更新角色', NULL),
(15, '测试', 'fa fa-slack', '/test', '/api/test', 1, '2021-05-27 05:50:58', '*', '2021-05-27 14:17:08', 0, 1, 1, '测试', '2021-05-27 14:17:08'),
(16, '子节点', 'fa fa-italic', '/test/z-test', '/*', 1, '2021-05-27 05:51:45', '*', '2021-05-27 13:53:03', 15, 1, 1, '子节点', NULL),
(17, '测试', 'fa fa-slack', '/test-1', '*', 1, '2021-05-27 05:53:33', '*', '2021-05-27 13:55:37', 0, 1, 1, '测试', '2021-05-27 13:55:37'),
(18, '测试菜单', 'fa fa-arrows-alt', '/test', '/test', 1, '2021-05-27 06:18:06', '*', '2021-06-03 10:21:21', 0, 1, 1, '测试菜单', '2021-06-03 10:21:21'),
(19, '测试子菜单', 'fa fa-video-camera', '/z-test', '/z-test', 1, '2021-05-27 06:19:01', '*', '2021-05-27 14:32:51', 18, 1, 1, '测试子菜单', NULL),
(20, '测试子菜单2', 'fa fa-arrows-alt', '/z-test1', '/z-test1', 1, '2021-05-27 06:22:10', '*', '2021-05-27 14:24:06', 18, 1, 1, '测试子菜单2', '2021-05-27 14:24:06'),
(21, '系统信息', 'fa fa-sun-o', '/system', '/system', 1, '2021-05-31 08:03:30', '*', '2021-05-31 08:03:30', 1, 1, 1, '系统信息', NULL),
(22, '系统终端', 'fa fa-terminal', '/terminal', '/terminal', 1, '2021-06-01 02:05:37', '*', '2021-06-01 02:05:37', 1, 1, 1, '系统终端', NULL),
(23, '系统工具', 'fa fa-steam', '/systemTools', '/systemTools', 1, '2021-06-03 02:12:13', '*', '2021-06-03 10:14:45', 24, 1, 1, '系统工具', NULL),
(24, '系统工具', 'fa fa-dedent', '/Tools', '/Tools', 1, '2021-06-03 02:14:29', '*', '2021-06-03 10:33:31', 0, 1, 1, '系统工具', '2021-06-03 10:33:31'),
(25, '代码生成', 'fa fa-file-code-o', '/code', '/code', 1, '2021-06-03 02:15:20', '*', '2021-06-03 13:30:43', 1, 1, 1, '代码生成', '2021-06-03 13:30:43')");
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/seeds/DatabaseSeeder.php | database/seeds/DatabaseSeeder.php | <?php
use Database\Seeders\PermissionSeeder;
use Database\Seeders\UserSeeder;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call([
PermissionSeeder::class,
UserSeeder::class,
]);
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/factories/UserFactory.php | database/factories/UserFactory.php | <?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\Models\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
});
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/migrations/2022_08_04_232412_add_filed_to_user.php | database/migrations/2022_08_04_232412_add_filed_to_user.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFiledToUser extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table): void {
$table->string('avatar')->nullable();
$table->string('ding_id', 100)->nullable();
$table->string('oauth_id', 100)->nullable();
$table->tinyInteger('oauth_type')->default(0)->comment('1.微博 2.钉钉');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table): void {
});
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
pl1998/laravel-casbin-admin | https://github.com/pl1998/laravel-casbin-admin/blob/89d76be465237122e88f073d0a0a6519aaf3bd89/database/migrations/2022_08_04_233302_create_admin_log_table.php | database/migrations/2022_08_04_233302_create_admin_log_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminLogTable extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('admin_logs', function (Blueprint $table): void {
$table->id();
$table->string('url')->nullable();
$table->string('method')->nullable();
$table->string('ip')->nullable();
$table->integer('u_id')->nullable();
$table->string('name')->nullable();
$table->string('address')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('admin_logs');
}
}
| php | Apache-2.0 | 89d76be465237122e88f073d0a0a6519aaf3bd89 | 2026-01-05T05:04:44.676586Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.