Guest User

Untitled

a guest
Oct 20th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.92 KB | None | 0 0
  1. <?php
  2.  
  3. return [
  4.  
  5.     /*
  6.     |--------------------------------------------------------------------------
  7.     | Resolver
  8.     |--------------------------------------------------------------------------
  9.     |
  10.     | The API's resolver is the class that works out the fully qualified
  11.     | class name of adapters, schemas, authorizers and validators for your
  12.     | resource types. We recommend using our default implementation but you
  13.     | can override it here if desired.
  14.     */
  15.     'resolver' => \CloudCreativity\LaravelJsonApi\Resolver\ResolverFactory::class,
  16.  
  17.     /*
  18.     |--------------------------------------------------------------------------
  19.     | Root Namespace
  20.     |--------------------------------------------------------------------------
  21.     |
  22.     | The root namespace for JSON API classes for this API. If `null`, the
  23.     | namespace will default to `JsonApi` within your application's root
  24.     | namespace (obtained via Laravel's `Application::getNamespace()`
  25.     | method).
  26.     |
  27.     | The `by-resource` setting determines how your units are organised within
  28.     | your root namespace.
  29.     |
  30.     | - true:
  31.     |   - e.g. App\JsonApi\Posts\{Adapter, Schema, Validators}
  32.     |   - e.g. App\JsonApi\Comments\{Adapter, Schema, Validators}
  33.     | - false:
  34.     |   - e.g. App\JsonApi\Adapters\PostAdapter, CommentAdapter}
  35.     |   - e.g. App\JsonApi\Schemas\{PostSchema, CommentSchema}
  36.     |   - e.g. App\JsonApi\Validators\{PostValidator, CommentValidator}
  37.     |
  38.     */
  39.     'namespace' => null,
  40.     'by-resource' => true,
  41.  
  42.     /*
  43.     |--------------------------------------------------------------------------
  44.     | Resources
  45.     |--------------------------------------------------------------------------
  46.     |
  47.     | Here you map the list of JSON API resources in your API to the actual
  48.     | record (model/entity) classes they relate to.
  49.     |
  50.     | For example, if you had a `posts` JSON API resource, that related to
  51.     | an Eloquent model `App\Post`, your mapping would be:
  52.     |
  53.     | `'posts' => App\Post::class`
  54.     */
  55.     'resources' => [
  56.         'WalletTransaction' => Modules\Wallet\Entities\Transaction::class,
  57.         'WalletTransactionType' => Modules\Wallet\Entities\TransactionType::class,
  58.         'MarketProduct' => Modules\MarketProduct\Entities\MarketProduct::class,
  59.         'MarketProductPrice' => Modules\MarketProduct\Entities\MarketProductPrice::class,
  60.         'Food' => Modules\Helpers\Entities\Food::class,
  61.         'FirstRes' => Modules\Helpers\Entities\FirstRes::class
  62.     ],
  63.  
  64.     /*
  65.     |--------------------------------------------------------------------------
  66.     | Eloquent
  67.     |--------------------------------------------------------------------------
  68.     |
  69.     | Whether your JSON API resources predominantly relate to Eloquent models.
  70.     | This is used by the package's generators.
  71.     |
  72.     | You can override the setting here when running a generator. If the
  73.     | setting here is `true` running a generator with `--no-eloquent` will
  74.     | override it; if the setting is `false`, then `--eloquent` is the override.
  75.     |
  76.     */
  77.     'use-eloquent' => true,
  78.  
  79.     /*
  80.     |--------------------------------------------------------------------------
  81.     | URL
  82.     |--------------------------------------------------------------------------
  83.     |
  84.     | The API's url, made up of a host, URL namespace and route name prefix.
  85.     |
  86.     | If a JSON API is handling an inbound request, the host will always be
  87.     | detected from the inbound HTTP request. In other circumstances
  88.     | (e.g. broadcasting), the host will be taken from the setting here.
  89.     | If it is `null`, the `app.url` config setting is used as the default.
  90.     | If you set `host` to `false`, the host will never be appended to URLs
  91.     | for inbound requests.
  92.     |
  93.     | The name setting is the prefix for route names within this API.
  94.     |
  95.     */
  96.     'url' => [
  97.         'host' => null,
  98.         'namespace' => '/api/v1',
  99.         'name' => 'api:v1:',
  100.     ],
  101.  
  102.     /*
  103.     |--------------------------------------------------------------------------
  104.     | Controllers
  105.     |--------------------------------------------------------------------------
  106.     |
  107.     | The default JSON API controller wraps write operations in transactions.
  108.     | You can customise the connection for the transaction here. Or if you
  109.     | want to turn transactions off, set `transactions` to `false`.
  110.     |
  111.     */
  112.     'controllers' => [
  113.         'transactions' => true,
  114.         'connection' => null,
  115.     ],
  116.  
  117.     /*
  118.     |--------------------------------------------------------------------------
  119.     | Jobs
  120.     |--------------------------------------------------------------------------
  121.     |
  122.     | Defines settings for the asynchronous processing feature. We recommend
  123.     | referring to the documentation on asynchronous processing if you are
  124.     | using this feature.
  125.     |
  126.     | Note that if you use a different model class, it must implement the
  127.     | asynchronous process interface.
  128.     |
  129.     */
  130.     'jobs' => [
  131.         'resource' => 'queue-jobs',
  132.         'model' => \CloudCreativity\LaravelJsonApi\Queue\ClientJob::class,
  133.     ],
  134.  
  135.     /*
  136.     |--------------------------------------------------------------------------
  137.     | Supported JSON API Extensions
  138.     |--------------------------------------------------------------------------
  139.     |
  140.     | Refer to the JSON API spec for information on supported extensions.
  141.     |
  142.     */
  143.     'supported-ext' => null,
  144.  
  145.     /*
  146.     |--------------------------------------------------------------------------
  147.     | Encoding Media Types
  148.     |--------------------------------------------------------------------------
  149.     |
  150.     | This defines the JSON API encoding used for particular media
  151.     | types supported by your API. This array can contain either
  152.     | media types as values, or can be keyed by a media type with the value
  153.     | being the options that are passed to the `json_encode` method.
  154.     |
  155.     | These values are also used for Content Negotiation. If a client requests
  156.     | via the HTTP Accept header a media type that is not listed here,
  157.     | a 406 Not Acceptable response will be sent.
  158.     |
  159.     | If you want to support media types that do not return responses with JSON
  160.     | API encoded data, you can do this at runtime. Refer to the
  161.     | Content Negotiation chapter in the docs for details.
  162.     |
  163.     */
  164.     'encoding' => [
  165.         'application/vnd.api+json',
  166.     ],
  167.  
  168.     /*
  169.     |--------------------------------------------------------------------------
  170.     | Decoding Media Types
  171.     |--------------------------------------------------------------------------
  172.     |
  173.     | This defines the media types that your API can receive from clients.
  174.     | This array is keyed by expected media types, with the value being the
  175.     | service binding that decodes the media type.
  176.     |
  177.     | These values are also used for Content Negotiation. If a client sends
  178.     | a content type not listed here, it will receive a
  179.     | 415 Unsupported Media Type response.
  180.     |
  181.     | Decoders can also be calculated at runtime, and/or you can add support
  182.     | for media types for specific resources or requests. Refer to the
  183.     | Content Negotiation chapter in the docs for details.
  184.     |
  185.     */
  186.     'decoding' => [
  187.         'application/vnd.api+json',
  188.     ],
  189.  
  190.     /*
  191.     |--------------------------------------------------------------------------
  192.     | Providers
  193.     |--------------------------------------------------------------------------
  194.     |
  195.     | Providers allow vendor packages to include resources in your API. E.g.
  196.     | a Shopping Cart vendor package might define the `orders` and `payments`
  197.     | JSON API resources.
  198.     |
  199.     | A package author will define a provider class in their package that you
  200.     | can add here. E.g. for our shopping cart example, the provider could be
  201.     | `Vendor\ShoppingCart\JsonApi\ResourceProvider`.
  202.     |
  203.     */
  204.     'providers' => [],
  205.  
  206. ];
Advertisement
Add Comment
Please, Sign In to add comment