add scramble
This commit is contained in:
@@ -90,6 +90,18 @@ class User extends Authenticatable
|
|||||||
return $this->roles->count() === 0;
|
return $this->roles->count() === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user can access api docs
|
||||||
|
*/
|
||||||
|
public function canAccessApiDocs(): bool
|
||||||
|
{
|
||||||
|
return in_array($this->email, [
|
||||||
|
'nurmuhammet@mail.com',
|
||||||
|
'mahmyt1206@gmail.com',
|
||||||
|
'api@mail.com',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if user is me.
|
* Check if user is me.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -76,5 +76,6 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Tooling permissions...
|
// Tooling permissions...
|
||||||
Gate::define('viewPulse', fn ($user) => $user->isAdmin());
|
Gate::define('viewPulse', fn ($user) => $user->isAdmin());
|
||||||
|
Gate::define('viewApiDocs', fn ($user) => $user->canAccessApiDocs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
|
"dedoc/scramble": "^0.11.11",
|
||||||
"denniseilander/pulse-about-application": "^0.1.1",
|
"denniseilander/pulse-about-application": "^0.1.1",
|
||||||
"ebess/advanced-nova-media-library": "^4.2",
|
"ebess/advanced-nova-media-library": "^4.2",
|
||||||
"eolica/nova-locale-switcher": "dev-support-nova-4",
|
"eolica/nova-locale-switcher": "dev-support-nova-4",
|
||||||
|
|||||||
123
composer.lock
generated
123
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c41ff91bab26b1982794daf0e30a4ef9",
|
"content-hash": "2a5ad217b457d9d62254bdfbd7797c40",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adoy/fastcgi-client",
|
"name": "adoy/fastcgi-client",
|
||||||
@@ -391,6 +391,80 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-07-12T11:35:52+00:00"
|
"time": "2024-07-12T11:35:52+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dedoc/scramble",
|
||||||
|
"version": "v0.11.11",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dedoc/scramble.git",
|
||||||
|
"reference": "031786322b8ce335e1e0c8c5b7fc07705090616c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/dedoc/scramble/zipball/031786322b8ce335e1e0c8c5b7fc07705090616c",
|
||||||
|
"reference": "031786322b8ce335e1e0c8c5b7fc07705090616c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/contracts": "^10.0|^11.0",
|
||||||
|
"nikic/php-parser": "^5.0",
|
||||||
|
"php": "^8.1",
|
||||||
|
"phpstan/phpdoc-parser": "^1.0",
|
||||||
|
"spatie/laravel-package-tools": "^1.9.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"laravel/pint": "^v1.1.0",
|
||||||
|
"nunomaduro/collision": "^7.0|^8.0",
|
||||||
|
"orchestra/testbench": "^8.0|^9.0",
|
||||||
|
"pestphp/pest": "^2.34",
|
||||||
|
"pestphp/pest-plugin-laravel": "^2.3",
|
||||||
|
"phpunit/phpunit": "^10.5",
|
||||||
|
"spatie/pest-plugin-snapshots": "^2.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Dedoc\\Scramble\\ScrambleServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Dedoc\\Scramble\\": "src",
|
||||||
|
"Dedoc\\Scramble\\Database\\Factories\\": "database/factories"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Roman Lytvynenko",
|
||||||
|
"email": "litvinenko95@gmail.com",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Automatic generation of API documentation for Laravel applications.",
|
||||||
|
"homepage": "https://github.com/dedoc/scramble",
|
||||||
|
"keywords": [
|
||||||
|
"documentation",
|
||||||
|
"laravel",
|
||||||
|
"openapi"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/dedoc/scramble/issues",
|
||||||
|
"source": "https://github.com/dedoc/scramble/tree/v0.11.11"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/romalytvynenko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-08-16T07:09:24+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "denniseilander/pulse-about-application",
|
"name": "denniseilander/pulse-about-application",
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
@@ -4750,6 +4824,53 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-07-20T21:41:07+00:00"
|
"time": "2024-07-20T21:41:07+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpstan/phpdoc-parser",
|
||||||
|
"version": "1.30.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||||
|
"reference": "5ceb0e384997db59f38774bf79c2a6134252c08f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f",
|
||||||
|
"reference": "5ceb0e384997db59f38774bf79c2a6134252c08f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/annotations": "^2.0",
|
||||||
|
"nikic/php-parser": "^4.15",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||||
|
"phpstan/extension-installer": "^1.0",
|
||||||
|
"phpstan/phpstan": "^1.5",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.1",
|
||||||
|
"phpstan/phpstan-strict-rules": "^1.0",
|
||||||
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"symfony/process": "^5.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPStan\\PhpDocParser\\": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||||
|
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0"
|
||||||
|
},
|
||||||
|
"time": "2024-08-29T09:54:52+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/cache",
|
"name": "psr/cache",
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
|
|||||||
87
config/scramble.php
Normal file
87
config/scramble.php
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Dedoc\Scramble\Http\Middleware\RestrictedDocsAccess;
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
* Your API path. By default, all routes starting with this path will be added to the docs.
|
||||||
|
* If you need to change this behavior, you can add your custom routes resolver using `Scramble::routes()`.
|
||||||
|
*/
|
||||||
|
'api_path' => 'api',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Your API domain. By default, app domain is used. This is also a part of the default API routes
|
||||||
|
* matcher, so when implementing your own, make sure you use this config if needed.
|
||||||
|
*/
|
||||||
|
'api_domain' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The path where your OpenAPI specification will be exported.
|
||||||
|
*/
|
||||||
|
'export_path' => 'api.json',
|
||||||
|
|
||||||
|
'info' => [
|
||||||
|
/*
|
||||||
|
* API version.
|
||||||
|
*/
|
||||||
|
'version' => env('API_VERSION', '0.0.1'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Description rendered on the home page of the API documentation (`/docs/api`).
|
||||||
|
*/
|
||||||
|
'description' => '',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Customize Stoplight Elements UI
|
||||||
|
*/
|
||||||
|
'ui' => [
|
||||||
|
/*
|
||||||
|
* Define the title of the documentation's website. App name is used when this config is `null`.
|
||||||
|
*/
|
||||||
|
'title' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define the theme of the documentation. Available options are `light` and `dark`.
|
||||||
|
*/
|
||||||
|
'theme' => 'light',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide the `Try It` feature. Enabled by default.
|
||||||
|
*/
|
||||||
|
'hide_try_it' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* URL to an image that displays as a small square logo next to the title, above the table of contents.
|
||||||
|
*/
|
||||||
|
'logo' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use to fetch the credential policy for the Try It feature. Options are: omit, include (default), and same-origin
|
||||||
|
*/
|
||||||
|
'try_it_credentials_policy' => 'include',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list of servers of the API. By default, when `null`, server URL will be created from
|
||||||
|
* `scramble.api_path` and `scramble.api_domain` config variables. When providing an array, you
|
||||||
|
* will need to specify the local server URL manually (if needed).
|
||||||
|
*
|
||||||
|
* Example of non-default config (final URLs are generated using Laravel `url` helper):
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* 'servers' => [
|
||||||
|
* 'Live' => 'api',
|
||||||
|
* 'Prod' => 'https://scramble.dedoc.co/api',
|
||||||
|
* ],
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
'servers' => null,
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'web',
|
||||||
|
RestrictedDocsAccess::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'extensions' => [],
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user