Browse Source

Copy and paste is not a design pattern

pull/3/head
Mohammad Akbari 4 years ago
parent
commit
035bc77e27
Signed by: akbarjimi GPG Key ID: 55726AEFECE5E683
  1. 8
      app/Providers/RouteServiceProvider.php
  2. 7
      bootstrap/app.php
  3. 18
      config/cors.php
  4. 40
      config/cors.php.laravel
  5. 14
      config/cors.php.lumen
  6. 2
      database/migrations/2020_08_18_085017_fingerprints.php

8
app/Providers/RouteServiceProvider.php

@ -38,14 +38,14 @@ class RouteServiceProvider extends ServiceProvider
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
Route::prefix('user/v1')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
// Route::middleware('web')
// ->namespace($this->namespace)
// ->group(base_path('routes/web.php'));
});
}

7
bootstrap/app.php

@ -52,11 +52,4 @@ $app->singleton(
|
*/
$app->router->group([
'namespace' => 'App\Http\Controllers',
'prefix' => '/user/v1/'
], function ($router) {
require __DIR__.'/../routes/api.php';
});
return $app;

18
config/cors.php

@ -1,27 +1,13 @@
<?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/*', 'sanctum/csrf-cookie'],
'paths' => ['user/v1/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => ['Content-Type', 'X-Requested-With'],
'allowedOriginsPatterns' => ['Content-Type', 'X-Requested-With'],
'allowed_headers' => ['*'],

40
config/cors.php.laravel

@ -1,59 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS Options
|--------------------------------------------------------------------------
|
| The allowed_methods and allowed_headers options are case-insensitive.
|
| You don't need to provide both allowed_origins and allowed_origins_patterns.
| If one of the strings passed matches, it is considered a valid origin.
|
| If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
| all methods / origins / headers are allowed.
|
*/
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => ['/*'],
/*
* Matches the request method. `['*']` allows all methods.
*/
'allowed_methods' => ['*'],
/*
* Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
*/
'allowed_origins' => ['*'],
/*
* Patterns that can be used with `preg_match` to match the origin.
*/
'allowedOriginsPatterns' => ['Content-Type', 'X-Requested-With'],
/*
* Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
*/
'allowed_headers' => ['*'],
/*
* Sets the Access-Control-Expose-Headers response header with these headers.
*/
'exposed_headers' => [],
/*
* Sets the Access-Control-Max-Age response header when > 0.
*/
'max_age' => 0,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials' => false,
];

14
config/cors.php.lumen

@ -1,20 +1,6 @@
<?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/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],

2
database/migrations/2020_08_18_085017_fingerprints.php

@ -22,7 +22,7 @@ class Fingerprints extends Migration
$table->decimal('latitude', 10, 4);
$table->decimal('longitude', 11, 4);
$table->char('token', 60)->unique();
$table->text('fcm_token')->unique()->nullable();
$table->text('fcm_token')->nullable();
$table->timestamps();
});
}

Loading…
Cancel
Save