├── public
├── favicon.ico
├── robots.txt
├── .htaccess
└── index.php
├── tests
├── Unit
│ └── .gitkeep
├── Pest.php
├── TestCase.php
├── CreatesApplication.php
└── Feature
│ └── Http
│ └── Controllers
│ └── V1
│ └── Ping
│ └── ShowControllerTest.php
├── database
├── .gitignore
├── seeders
│ └── DatabaseSeeder.php
├── migrations
│ ├── 2014_10_12_100000_create_password_reset_tokens_table.php
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2019_08_19_000000_create_failed_jobs_table.php
│ └── 2019_12_14_000001_create_personal_access_tokens_table.php
└── factories
│ └── UserFactory.php
├── resources
└── views
│ └── .gitkeep
├── README.md
├── bootstrap
├── cache
│ └── .gitignore
└── app.php
├── storage
├── logs
│ └── .gitignore
├── app
│ ├── public
│ │ └── .gitignore
│ └── .gitignore
└── framework
│ ├── testing
│ └── .gitignore
│ ├── views
│ └── .gitignore
│ ├── cache
│ ├── data
│ │ └── .gitignore
│ └── .gitignore
│ ├── sessions
│ └── .gitignore
│ └── .gitignore
├── pint.json
├── lang
└── en
│ ├── messages.php
│ ├── pagination.php
│ ├── auth.php
│ ├── passwords.php
│ └── validation.php
├── routes
├── api.php
├── v1
│ ├── ping.php
│ └── api.php
└── auth.php
├── .gitattributes
├── .gitignore
├── app
├── Http
│ ├── Responses
│ │ ├── V1
│ │ │ ├── MessageResponse.php
│ │ │ ├── ModelResponse.php
│ │ │ └── CollectionResponse.php
│ │ ├── ApiErrorResponse.php
│ │ └── Concerns
│ │ │ └── ReturnsJsonResponse.php
│ ├── Controllers
│ │ ├── Controller.php
│ │ ├── V1
│ │ │ └── Ping
│ │ │ │ └── ShowController.php
│ │ └── Auth
│ │ │ ├── EmailVerificationNotificationController.php
│ │ │ ├── AuthenticatedSessionController.php
│ │ │ ├── VerifyEmailController.php
│ │ │ ├── RegisteredUserController.php
│ │ │ ├── PasswordResetLinkController.php
│ │ │ └── NewPasswordController.php
│ ├── Middleware
│ │ ├── EncryptCookies.php
│ │ ├── VerifyCsrfToken.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── TrimStrings.php
│ │ ├── TrustHosts.php
│ │ ├── Authenticate.php
│ │ ├── ValidateSignature.php
│ │ ├── TrustProxies.php
│ │ ├── JsonApiResponseMiddleware.php
│ │ ├── EnsureEmailIsVerified.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── CacheHeaders.php
│ ├── Resources
│ │ └── V1
│ │ │ ├── MessageResource.php
│ │ │ └── UserResource.php
│ ├── Kernel.php
│ └── Requests
│ │ └── Auth
│ │ └── LoginRequest.php
├── Enum
│ └── Error.php
├── Providers
│ ├── BroadcastServiceProvider.php
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Console
│ └── Kernel.php
├── Exceptions
│ └── Handler.php
└── Models
│ └── User.php
├── .editorconfig
├── phpstan.neon
├── config
├── treblle.php
├── cors.php
├── services.php
├── view.php
├── hashing.php
├── sanctum.php
├── broadcasting.php
├── filesystems.php
├── queue.php
├── cache.php
├── mail.php
├── logging.php
├── auth.php
├── database.php
├── session.php
└── app.php
├── phpunit.xml
├── .env.example
├── artisan
├── composer.json
└── docker-compose.yml
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/Unit/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite*
2 |
--------------------------------------------------------------------------------
/resources/views/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # API Boilerplate - Laravel
2 |
3 |
--------------------------------------------------------------------------------
/bootstrap/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/framework/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/cache/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/pint.json:
--------------------------------------------------------------------------------
1 | {
2 | "preset": "psr12",
3 | "rules": {
4 | "declare_strict_types": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/lang/en/messages.php:
--------------------------------------------------------------------------------
1 | [
7 | 'online' => 'Service Online',
8 | ],
9 | ];
10 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | compiled.php
2 | config.php
3 | down
4 | events.scanned.php
5 | maintenance.php
6 | routes.php
7 | routes.scanned.php
8 | schedule-*
9 | services.json
10 |
--------------------------------------------------------------------------------
/tests/Pest.php:
--------------------------------------------------------------------------------
1 | in(__DIR__);
9 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | as('v1:')->group(
11 | base_path('routes/v1/api.php'),
12 | );
13 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto eol=lf
2 |
3 | *.blade.php diff=html
4 | *.css diff=css
5 | *.html diff=html
6 | *.md diff=markdown
7 | *.php diff=php
8 |
9 | /.github export-ignore
10 | CHANGELOG.md export-ignore
11 | .styleci.yml export-ignore
12 |
--------------------------------------------------------------------------------
/routes/v1/ping.php:
--------------------------------------------------------------------------------
1 | name('show');
12 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | as('ping:')->group(
11 | base_path('routes/v1/ping.php'),
12 | );
13 |
14 |
15 | require __DIR__ . '/../auth.php';
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.phpunit.cache
2 | /node_modules
3 | /public/build
4 | /public/hot
5 | /public/storage
6 | /storage/*.key
7 | /vendor
8 | .env
9 | .env.backup
10 | .env.production
11 | .phpunit.result.cache
12 | Homestead.json
13 | Homestead.yaml
14 | auth.json
15 | npm-debug.log
16 | yarn-error.log
17 | /.fleet
18 | /.idea
19 | /.vscode
20 |
--------------------------------------------------------------------------------
/app/Http/Responses/V1/MessageResponse.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $except = [
17 | //
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | create([
15 | 'name' => 'Steve McDougall',
16 | 'email' => 'juststevemcd@gmail.com',
17 | ]);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $except = [
17 | //
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | load(__DIR__.'/Commands');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/PreventRequestsDuringMaintenance.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $except = [
17 | //
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrimStrings.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $except = [
17 | 'current_password',
18 | 'password',
19 | 'password_confirmation',
20 | ];
21 | }
22 |
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
20 |
21 | return $app;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustHosts.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | public function hosts(): array
17 | {
18 | return [
19 | $this->allSubdomainsOfApplicationUrl(),
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/Http/Resources/V1/MessageResource.php:
--------------------------------------------------------------------------------
1 | $this->resource['message']
19 | ];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | expectsJson() ? null : route('login');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Http/Resources/V1/UserResource.php:
--------------------------------------------------------------------------------
1 | $this->name,
20 | 'email' => $this->email,
21 | ];
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/Http/Controllers/V1/Ping/ShowController.php:
--------------------------------------------------------------------------------
1 | strval(trans('messages.service.online')),
18 | ],
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/ValidateSignature.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $except = [
17 | // 'fbclid',
18 | // 'utm_campaign',
19 | // 'utm_content',
20 | // 'utm_medium',
21 | // 'utm_source',
22 | // 'utm_term',
23 | ];
24 | }
25 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | reportable(function (Throwable $e) {
25 | dd($e);
26 | });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
19 | 'next' => 'Next »',
20 |
21 | ];
22 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Send Requests To Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php:
--------------------------------------------------------------------------------
1 | string('email')->primary();
14 | $table->string('token');
15 | $table->timestamp('created_at')->nullable();
16 | });
17 | }
18 |
19 | public function down(): void
20 | {
21 | Schema::dropIfExists('password_reset_tokens');
22 | }
23 | };
24 |
--------------------------------------------------------------------------------
/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
19 | 'password' => 'The provided password is incorrect.',
20 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustProxies.php:
--------------------------------------------------------------------------------
1 | |string|null
16 | */
17 | protected $proxies;
18 |
19 | /**
20 | * The headers that should be used to detect proxies.
21 | *
22 | * @var int
23 | */
24 | protected $headers =
25 | Request::HEADER_X_FORWARDED_FOR |
26 | Request::HEADER_X_FORWARDED_HOST |
27 | Request::HEADER_X_FORWARDED_PORT |
28 | Request::HEADER_X_FORWARDED_PROTO |
29 | Request::HEADER_X_FORWARDED_AWS_ELB;
30 | }
31 |
--------------------------------------------------------------------------------
/app/Models/User.php:
--------------------------------------------------------------------------------
1 | 'datetime',
33 | ];
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | uuid('id')->primary();
14 |
15 | $table->string('name');
16 | $table->string('email')->unique();
17 | $table->string('password');
18 |
19 | $table->timestamp('email_verified_at')->nullable();
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | public function down(): void
25 | {
26 | Schema::dropIfExists('users');
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/tests/Feature/Http/Controllers/V1/Ping/ShowControllerTest.php:
--------------------------------------------------------------------------------
1 | assertStatus(
15 | status: Http::OK->value,
16 | );
17 | });
18 |
19 | it('returns the correct payload', function (): void {
20 | getJson(
21 | uri: action(ShowController::class),
22 | )->assertStatus(
23 | status: Http::OK->value,
24 | )->assertJson(
25 | fn (AssertableJson $json) => $json
26 | ->where('message', trans('messages.service.online'))->etc()
27 | );
28 | });
29 |
--------------------------------------------------------------------------------
/app/Http/Middleware/JsonApiResponseMiddleware.php:
--------------------------------------------------------------------------------
1 | headers->set(
26 | key: 'Content-Type',
27 | values: 'application/vnd.api+json',
28 | );
29 |
30 | return $response;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Your password has been reset.',
19 | 'sent' => 'We have emailed your password reset link.',
20 | 'throttled' => 'Please wait before retrying.',
21 | 'token' => 'This password reset token is invalid.',
22 | 'user' => "We can't find a user with that email address.",
23 |
24 | ];
25 |
--------------------------------------------------------------------------------
/database/migrations/2019_08_19_000000_create_failed_jobs_table.php:
--------------------------------------------------------------------------------
1 | id();
14 | $table->string('uuid')->unique();
15 | $table->text('connection');
16 | $table->text('queue');
17 | $table->longText('payload');
18 | $table->longText('exception');
19 | $table->timestamp('failed_at')->useCurrent();
20 | });
21 | }
22 |
23 | public function down(): void
24 | {
25 | Schema::dropIfExists('failed_jobs');
26 | }
27 | };
28 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/EmailVerificationNotificationController.php:
--------------------------------------------------------------------------------
1 | user()->hasVerifiedEmail()) {
21 | return redirect()->intended(RouteServiceProvider::HOME);
22 | }
23 |
24 | $request->user()->sendEmailVerificationNotification();
25 |
26 | return response()->json(['status' => 'verification-link-sent']);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EnsureEmailIsVerified.php:
--------------------------------------------------------------------------------
1 | user() ||
22 | ($request->user() instanceof MustVerifyEmail &&
23 | ! $request->user()->hasVerifiedEmail())) {
24 | return response()->json(['message' => 'Your email address is not verified.'], 409);
25 | }
26 |
27 | return $next($request);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->name(),
19 | 'email' => $this->faker->unique()->safeEmail(),
20 | 'email_verified_at' => now(),
21 | 'password' => Hash::make(
22 | value: 'password',
23 | ),
24 | ];
25 | }
26 |
27 | public function unverified(): UserFactory
28 | {
29 | return $this->state(
30 | state: fn (array $attributes): array => [
31 | 'email_verified_at' => null,
32 | ],
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/Http/Middleware/RedirectIfAuthenticated.php:
--------------------------------------------------------------------------------
1 | check()) {
26 | return redirect(RouteServiceProvider::HOME);
27 | }
28 | }
29 |
30 | return $next($request);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/config/treblle.php:
--------------------------------------------------------------------------------
1 | env('TREBLLE_API_KEY'),
10 |
11 | /*
12 | * A valid Treblle project ID. Create your first project on https://treblle.com/
13 | */
14 | 'project_id' => env('TREBLLE_PROJECT_ID'),
15 |
16 | /*
17 | * Define which environments should Treblle ignore and not monitor
18 | */
19 | 'ignored_environments' => env('TREBLLE_IGNORED_ENV', 'dev,test'),
20 |
21 | /*
22 | * Define which fields should be masked before leaving the server
23 | */
24 | 'masked_fields' => [
25 | 'password',
26 | 'pwd',
27 | 'secret',
28 | 'password_confirmation',
29 | 'cc',
30 | 'card_number',
31 | 'ccv',
32 | 'ssn',
33 | 'credit_score',
34 | 'api_key',
35 | ],
36 | ];
37 |
--------------------------------------------------------------------------------
/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php:
--------------------------------------------------------------------------------
1 | id();
14 |
15 | $table->uuidMorphs('tokenable');
16 | $table->string('name');
17 | $table->string('token', 64)->unique();
18 | $table->text('abilities')->nullable();
19 |
20 | $table->timestamp('last_used_at')->nullable();
21 | $table->timestamp('expires_at')->nullable();
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | public function down(): void
27 | {
28 | Schema::dropIfExists('personal_access_tokens');
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 |
16 | */
17 | protected $policies = [
18 | // 'App\Models\Model' => 'App\Policies\ModelPolicy',
19 | ];
20 |
21 | /**
22 | * Register any authentication / authorization services.
23 | */
24 | public function boot(): void
25 | {
26 | $this->registerPolicies();
27 |
28 | ResetPassword::createUrlUsing(function (object $notifiable, string $token) {
29 | return config('app.frontend_url')."/password-reset/$token?email={$notifiable->getEmailForPasswordReset()}";
30 | });
31 |
32 | //
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/config/cors.php:
--------------------------------------------------------------------------------
1 | ['*'],
21 |
22 | 'allowed_methods' => ['*'],
23 |
24 | 'allowed_origins' => [env('FRONTEND_URL', 'http://localhost:3000')],
25 |
26 | 'allowed_origins_patterns' => [],
27 |
28 | 'allowed_headers' => ['*'],
29 |
30 | 'exposed_headers' => [],
31 |
32 | 'max_age' => 0,
33 |
34 | 'supports_credentials' => true,
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/app/Http/Responses/ApiErrorResponse.php:
--------------------------------------------------------------------------------
1 | $this->title,
28 | 'description' => $this->description,
29 | 'code' => $this->code->value,
30 | 'status' => $this->status->value,
31 | ],
32 | status: $this->status->value,
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/AuthenticatedSessionController.php:
--------------------------------------------------------------------------------
1 | authenticate();
21 |
22 | $request->session()->regenerate();
23 |
24 | return response()->noContent();
25 | }
26 |
27 | /**
28 | * Destroy an authenticated session.
29 | */
30 | public function destroy(Request $request): Response
31 | {
32 | Auth::guard('web')->logout();
33 |
34 | $request->session()->invalidate();
35 |
36 | $request->session()->regenerateToken();
37 |
38 | return response()->noContent();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | >
18 | */
19 | protected $listen = [
20 | Registered::class => [
21 | SendEmailVerificationNotification::class,
22 | ],
23 | ];
24 |
25 | /**
26 | * Register any events for your application.
27 | */
28 | public function boot(): void
29 | {
30 | //
31 | }
32 |
33 | /**
34 | * Determine if events and listeners should be automatically discovered.
35 | */
36 | public function shouldDiscoverEvents(): bool
37 | {
38 | return false;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/Http/Responses/Concerns/ReturnsJsonResponse.php:
--------------------------------------------------------------------------------
1 | data,
30 | status: $this->status->value,
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/VerifyEmailController.php:
--------------------------------------------------------------------------------
1 | user()->hasVerifiedEmail()) {
21 | return redirect()->intended(
22 | config('app.frontend_url').RouteServiceProvider::HOME.'?verified=1'
23 | );
24 | }
25 |
26 | if ($request->user()->markEmailAsVerified()) {
27 | event(new Verified($request->user()));
28 | }
29 |
30 | return redirect()->intended(
31 | config('app.frontend_url').RouteServiceProvider::HOME.'?verified=1'
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
20 | 'domain' => env('MAILGUN_DOMAIN'),
21 | 'secret' => env('MAILGUN_SECRET'),
22 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
23 | 'scheme' => 'https',
24 | ],
25 |
26 | 'postmark' => [
27 | 'token' => env('POSTMARK_TOKEN'),
28 | ],
29 |
30 | 'ses' => [
31 | 'key' => env('AWS_ACCESS_KEY_ID'),
32 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
33 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
34 | ],
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | configureRateLimiting();
18 |
19 | $this->routes(function () {
20 | Route::middleware(['api', 'treblle'])
21 | ->as('api:')
22 | ->group(
23 | base_path('routes/api.php')
24 | );
25 | });
26 | }
27 |
28 | protected function configureRateLimiting(): void
29 | {
30 | RateLimiter::for(
31 | name: 'api',
32 | callback: static fn (Request $request): Limit => Limit::perMinute(
33 | maxAttempts: 60,
34 | )->by(
35 | key: $request->user()?->id ?: $request->ip(),
36 | ),
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 | ./tests/Unit
11 |
12 |
13 | ./tests/Feature
14 |
15 |
16 |
17 |
18 | ./app
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
19 | resource_path('views'),
20 | ],
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Compiled View Path
25 | |--------------------------------------------------------------------------
26 | |
27 | | This option determines where all the compiled Blade templates will be
28 | | stored for your application. Typically, this is within the storage
29 | | directory. However, as usual, you are free to change this value.
30 | |
31 | */
32 |
33 | 'compiled' => env(
34 | 'VIEW_COMPILED_PATH',
35 | realpath(storage_path('framework/views'))
36 | ),
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_URL=http://localhost
6 |
7 | LOG_CHANNEL=stack
8 | LOG_DEPRECATIONS_CHANNEL=null
9 | LOG_LEVEL=debug
10 |
11 | DB_CONNECTION=mysql
12 | DB_HOST=127.0.0.1
13 | DB_PORT=3306
14 | DB_DATABASE=api_boilerplate_laravel
15 | DB_USERNAME=root
16 | DB_PASSWORD=
17 |
18 | BROADCAST_DRIVER=log
19 | CACHE_DRIVER=file
20 | FILESYSTEM_DISK=local
21 | QUEUE_CONNECTION=sync
22 | SESSION_DRIVER=file
23 | SESSION_LIFETIME=120
24 |
25 | MEMCACHED_HOST=127.0.0.1
26 |
27 | REDIS_HOST=127.0.0.1
28 | REDIS_PASSWORD=null
29 | REDIS_PORT=6379
30 |
31 | MAIL_MAILER=smtp
32 | MAIL_HOST=mailpit
33 | MAIL_PORT=1025
34 | MAIL_USERNAME=null
35 | MAIL_PASSWORD=null
36 | MAIL_ENCRYPTION=null
37 | MAIL_FROM_ADDRESS="hello@example.com"
38 | MAIL_FROM_NAME="${APP_NAME}"
39 |
40 | AWS_ACCESS_KEY_ID=
41 | AWS_SECRET_ACCESS_KEY=
42 | AWS_DEFAULT_REGION=us-east-1
43 | AWS_BUCKET=
44 | AWS_USE_PATH_STYLE_ENDPOINT=false
45 |
46 | PUSHER_APP_ID=
47 | PUSHER_APP_KEY=
48 | PUSHER_APP_SECRET=
49 | PUSHER_HOST=
50 | PUSHER_PORT=443
51 | PUSHER_SCHEME=https
52 | PUSHER_APP_CLUSTER=mt1
53 |
54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
55 | VITE_PUSHER_HOST="${PUSHER_HOST}"
56 | VITE_PUSHER_PORT="${PUSHER_PORT}"
57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
59 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/RegisteredUserController.php:
--------------------------------------------------------------------------------
1 | validate([
26 | 'name' => ['required', 'string', 'max:255'],
27 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
28 | 'password' => ['required', 'confirmed', Rules\Password::defaults()],
29 | ]);
30 |
31 | $user = User::create([
32 | 'name' => $request->name,
33 | 'email' => $request->email,
34 | 'password' => Hash::make($request->password),
35 | ]);
36 |
37 | event(new Registered($user));
38 |
39 | Auth::login($user);
40 |
41 | return response()->noContent();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/Http/Middleware/CacheHeaders.php:
--------------------------------------------------------------------------------
1 | setCache(
23 | options: [
24 | 'private' => true,
25 | 'max_age' => 0,
26 | 's_maxage' => 0,
27 | 'no_store' => true
28 | ],
29 | );
30 | } else {
31 | $response->setCache(
32 | options: [
33 | 'public' => true,
34 | 'max_age' => 60,
35 | 's_maxage' => 60,
36 | ],
37 | );
38 |
39 | foreach ($response->headers->getCookies() as $cookie) {
40 | $response->headers->removeCookie(
41 | name: $cookie->getName(),
42 | );
43 | }
44 | }
45 |
46 | return $response;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/PasswordResetLinkController.php:
--------------------------------------------------------------------------------
1 | validate([
23 | 'email' => ['required', 'email'],
24 | ]);
25 |
26 | // We will send the password reset link to this user. Once we have attempted
27 | // to send the link, we will examine the response then see the message we
28 | // need to show to the user. Finally, we'll send out a proper response.
29 | $status = Password::sendResetLink(
30 | $request->only('email')
31 | );
32 |
33 | if ($status != Password::RESET_LINK_SENT) {
34 | throw ValidationException::withMessages([
35 | 'email' => [__($status)],
36 | ]);
37 | }
38 |
39 | return response()->json(['status' => __($status)]);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/routes/auth.php:
--------------------------------------------------------------------------------
1 | middleware('guest')
15 | ->name('register');
16 |
17 | Route::post('/login', [AuthenticatedSessionController::class, 'store'])
18 | ->middleware('guest')
19 | ->name('login');
20 |
21 | Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
22 | ->middleware('guest')
23 | ->name('password.email');
24 |
25 | Route::post('/reset-password', [NewPasswordController::class, 'store'])
26 | ->middleware('guest')
27 | ->name('password.store');
28 |
29 | Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)
30 | ->middleware(['auth', 'signed', 'throttle:6,1'])
31 | ->name('verification.verify');
32 |
33 | Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
34 | ->middleware(['auth', 'throttle:6,1'])
35 | ->name('verification.send');
36 |
37 | Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
38 | ->middleware('auth')
39 | ->name('logout');
40 |
--------------------------------------------------------------------------------
/config/hashing.php:
--------------------------------------------------------------------------------
1 | 'bcrypt',
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Bcrypt Options
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may specify the configuration options that should be used when
28 | | passwords are hashed using the Bcrypt algorithm. This will allow you
29 | | to control the amount of time it takes to hash the given password.
30 | |
31 | */
32 |
33 | 'bcrypt' => [
34 | 'rounds' => env('BCRYPT_ROUNDS', 10),
35 | ],
36 |
37 | /*
38 | |--------------------------------------------------------------------------
39 | | Argon Options
40 | |--------------------------------------------------------------------------
41 | |
42 | | Here you may specify the configuration options that should be used when
43 | | passwords are hashed using the Argon algorithm. These will allow you
44 | | to control the amount of time it takes to hash the given password.
45 | |
46 | */
47 |
48 | 'argon' => [
49 | 'memory' => 65536,
50 | 'threads' => 1,
51 | 'time' => 4,
52 | ],
53 |
54 | ];
55 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
32 | Illuminate\Contracts\Http\Kernel::class,
33 | App\Http\Kernel::class
34 | );
35 |
36 | $app->singleton(
37 | Illuminate\Contracts\Console\Kernel::class,
38 | App\Console\Kernel::class
39 | );
40 |
41 | $app->singleton(
42 | Illuminate\Contracts\Debug\ExceptionHandler::class,
43 | App\Exceptions\Handler::class
44 | );
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Return The Application
49 | |--------------------------------------------------------------------------
50 | |
51 | | This script returns the application instance. The instance is given to
52 | | the calling script so we can separate the building of the instances
53 | | from the actual running of the application and sending responses.
54 | |
55 | */
56 |
57 | return $app;
58 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
34 |
35 | $status = $kernel->handle(
36 | $input = new Symfony\Component\Console\Input\ArgvInput,
37 | new Symfony\Component\Console\Output\ConsoleOutput
38 | );
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Shutdown The Application
43 | |--------------------------------------------------------------------------
44 | |
45 | | Once Artisan has finished running, we will fire off the shutdown events
46 | | so that any final work may be done by the application before we shut
47 | | down the process. This is the last thing to happen to the request.
48 | |
49 | */
50 |
51 | $kernel->terminate($input, $status);
52 |
53 | exit($status);
54 |
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class);
52 |
53 | $response = $kernel->handle(
54 | $request = Request::capture()
55 | )->send();
56 |
57 | $kernel->terminate($request, $response);
58 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/NewPasswordController.php:
--------------------------------------------------------------------------------
1 | validate([
27 | 'token' => ['required'],
28 | 'email' => ['required', 'email'],
29 | 'password' => ['required', 'confirmed', Rules\Password::defaults()],
30 | ]);
31 |
32 | // Here we will attempt to reset the user's password. If it is successful we
33 | // will update the password on an actual user model and persist it to the
34 | // database. Otherwise we will parse the error and return the response.
35 | $status = Password::reset(
36 | $request->only('email', 'password', 'password_confirmation', 'token'),
37 | function ($user) use ($request) {
38 | $user->forceFill([
39 | 'password' => Hash::make($request->password),
40 | 'remember_token' => Str::random(60),
41 | ])->save();
42 |
43 | event(new PasswordReset($user));
44 | }
45 | );
46 |
47 | if ($status != Password::PASSWORD_RESET) {
48 | throw ValidationException::withMessages([
49 | 'email' => [__($status)],
50 | ]);
51 | }
52 |
53 | return response()->json(['status' => __($status)]);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/config/sanctum.php:
--------------------------------------------------------------------------------
1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
19 | '%s%s%s',
20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
21 | env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '',
22 | env('FRONTEND_URL') ? ','.parse_url(env('FRONTEND_URL'), PHP_URL_HOST) : ''
23 | ))),
24 |
25 | /*
26 | |--------------------------------------------------------------------------
27 | | Expiration Minutes
28 | |--------------------------------------------------------------------------
29 | |
30 | | This value controls the number of minutes until an issued token will be
31 | | considered expired. If this value is null, personal access tokens do
32 | | not expire. This won't tweak the lifetime of first-party sessions.
33 | |
34 | */
35 |
36 | 'expiration' => null,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Sanctum Middleware
41 | |--------------------------------------------------------------------------
42 | |
43 | | When authenticating your first-party SPA with Sanctum you may need to
44 | | customize some of the middleware Sanctum uses while processing the
45 | | request. You may change the middleware listed below as required.
46 | |
47 | */
48 |
49 | 'middleware' => [
50 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
51 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
52 | ],
53 |
54 | ];
55 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'null'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Broadcast Connections
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may define all of the broadcast connections that will be used
28 | | to broadcast events to other systems or over websockets. Samples of
29 | | each available type of connection are provided inside this array.
30 | |
31 | */
32 |
33 | 'connections' => [
34 |
35 | 'pusher' => [
36 | 'driver' => 'pusher',
37 | 'key' => env('PUSHER_APP_KEY'),
38 | 'secret' => env('PUSHER_APP_SECRET'),
39 | 'app_id' => env('PUSHER_APP_ID'),
40 | 'options' => [
41 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
42 | 'port' => env('PUSHER_PORT', 443),
43 | 'scheme' => env('PUSHER_SCHEME', 'https'),
44 | 'encrypted' => true,
45 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
46 | ],
47 | 'client_options' => [
48 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
49 | ],
50 | ],
51 |
52 | 'ably' => [
53 | 'driver' => 'ably',
54 | 'key' => env('ABLY_KEY'),
55 | ],
56 |
57 | 'redis' => [
58 | 'driver' => 'redis',
59 | 'connection' => 'default',
60 | ],
61 |
62 | 'log' => [
63 | 'driver' => 'log',
64 | ],
65 |
66 | 'null' => [
67 | 'driver' => 'null',
68 | ],
69 |
70 | ],
71 |
72 | ];
73 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [],
43 |
44 | 'api' => [
45 | EnsureFrontendRequestsAreStateful::class,
46 | ThrottleRequests::class.':api',
47 | SubstituteBindings::class,
48 | JsonApiResponseMiddleware::class,
49 | CacheHeaders::class,
50 | ],
51 | ];
52 |
53 | protected $middlewareAliases = [
54 | 'auth' => Authenticate::class,
55 | 'auth.basic' => AuthenticateWithBasicAuth::class,
56 | 'auth.session' => AuthenticateSession::class,
57 | 'cache.headers' => SetCacheHeaders::class,
58 | 'can' => Authorize::class,
59 | 'guest' => RedirectIfAuthenticated::class,
60 | 'password.confirm' => RequirePassword::class,
61 | 'signed' => ValidateSignature::class,
62 | 'throttle' => ThrottleRequests::class,
63 | 'verified' => EnsureEmailIsVerified::class,
64 | ];
65 | }
66 |
--------------------------------------------------------------------------------
/app/Http/Requests/Auth/LoginRequest.php:
--------------------------------------------------------------------------------
1 |
28 | */
29 | public function rules(): array
30 | {
31 | return [
32 | 'email' => ['required', 'string', 'email'],
33 | 'password' => ['required', 'string'],
34 | ];
35 | }
36 |
37 | /**
38 | * Attempt to authenticate the request's credentials.
39 | *
40 | * @throws \Illuminate\Validation\ValidationException
41 | */
42 | public function authenticate(): void
43 | {
44 | $this->ensureIsNotRateLimited();
45 |
46 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
47 | RateLimiter::hit($this->throttleKey());
48 |
49 | throw ValidationException::withMessages([
50 | 'email' => __('auth.failed'),
51 | ]);
52 | }
53 |
54 | RateLimiter::clear($this->throttleKey());
55 | }
56 |
57 | /**
58 | * Ensure the login request is not rate limited.
59 | *
60 | * @throws \Illuminate\Validation\ValidationException
61 | */
62 | public function ensureIsNotRateLimited(): void
63 | {
64 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
65 | return;
66 | }
67 |
68 | event(new Lockout($this));
69 |
70 | $seconds = RateLimiter::availableIn($this->throttleKey());
71 |
72 | throw ValidationException::withMessages([
73 | 'email' => trans('auth.throttle', [
74 | 'seconds' => $seconds,
75 | 'minutes' => ceil($seconds / 60),
76 | ]),
77 | ]);
78 | }
79 |
80 | /**
81 | * Get the rate limiting throttle key for the request.
82 | */
83 | public function throttleKey(): string
84 | {
85 | return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip());
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/laravel",
3 | "type": "project",
4 | "description": "The Laravel Framework.",
5 | "keywords": ["framework", "laravel"],
6 | "license": "MIT",
7 | "require": {
8 | "php": "^8.2",
9 | "guzzlehttp/guzzle": "^7.5",
10 | "juststeveking/http-status-code": "^3.0",
11 | "laravel/breeze": "^1.19.2",
12 | "laravel/framework": "^10.2",
13 | "laravel/sanctum": "^3.2.1",
14 | "laravel/tinker": "^2.8.1",
15 | "timacdonald/json-api": "v1.0.0-beta.4",
16 | "treblle/treblle-laravel": "^2.8"
17 | },
18 | "require-dev": {
19 | "fakerphp/faker": "^1.21.0",
20 | "laravel/pint": "^1.6",
21 | "laravel/sail": "^1.21.1",
22 | "mockery/mockery": "^1.5.1",
23 | "nunomaduro/collision": "^6.4",
24 | "nunomaduro/larastan": "^2.5",
25 | "pestphp/pest": "^1.22.5",
26 | "pestphp/pest-plugin-laravel": "^1.4",
27 | "spatie/laravel-ignition": "^2.0"
28 | },
29 | "autoload": {
30 | "psr-4": {
31 | "App\\": "app/",
32 | "Database\\Factories\\": "database/factories/",
33 | "Database\\Seeders\\": "database/seeders/"
34 | }
35 | },
36 | "autoload-dev": {
37 | "psr-4": {
38 | "Tests\\": "tests/"
39 | }
40 | },
41 | "scripts": {
42 | "post-autoload-dump": [
43 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
44 | "@php artisan package:discover --ansi"
45 | ],
46 | "post-update-cmd": [
47 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
48 | ],
49 | "post-root-package-install": [
50 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
51 | ],
52 | "post-create-project-cmd": [
53 | "@php artisan key:generate --ansi"
54 | ],
55 | "pint": [
56 | "./vendor/bin/pint"
57 | ],
58 | "stan": [
59 | "./vendor/bin/phpstan analyse"
60 | ],
61 | "test": [
62 | "@php artisan test"
63 | ]
64 | },
65 | "extra": {
66 | "laravel": {
67 | "dont-discover": []
68 | }
69 | },
70 | "config": {
71 | "optimize-autoloader": true,
72 | "preferred-install": "dist",
73 | "sort-packages": true,
74 | "allow-plugins": {
75 | "pestphp/pest-plugin": true,
76 | "php-http/discovery": true
77 | }
78 | },
79 | "minimum-stability": "stable",
80 | "prefer-stable": true
81 | }
82 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | laravel.test:
4 | build:
5 | context: ./vendor/laravel/sail/runtimes/8.2
6 | dockerfile: Dockerfile
7 | args:
8 | WWWGROUP: '${WWWGROUP}'
9 | image: sail-8.2/app
10 | extra_hosts:
11 | - 'host.docker.internal:host-gateway'
12 | ports:
13 | - '${APP_PORT:-80}:80'
14 | - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
15 | environment:
16 | WWWUSER: '${WWWUSER}'
17 | LARAVEL_SAIL: 1
18 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
19 | XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
20 | volumes:
21 | - '.:/var/www/html'
22 | networks:
23 | - sail
24 | depends_on:
25 | - pgsql
26 | - redis
27 | - mailpit
28 | pgsql:
29 | image: 'postgres:15'
30 | ports:
31 | - '${FORWARD_DB_PORT:-5432}:5432'
32 | environment:
33 | PGPASSWORD: '${DB_PASSWORD:-secret}'
34 | POSTGRES_DB: '${DB_DATABASE}'
35 | POSTGRES_USER: '${DB_USERNAME}'
36 | POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
37 | volumes:
38 | - 'sail-pgsql:/var/lib/postgresql/data'
39 | - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'
40 | networks:
41 | - sail
42 | healthcheck:
43 | test:
44 | - CMD
45 | - pg_isready
46 | - '-q'
47 | - '-d'
48 | - '${DB_DATABASE}'
49 | - '-U'
50 | - '${DB_USERNAME}'
51 | retries: 3
52 | timeout: 5s
53 | redis:
54 | image: 'redis:alpine'
55 | ports:
56 | - '${FORWARD_REDIS_PORT:-6379}:6379'
57 | volumes:
58 | - 'sail-redis:/data'
59 | networks:
60 | - sail
61 | healthcheck:
62 | test:
63 | - CMD
64 | - redis-cli
65 | - ping
66 | retries: 3
67 | timeout: 5s
68 | mailpit:
69 | image: 'axllent/mailpit:latest'
70 | ports:
71 | - '${FORWARD_MAILPIT_PORT:-1025}:1025'
72 | - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025'
73 | networks:
74 | - sail
75 | networks:
76 | sail:
77 | driver: bridge
78 | volumes:
79 | sail-pgsql:
80 | driver: local
81 | sail-redis:
82 | driver: local
83 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | env('FILESYSTEM_DISK', 'local'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Filesystem Disks
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure as many filesystem "disks" as you wish, and you
26 | | may even configure multiple disks of the same driver. Defaults have
27 | | been set up for each driver as an example of the required values.
28 | |
29 | | Supported Drivers: "local", "ftp", "sftp", "s3"
30 | |
31 | */
32 |
33 | 'disks' => [
34 |
35 | 'local' => [
36 | 'driver' => 'local',
37 | 'root' => storage_path('app'),
38 | 'throw' => false,
39 | ],
40 |
41 | 'public' => [
42 | 'driver' => 'local',
43 | 'root' => storage_path('app/public'),
44 | 'url' => env('APP_URL').'/storage',
45 | 'visibility' => 'public',
46 | 'throw' => false,
47 | ],
48 |
49 | 's3' => [
50 | 'driver' => 's3',
51 | 'key' => env('AWS_ACCESS_KEY_ID'),
52 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
53 | 'region' => env('AWS_DEFAULT_REGION'),
54 | 'bucket' => env('AWS_BUCKET'),
55 | 'url' => env('AWS_URL'),
56 | 'endpoint' => env('AWS_ENDPOINT'),
57 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
58 | 'throw' => false,
59 | ],
60 |
61 | ],
62 |
63 | /*
64 | |--------------------------------------------------------------------------
65 | | Symbolic Links
66 | |--------------------------------------------------------------------------
67 | |
68 | | Here you may configure the symbolic links that will be created when the
69 | | `storage:link` Artisan command is executed. The array keys should be
70 | | the locations of the links and the values should be their targets.
71 | |
72 | */
73 |
74 | 'links' => [
75 | public_path('storage') => storage_path('app/public'),
76 | ],
77 |
78 | ];
79 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_CONNECTION', 'sync'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Queue Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure the connection information for each server that
26 | | is used by your application. A default configuration has been added
27 | | for each back-end shipped with Laravel. You are free to add more.
28 | |
29 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
30 | |
31 | */
32 |
33 | 'connections' => [
34 |
35 | 'sync' => [
36 | 'driver' => 'sync',
37 | ],
38 |
39 | 'database' => [
40 | 'driver' => 'database',
41 | 'table' => 'jobs',
42 | 'queue' => 'default',
43 | 'retry_after' => 90,
44 | 'after_commit' => false,
45 | ],
46 |
47 | 'beanstalkd' => [
48 | 'driver' => 'beanstalkd',
49 | 'host' => 'localhost',
50 | 'queue' => 'default',
51 | 'retry_after' => 90,
52 | 'block_for' => 0,
53 | 'after_commit' => false,
54 | ],
55 |
56 | 'sqs' => [
57 | 'driver' => 'sqs',
58 | 'key' => env('AWS_ACCESS_KEY_ID'),
59 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
60 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
61 | 'queue' => env('SQS_QUEUE', 'default'),
62 | 'suffix' => env('SQS_SUFFIX'),
63 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
64 | 'after_commit' => false,
65 | ],
66 |
67 | 'redis' => [
68 | 'driver' => 'redis',
69 | 'connection' => 'default',
70 | 'queue' => env('REDIS_QUEUE', 'default'),
71 | 'retry_after' => 90,
72 | 'block_for' => null,
73 | 'after_commit' => false,
74 | ],
75 |
76 | ],
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | Failed Queue Jobs
81 | |--------------------------------------------------------------------------
82 | |
83 | | These options configure the behavior of failed queue job logging so you
84 | | can control which database and table are used to store the jobs that
85 | | have failed. You may change them to any database / table you wish.
86 | |
87 | */
88 |
89 | 'failed' => [
90 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
91 | 'database' => env('DB_CONNECTION', 'mysql'),
92 | 'table' => 'failed_jobs',
93 | ],
94 |
95 | ];
96 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Cache Stores
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may define all of the cache "stores" for your application as
28 | | well as their drivers. You may even define multiple stores for the
29 | | same cache driver to group types of items stored in your caches.
30 | |
31 | | Supported drivers: "apc", "array", "database", "file",
32 | | "memcached", "redis", "dynamodb", "octane", "null"
33 | |
34 | */
35 |
36 | 'stores' => [
37 |
38 | 'apc' => [
39 | 'driver' => 'apc',
40 | ],
41 |
42 | 'array' => [
43 | 'driver' => 'array',
44 | 'serialize' => false,
45 | ],
46 |
47 | 'database' => [
48 | 'driver' => 'database',
49 | 'table' => 'cache',
50 | 'connection' => null,
51 | 'lock_connection' => null,
52 | ],
53 |
54 | 'file' => [
55 | 'driver' => 'file',
56 | 'path' => storage_path('framework/cache/data'),
57 | ],
58 |
59 | 'memcached' => [
60 | 'driver' => 'memcached',
61 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
62 | 'sasl' => [
63 | env('MEMCACHED_USERNAME'),
64 | env('MEMCACHED_PASSWORD'),
65 | ],
66 | 'options' => [
67 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
68 | ],
69 | 'servers' => [
70 | [
71 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
72 | 'port' => env('MEMCACHED_PORT', 11211),
73 | 'weight' => 100,
74 | ],
75 | ],
76 | ],
77 |
78 | 'redis' => [
79 | 'driver' => 'redis',
80 | 'connection' => 'cache',
81 | 'lock_connection' => 'default',
82 | ],
83 |
84 | 'dynamodb' => [
85 | 'driver' => 'dynamodb',
86 | 'key' => env('AWS_ACCESS_KEY_ID'),
87 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
88 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
89 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
90 | 'endpoint' => env('DYNAMODB_ENDPOINT'),
91 | ],
92 |
93 | 'octane' => [
94 | 'driver' => 'octane',
95 | ],
96 |
97 | ],
98 |
99 | /*
100 | |--------------------------------------------------------------------------
101 | | Cache Key Prefix
102 | |--------------------------------------------------------------------------
103 | |
104 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache
105 | | stores there might be other applications using the same cache. For
106 | | that reason, you may prefix every cache key to avoid collisions.
107 | |
108 | */
109 |
110 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
111 |
112 | ];
113 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_MAILER', 'smtp'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Mailer Configurations
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure all of the mailers used by your application plus
26 | | their respective settings. Several examples have been configured for
27 | | you and you are free to add your own as your application requires.
28 | |
29 | | Laravel supports a variety of mail "transport" drivers to be used while
30 | | sending an e-mail. You will specify which one you are using for your
31 | | mailers below. You are free to add additional mailers as required.
32 | |
33 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
34 | | "postmark", "log", "array", "failover"
35 | |
36 | */
37 |
38 | 'mailers' => [
39 | 'smtp' => [
40 | 'transport' => 'smtp',
41 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
42 | 'port' => env('MAIL_PORT', 587),
43 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
44 | 'username' => env('MAIL_USERNAME'),
45 | 'password' => env('MAIL_PASSWORD'),
46 | 'timeout' => null,
47 | 'local_domain' => env('MAIL_EHLO_DOMAIN'),
48 | ],
49 |
50 | 'ses' => [
51 | 'transport' => 'ses',
52 | ],
53 |
54 | 'mailgun' => [
55 | 'transport' => 'mailgun',
56 | // 'client' => [
57 | // 'timeout' => 5,
58 | // ],
59 | ],
60 |
61 | 'postmark' => [
62 | 'transport' => 'postmark',
63 | // 'client' => [
64 | // 'timeout' => 5,
65 | // ],
66 | ],
67 |
68 | 'sendmail' => [
69 | 'transport' => 'sendmail',
70 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
71 | ],
72 |
73 | 'log' => [
74 | 'transport' => 'log',
75 | 'channel' => env('MAIL_LOG_CHANNEL'),
76 | ],
77 |
78 | 'array' => [
79 | 'transport' => 'array',
80 | ],
81 |
82 | 'failover' => [
83 | 'transport' => 'failover',
84 | 'mailers' => [
85 | 'smtp',
86 | 'log',
87 | ],
88 | ],
89 | ],
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Global "From" Address
94 | |--------------------------------------------------------------------------
95 | |
96 | | You may wish for all e-mails sent by your application to be sent from
97 | | the same address. Here, you may specify a name and address that is
98 | | used globally for all e-mails that are sent by your application.
99 | |
100 | */
101 |
102 | 'from' => [
103 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
104 | 'name' => env('MAIL_FROM_NAME', 'Example'),
105 | ],
106 |
107 | /*
108 | |--------------------------------------------------------------------------
109 | | Markdown Mail Settings
110 | |--------------------------------------------------------------------------
111 | |
112 | | If you are using Markdown based email rendering, you may configure your
113 | | theme and component paths here, allowing you to customize the design
114 | | of the emails. Or, you may simply stick with the Laravel defaults!
115 | |
116 | */
117 |
118 | 'markdown' => [
119 | 'theme' => 'default',
120 |
121 | 'paths' => [
122 | resource_path('views/vendor/mail'),
123 | ],
124 | ],
125 |
126 | ];
127 |
--------------------------------------------------------------------------------
/config/logging.php:
--------------------------------------------------------------------------------
1 | env('LOG_CHANNEL', 'stack'),
23 |
24 | /*
25 | |--------------------------------------------------------------------------
26 | | Deprecations Log Channel
27 | |--------------------------------------------------------------------------
28 | |
29 | | This option controls the log channel that should be used to log warnings
30 | | regarding deprecated PHP and library features. This allows you to get
31 | | your application ready for upcoming major versions of dependencies.
32 | |
33 | */
34 |
35 | 'deprecations' => [
36 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
37 | 'trace' => false,
38 | ],
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Log Channels
43 | |--------------------------------------------------------------------------
44 | |
45 | | Here you may configure the log channels for your application. Out of
46 | | the box, Laravel uses the Monolog PHP logging library. This gives
47 | | you a variety of powerful log handlers / formatters to utilize.
48 | |
49 | | Available Drivers: "single", "daily", "slack", "syslog",
50 | | "errorlog", "monolog",
51 | | "custom", "stack"
52 | |
53 | */
54 |
55 | 'channels' => [
56 | 'stack' => [
57 | 'driver' => 'stack',
58 | 'channels' => ['single'],
59 | 'ignore_exceptions' => false,
60 | ],
61 |
62 | 'single' => [
63 | 'driver' => 'single',
64 | 'path' => storage_path('logs/laravel.log'),
65 | 'level' => env('LOG_LEVEL', 'debug'),
66 | ],
67 |
68 | 'daily' => [
69 | 'driver' => 'daily',
70 | 'path' => storage_path('logs/laravel.log'),
71 | 'level' => env('LOG_LEVEL', 'debug'),
72 | 'days' => 14,
73 | ],
74 |
75 | 'slack' => [
76 | 'driver' => 'slack',
77 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
78 | 'username' => 'Laravel Log',
79 | 'emoji' => ':boom:',
80 | 'level' => env('LOG_LEVEL', 'critical'),
81 | ],
82 |
83 | 'papertrail' => [
84 | 'driver' => 'monolog',
85 | 'level' => env('LOG_LEVEL', 'debug'),
86 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
87 | 'handler_with' => [
88 | 'host' => env('PAPERTRAIL_URL'),
89 | 'port' => env('PAPERTRAIL_PORT'),
90 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
91 | ],
92 | ],
93 |
94 | 'stderr' => [
95 | 'driver' => 'monolog',
96 | 'level' => env('LOG_LEVEL', 'debug'),
97 | 'handler' => StreamHandler::class,
98 | 'formatter' => env('LOG_STDERR_FORMATTER'),
99 | 'with' => [
100 | 'stream' => 'php://stderr',
101 | ],
102 | ],
103 |
104 | 'syslog' => [
105 | 'driver' => 'syslog',
106 | 'level' => env('LOG_LEVEL', 'debug'),
107 | 'facility' => LOG_USER,
108 | ],
109 |
110 | 'errorlog' => [
111 | 'driver' => 'errorlog',
112 | 'level' => env('LOG_LEVEL', 'debug'),
113 | ],
114 |
115 | 'null' => [
116 | 'driver' => 'monolog',
117 | 'handler' => NullHandler::class,
118 | ],
119 |
120 | 'emergency' => [
121 | 'path' => storage_path('logs/laravel.log'),
122 | ],
123 | ],
124 |
125 | ];
126 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
19 | 'guard' => 'web',
20 | 'passwords' => 'users',
21 | ],
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Authentication Guards
26 | |--------------------------------------------------------------------------
27 | |
28 | | Next, you may define every authentication guard for your application.
29 | | Of course, a great default configuration has been defined for you
30 | | here which uses session storage and the Eloquent user provider.
31 | |
32 | | All authentication drivers have a user provider. This defines how the
33 | | users are actually retrieved out of your database or other storage
34 | | mechanisms used by this application to persist your user's data.
35 | |
36 | | Supported: "session"
37 | |
38 | */
39 |
40 | 'guards' => [
41 | 'web' => [
42 | 'driver' => 'session',
43 | 'provider' => 'users',
44 | ],
45 | ],
46 |
47 | /*
48 | |--------------------------------------------------------------------------
49 | | User Providers
50 | |--------------------------------------------------------------------------
51 | |
52 | | All authentication drivers have a user provider. This defines how the
53 | | users are actually retrieved out of your database or other storage
54 | | mechanisms used by this application to persist your user's data.
55 | |
56 | | If you have multiple user tables or models you may configure multiple
57 | | sources which represent each model / table. These sources may then
58 | | be assigned to any extra authentication guards you have defined.
59 | |
60 | | Supported: "database", "eloquent"
61 | |
62 | */
63 |
64 | 'providers' => [
65 | 'users' => [
66 | 'driver' => 'eloquent',
67 | 'model' => App\Models\User::class,
68 | ],
69 |
70 | // 'users' => [
71 | // 'driver' => 'database',
72 | // 'table' => 'users',
73 | // ],
74 | ],
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | Resetting Passwords
79 | |--------------------------------------------------------------------------
80 | |
81 | | You may specify multiple password reset configurations if you have more
82 | | than one user table or model in the application and you want to have
83 | | separate password reset settings based on the specific user types.
84 | |
85 | | The expiry time is the number of minutes that each reset token will be
86 | | considered valid. This security feature keeps tokens short-lived so
87 | | they have less time to be guessed. You may change this as needed.
88 | |
89 | | The throttle setting is the number of seconds a user must wait before
90 | | generating more password reset tokens. This prevents the user from
91 | | quickly generating a very large amount of password reset tokens.
92 | |
93 | */
94 |
95 | 'passwords' => [
96 | 'users' => [
97 | 'provider' => 'users',
98 | 'table' => 'password_reset_tokens',
99 | 'expire' => 60,
100 | 'throttle' => 60,
101 | ],
102 | ],
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Password Confirmation Timeout
107 | |--------------------------------------------------------------------------
108 | |
109 | | Here you may define the amount of seconds before a password confirmation
110 | | times out and the user is prompted to re-enter their password via the
111 | | confirmation screen. By default, the timeout lasts for three hours.
112 | |
113 | */
114 |
115 | 'password_timeout' => 10800,
116 |
117 | ];
118 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Database Connections
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here are each of the database connections setup for your application.
28 | | Of course, examples of configuring each database platform that is
29 | | supported by Laravel is shown below to make development simple.
30 | |
31 | |
32 | | All database work in Laravel is done through the PHP PDO facilities
33 | | so make sure you have the driver for your particular database of
34 | | choice installed on your machine before you begin development.
35 | |
36 | */
37 |
38 | 'connections' => [
39 |
40 | 'sqlite' => [
41 | 'driver' => 'sqlite',
42 | 'url' => env('DATABASE_URL'),
43 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
44 | 'prefix' => '',
45 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
46 | ],
47 |
48 | 'mysql' => [
49 | 'driver' => 'mysql',
50 | 'url' => env('DATABASE_URL'),
51 | 'host' => env('DB_HOST', '127.0.0.1'),
52 | 'port' => env('DB_PORT', '3306'),
53 | 'database' => env('DB_DATABASE', 'forge'),
54 | 'username' => env('DB_USERNAME', 'forge'),
55 | 'password' => env('DB_PASSWORD', ''),
56 | 'unix_socket' => env('DB_SOCKET', ''),
57 | 'charset' => 'utf8mb4',
58 | 'collation' => 'utf8mb4_unicode_ci',
59 | 'prefix' => '',
60 | 'prefix_indexes' => true,
61 | 'strict' => true,
62 | 'engine' => null,
63 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
64 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
65 | ]) : [],
66 | ],
67 |
68 | 'pgsql' => [
69 | 'driver' => 'pgsql',
70 | 'url' => env('DATABASE_URL'),
71 | 'host' => env('DB_HOST', '127.0.0.1'),
72 | 'port' => env('DB_PORT', '5432'),
73 | 'database' => env('DB_DATABASE', 'forge'),
74 | 'username' => env('DB_USERNAME', 'forge'),
75 | 'password' => env('DB_PASSWORD', ''),
76 | 'charset' => 'utf8',
77 | 'prefix' => '',
78 | 'prefix_indexes' => true,
79 | 'search_path' => 'public',
80 | 'sslmode' => 'prefer',
81 | ],
82 |
83 | 'sqlsrv' => [
84 | 'driver' => 'sqlsrv',
85 | 'url' => env('DATABASE_URL'),
86 | 'host' => env('DB_HOST', 'localhost'),
87 | 'port' => env('DB_PORT', '1433'),
88 | 'database' => env('DB_DATABASE', 'forge'),
89 | 'username' => env('DB_USERNAME', 'forge'),
90 | 'password' => env('DB_PASSWORD', ''),
91 | 'charset' => 'utf8',
92 | 'prefix' => '',
93 | 'prefix_indexes' => true,
94 | // 'encrypt' => env('DB_ENCRYPT', 'yes'),
95 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
96 | ],
97 |
98 | ],
99 |
100 | /*
101 | |--------------------------------------------------------------------------
102 | | Migration Repository Table
103 | |--------------------------------------------------------------------------
104 | |
105 | | This table keeps track of all the migrations that have already run for
106 | | your application. Using this information, we can determine which of
107 | | the migrations on disk haven't actually been run in the database.
108 | |
109 | */
110 |
111 | 'migrations' => 'migrations',
112 |
113 | /*
114 | |--------------------------------------------------------------------------
115 | | Redis Databases
116 | |--------------------------------------------------------------------------
117 | |
118 | | Redis is an open source, fast, and advanced key-value store that also
119 | | provides a richer body of commands than a typical key-value system
120 | | such as APC or Memcached. Laravel makes it easy to dig right in.
121 | |
122 | */
123 |
124 | 'redis' => [
125 |
126 | 'client' => env('REDIS_CLIENT', 'phpredis'),
127 |
128 | 'options' => [
129 | 'cluster' => env('REDIS_CLUSTER', 'redis'),
130 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
131 | ],
132 |
133 | 'default' => [
134 | 'url' => env('REDIS_URL'),
135 | 'host' => env('REDIS_HOST', '127.0.0.1'),
136 | 'username' => env('REDIS_USERNAME'),
137 | 'password' => env('REDIS_PASSWORD'),
138 | 'port' => env('REDIS_PORT', '6379'),
139 | 'database' => env('REDIS_DB', '0'),
140 | ],
141 |
142 | 'cache' => [
143 | 'url' => env('REDIS_URL'),
144 | 'host' => env('REDIS_HOST', '127.0.0.1'),
145 | 'username' => env('REDIS_USERNAME'),
146 | 'password' => env('REDIS_PASSWORD'),
147 | 'port' => env('REDIS_PORT', '6379'),
148 | 'database' => env('REDIS_CACHE_DB', '1'),
149 | ],
150 |
151 | ],
152 |
153 | ];
154 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
24 |
25 | /*
26 | |--------------------------------------------------------------------------
27 | | Session Lifetime
28 | |--------------------------------------------------------------------------
29 | |
30 | | Here you may specify the number of minutes that you wish the session
31 | | to be allowed to remain idle before it expires. If you want them
32 | | to immediately expire on the browser closing, set that option.
33 | |
34 | */
35 |
36 | 'lifetime' => env('SESSION_LIFETIME', 120),
37 |
38 | 'expire_on_close' => false,
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Session Encryption
43 | |--------------------------------------------------------------------------
44 | |
45 | | This option allows you to easily specify that all of your session data
46 | | should be encrypted before it is stored. All encryption will be run
47 | | automatically by Laravel and you can use the Session like normal.
48 | |
49 | */
50 |
51 | 'encrypt' => false,
52 |
53 | /*
54 | |--------------------------------------------------------------------------
55 | | Session File Location
56 | |--------------------------------------------------------------------------
57 | |
58 | | When using the native session driver, we need a location where session
59 | | files may be stored. A default has been set for you but a different
60 | | location may be specified. This is only needed for file sessions.
61 | |
62 | */
63 |
64 | 'files' => storage_path('framework/sessions'),
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | Session Database Connection
69 | |--------------------------------------------------------------------------
70 | |
71 | | When using the "database" or "redis" session drivers, you may specify a
72 | | connection that should be used to manage these sessions. This should
73 | | correspond to a connection in your database configuration options.
74 | |
75 | */
76 |
77 | 'connection' => env('SESSION_CONNECTION'),
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Session Database Table
82 | |--------------------------------------------------------------------------
83 | |
84 | | When using the "database" session driver, you may specify the table we
85 | | should use to manage the sessions. Of course, a sensible default is
86 | | provided for you; however, you are free to change this as needed.
87 | |
88 | */
89 |
90 | 'table' => 'sessions',
91 |
92 | /*
93 | |--------------------------------------------------------------------------
94 | | Session Cache Store
95 | |--------------------------------------------------------------------------
96 | |
97 | | While using one of the framework's cache driven session backends you may
98 | | list a cache store that should be used for these sessions. This value
99 | | must match with one of the application's configured cache "stores".
100 | |
101 | | Affects: "apc", "dynamodb", "memcached", "redis"
102 | |
103 | */
104 |
105 | 'store' => env('SESSION_STORE'),
106 |
107 | /*
108 | |--------------------------------------------------------------------------
109 | | Session Sweeping Lottery
110 | |--------------------------------------------------------------------------
111 | |
112 | | Some session drivers must manually sweep their storage location to get
113 | | rid of old sessions from storage. Here are the chances that it will
114 | | happen on a given request. By default, the odds are 2 out of 100.
115 | |
116 | */
117 |
118 | 'lottery' => [2, 100],
119 |
120 | /*
121 | |--------------------------------------------------------------------------
122 | | Session Cookie Name
123 | |--------------------------------------------------------------------------
124 | |
125 | | Here you may change the name of the cookie used to identify a session
126 | | instance by ID. The name specified here will get used every time a
127 | | new session cookie is created by the framework for every driver.
128 | |
129 | */
130 |
131 | 'cookie' => env(
132 | 'SESSION_COOKIE',
133 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
134 | ),
135 |
136 | /*
137 | |--------------------------------------------------------------------------
138 | | Session Cookie Path
139 | |--------------------------------------------------------------------------
140 | |
141 | | The session cookie path determines the path for which the cookie will
142 | | be regarded as available. Typically, this will be the root path of
143 | | your application but you are free to change this when necessary.
144 | |
145 | */
146 |
147 | 'path' => '/',
148 |
149 | /*
150 | |--------------------------------------------------------------------------
151 | | Session Cookie Domain
152 | |--------------------------------------------------------------------------
153 | |
154 | | Here you may change the domain of the cookie used to identify a session
155 | | in your application. This will determine which domains the cookie is
156 | | available to in your application. A sensible default has been set.
157 | |
158 | */
159 |
160 | 'domain' => env('SESSION_DOMAIN'),
161 |
162 | /*
163 | |--------------------------------------------------------------------------
164 | | HTTPS Only Cookies
165 | |--------------------------------------------------------------------------
166 | |
167 | | By setting this option to true, session cookies will only be sent back
168 | | to the server if the browser has a HTTPS connection. This will keep
169 | | the cookie from being sent to you when it can't be done securely.
170 | |
171 | */
172 |
173 | 'secure' => env('SESSION_SECURE_COOKIE'),
174 |
175 | /*
176 | |--------------------------------------------------------------------------
177 | | HTTP Access Only
178 | |--------------------------------------------------------------------------
179 | |
180 | | Setting this value to true will prevent JavaScript from accessing the
181 | | value of the cookie and the cookie will only be accessible through
182 | | the HTTP protocol. You are free to modify this option if needed.
183 | |
184 | */
185 |
186 | 'http_only' => true,
187 |
188 | /*
189 | |--------------------------------------------------------------------------
190 | | Same-Site Cookies
191 | |--------------------------------------------------------------------------
192 | |
193 | | This option determines how your cookies behave when cross-site requests
194 | | take place, and can be used to mitigate CSRF attacks. By default, we
195 | | will set this value to "lax" since this is a secure default value.
196 | |
197 | | Supported: "lax", "strict", "none", null
198 | |
199 | */
200 |
201 | 'same_site' => 'lax',
202 |
203 | ];
204 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Application Environment
25 | |--------------------------------------------------------------------------
26 | |
27 | | This value determines the "environment" your application is currently
28 | | running in. This may determine how you prefer to configure various
29 | | services the application utilizes. Set this in your ".env" file.
30 | |
31 | */
32 |
33 | 'env' => env('APP_ENV', 'production'),
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Application Debug Mode
38 | |--------------------------------------------------------------------------
39 | |
40 | | When your application is in debug mode, detailed error messages with
41 | | stack traces will be shown on every error that occurs within your
42 | | application. If disabled, a simple generic error page is shown.
43 | |
44 | */
45 |
46 | 'debug' => (bool) env('APP_DEBUG', false),
47 |
48 | /*
49 | |--------------------------------------------------------------------------
50 | | Application URL
51 | |--------------------------------------------------------------------------
52 | |
53 | | This URL is used by the console to properly generate URLs when using
54 | | the Artisan command line tool. You should set this to the root of
55 | | your application so that it is used when running Artisan tasks.
56 | |
57 | */
58 |
59 | 'url' => env('APP_URL', 'http://localhost'),
60 |
61 | 'frontend_url' => env('FRONTEND_URL', 'http://localhost:3000'),
62 |
63 | 'asset_url' => env('ASSET_URL'),
64 |
65 | /*
66 | |--------------------------------------------------------------------------
67 | | Application Timezone
68 | |--------------------------------------------------------------------------
69 | |
70 | | Here you may specify the default timezone for your application, which
71 | | will be used by the PHP date and date-time functions. We have gone
72 | | ahead and set this to a sensible default for you out of the box.
73 | |
74 | */
75 |
76 | 'timezone' => 'UTC',
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | Application Locale Configuration
81 | |--------------------------------------------------------------------------
82 | |
83 | | The application locale determines the default locale that will be used
84 | | by the translation service provider. You are free to set this value
85 | | to any of the locales which will be supported by the application.
86 | |
87 | */
88 |
89 | 'locale' => 'en',
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Application Fallback Locale
94 | |--------------------------------------------------------------------------
95 | |
96 | | The fallback locale determines the locale to use when the current one
97 | | is not available. You may change the value to correspond to any of
98 | | the language folders that are provided through your application.
99 | |
100 | */
101 |
102 | 'fallback_locale' => 'en',
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Faker Locale
107 | |--------------------------------------------------------------------------
108 | |
109 | | This locale will be used by the Faker PHP library when generating fake
110 | | data for your database seeds. For example, this will be used to get
111 | | localized telephone numbers, street address information and more.
112 | |
113 | */
114 |
115 | 'faker_locale' => 'en_US',
116 |
117 | /*
118 | |--------------------------------------------------------------------------
119 | | Encryption Key
120 | |--------------------------------------------------------------------------
121 | |
122 | | This key is used by the Illuminate encrypter service and should be set
123 | | to a random, 32 character string, otherwise these encrypted strings
124 | | will not be safe. Please do this before deploying an application!
125 | |
126 | */
127 |
128 | 'key' => env('APP_KEY'),
129 |
130 | 'cipher' => 'AES-256-CBC',
131 |
132 | /*
133 | |--------------------------------------------------------------------------
134 | | Maintenance Mode Driver
135 | |--------------------------------------------------------------------------
136 | |
137 | | These configuration options determine the driver used to determine and
138 | | manage Laravel's "maintenance mode" status. The "cache" driver will
139 | | allow maintenance mode to be controlled across multiple machines.
140 | |
141 | | Supported drivers: "file", "cache"
142 | |
143 | */
144 |
145 | 'maintenance' => [
146 | 'driver' => 'file',
147 | // 'store' => 'redis',
148 | ],
149 |
150 | /*
151 | |--------------------------------------------------------------------------
152 | | Autoloaded Service Providers
153 | |--------------------------------------------------------------------------
154 | |
155 | | The service providers listed here will be automatically loaded on the
156 | | request to your application. Feel free to add your own services to
157 | | this array to grant expanded functionality to your applications.
158 | |
159 | */
160 |
161 | 'providers' => [
162 |
163 | /*
164 | * Laravel Framework Service Providers...
165 | */
166 | Illuminate\Auth\AuthServiceProvider::class,
167 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
168 | Illuminate\Bus\BusServiceProvider::class,
169 | Illuminate\Cache\CacheServiceProvider::class,
170 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
171 | Illuminate\Cookie\CookieServiceProvider::class,
172 | Illuminate\Database\DatabaseServiceProvider::class,
173 | Illuminate\Encryption\EncryptionServiceProvider::class,
174 | Illuminate\Filesystem\FilesystemServiceProvider::class,
175 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
176 | Illuminate\Hashing\HashServiceProvider::class,
177 | Illuminate\Mail\MailServiceProvider::class,
178 | Illuminate\Notifications\NotificationServiceProvider::class,
179 | Illuminate\Pagination\PaginationServiceProvider::class,
180 | Illuminate\Pipeline\PipelineServiceProvider::class,
181 | Illuminate\Queue\QueueServiceProvider::class,
182 | Illuminate\Redis\RedisServiceProvider::class,
183 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
184 | Illuminate\Session\SessionServiceProvider::class,
185 | Illuminate\Translation\TranslationServiceProvider::class,
186 | Illuminate\Validation\ValidationServiceProvider::class,
187 | Illuminate\View\ViewServiceProvider::class,
188 |
189 | /*
190 | * Package Service Providers...
191 | */
192 |
193 | /*
194 | * Application Service Providers...
195 | */
196 | App\Providers\AppServiceProvider::class,
197 | App\Providers\AuthServiceProvider::class,
198 | // App\Providers\BroadcastServiceProvider::class,
199 | App\Providers\EventServiceProvider::class,
200 | App\Providers\RouteServiceProvider::class,
201 |
202 | ],
203 |
204 | /*
205 | |--------------------------------------------------------------------------
206 | | Class Aliases
207 | |--------------------------------------------------------------------------
208 | |
209 | | This array of class aliases will be registered when this application
210 | | is started. However, feel free to register as many as you wish as
211 | | the aliases are "lazy" loaded so they don't hinder performance.
212 | |
213 | */
214 |
215 | 'aliases' => Facade::defaultAliases()->merge([
216 | // 'ExampleClass' => App\Example\ExampleClass::class,
217 | ])->toArray(),
218 |
219 | ];
220 |
--------------------------------------------------------------------------------
/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute field must be accepted.',
19 | 'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
20 | 'active_url' => 'The :attribute field must be a valid URL.',
21 | 'after' => 'The :attribute field must be a date after :date.',
22 | 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
23 | 'alpha' => 'The :attribute field must only contain letters.',
24 | 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
25 | 'alpha_num' => 'The :attribute field must only contain letters and numbers.',
26 | 'array' => 'The :attribute field must be an array.',
27 | 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
28 | 'before' => 'The :attribute field must be a date before :date.',
29 | 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
30 | 'between' => [
31 | 'array' => 'The :attribute field must have between :min and :max items.',
32 | 'file' => 'The :attribute field must be between :min and :max kilobytes.',
33 | 'numeric' => 'The :attribute field must be between :min and :max.',
34 | 'string' => 'The :attribute field must be between :min and :max characters.',
35 | ],
36 | 'boolean' => 'The :attribute field must be true or false.',
37 | 'confirmed' => 'The :attribute field confirmation does not match.',
38 | 'current_password' => 'The password is incorrect.',
39 | 'date' => 'The :attribute field must be a valid date.',
40 | 'date_equals' => 'The :attribute field must be a date equal to :date.',
41 | 'date_format' => 'The :attribute field must match the format :format.',
42 | 'decimal' => 'The :attribute field must have :decimal decimal places.',
43 | 'declined' => 'The :attribute field must be declined.',
44 | 'declined_if' => 'The :attribute field must be declined when :other is :value.',
45 | 'different' => 'The :attribute field and :other must be different.',
46 | 'digits' => 'The :attribute field must be :digits digits.',
47 | 'digits_between' => 'The :attribute field must be between :min and :max digits.',
48 | 'dimensions' => 'The :attribute field has invalid image dimensions.',
49 | 'distinct' => 'The :attribute field has a duplicate value.',
50 | 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
51 | 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
52 | 'email' => 'The :attribute field must be a valid email address.',
53 | 'ends_with' => 'The :attribute field must end with one of the following: :values.',
54 | 'enum' => 'The selected :attribute is invalid.',
55 | 'exists' => 'The selected :attribute is invalid.',
56 | 'file' => 'The :attribute field must be a file.',
57 | 'filled' => 'The :attribute field must have a value.',
58 | 'gt' => [
59 | 'array' => 'The :attribute field must have more than :value items.',
60 | 'file' => 'The :attribute field must be greater than :value kilobytes.',
61 | 'numeric' => 'The :attribute field must be greater than :value.',
62 | 'string' => 'The :attribute field must be greater than :value characters.',
63 | ],
64 | 'gte' => [
65 | 'array' => 'The :attribute field must have :value items or more.',
66 | 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
67 | 'numeric' => 'The :attribute field must be greater than or equal to :value.',
68 | 'string' => 'The :attribute field must be greater than or equal to :value characters.',
69 | ],
70 | 'image' => 'The :attribute field must be an image.',
71 | 'in' => 'The selected :attribute is invalid.',
72 | 'in_array' => 'The :attribute field must exist in :other.',
73 | 'integer' => 'The :attribute field must be an integer.',
74 | 'ip' => 'The :attribute field must be a valid IP address.',
75 | 'ipv4' => 'The :attribute field must be a valid IPv4 address.',
76 | 'ipv6' => 'The :attribute field must be a valid IPv6 address.',
77 | 'json' => 'The :attribute field must be a valid JSON string.',
78 | 'lowercase' => 'The :attribute field must be lowercase.',
79 | 'lt' => [
80 | 'array' => 'The :attribute field must have less than :value items.',
81 | 'file' => 'The :attribute field must be less than :value kilobytes.',
82 | 'numeric' => 'The :attribute field must be less than :value.',
83 | 'string' => 'The :attribute field must be less than :value characters.',
84 | ],
85 | 'lte' => [
86 | 'array' => 'The :attribute field must not have more than :value items.',
87 | 'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
88 | 'numeric' => 'The :attribute field must be less than or equal to :value.',
89 | 'string' => 'The :attribute field must be less than or equal to :value characters.',
90 | ],
91 | 'mac_address' => 'The :attribute field must be a valid MAC address.',
92 | 'max' => [
93 | 'array' => 'The :attribute field must not have more than :max items.',
94 | 'file' => 'The :attribute field must not be greater than :max kilobytes.',
95 | 'numeric' => 'The :attribute field must not be greater than :max.',
96 | 'string' => 'The :attribute field must not be greater than :max characters.',
97 | ],
98 | 'max_digits' => 'The :attribute field must not have more than :max digits.',
99 | 'mimes' => 'The :attribute field must be a file of type: :values.',
100 | 'mimetypes' => 'The :attribute field must be a file of type: :values.',
101 | 'min' => [
102 | 'array' => 'The :attribute field must have at least :min items.',
103 | 'file' => 'The :attribute field must be at least :min kilobytes.',
104 | 'numeric' => 'The :attribute field must be at least :min.',
105 | 'string' => 'The :attribute field must be at least :min characters.',
106 | ],
107 | 'min_digits' => 'The :attribute field must have at least :min digits.',
108 | 'missing' => 'The :attribute field must be missing.',
109 | 'missing_if' => 'The :attribute field must be missing when :other is :value.',
110 | 'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
111 | 'missing_with' => 'The :attribute field must be missing when :values is present.',
112 | 'missing_with_all' => 'The :attribute field must be missing when :values are present.',
113 | 'multiple_of' => 'The :attribute field must be a multiple of :value.',
114 | 'not_in' => 'The selected :attribute is invalid.',
115 | 'not_regex' => 'The :attribute field format is invalid.',
116 | 'numeric' => 'The :attribute field must be a number.',
117 | 'password' => [
118 | 'letters' => 'The :attribute field must contain at least one letter.',
119 | 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
120 | 'numbers' => 'The :attribute field must contain at least one number.',
121 | 'symbols' => 'The :attribute field must contain at least one symbol.',
122 | 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
123 | ],
124 | 'present' => 'The :attribute field must be present.',
125 | 'prohibited' => 'The :attribute field is prohibited.',
126 | 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
127 | 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
128 | 'prohibits' => 'The :attribute field prohibits :other from being present.',
129 | 'regex' => 'The :attribute field format is invalid.',
130 | 'required' => 'The :attribute field is required.',
131 | 'required_array_keys' => 'The :attribute field must contain entries for: :values.',
132 | 'required_if' => 'The :attribute field is required when :other is :value.',
133 | 'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
134 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
135 | 'required_with' => 'The :attribute field is required when :values is present.',
136 | 'required_with_all' => 'The :attribute field is required when :values are present.',
137 | 'required_without' => 'The :attribute field is required when :values is not present.',
138 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
139 | 'same' => 'The :attribute field must match :other.',
140 | 'size' => [
141 | 'array' => 'The :attribute field must contain :size items.',
142 | 'file' => 'The :attribute field must be :size kilobytes.',
143 | 'numeric' => 'The :attribute field must be :size.',
144 | 'string' => 'The :attribute field must be :size characters.',
145 | ],
146 | 'starts_with' => 'The :attribute field must start with one of the following: :values.',
147 | 'string' => 'The :attribute field must be a string.',
148 | 'timezone' => 'The :attribute field must be a valid timezone.',
149 | 'unique' => 'The :attribute has already been taken.',
150 | 'uploaded' => 'The :attribute failed to upload.',
151 | 'uppercase' => 'The :attribute field must be uppercase.',
152 | 'url' => 'The :attribute field must be a valid URL.',
153 | 'ulid' => 'The :attribute field must be a valid ULID.',
154 | 'uuid' => 'The :attribute field must be a valid UUID.',
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | Custom Validation Language Lines
159 | |--------------------------------------------------------------------------
160 | |
161 | | Here you may specify custom validation messages for attributes using the
162 | | convention "attribute.rule" to name the lines. This makes it quick to
163 | | specify a specific custom language line for a given attribute rule.
164 | |
165 | */
166 |
167 | 'custom' => [
168 | 'attribute-name' => [
169 | 'rule-name' => 'custom-message',
170 | ],
171 | ],
172 |
173 | /*
174 | |--------------------------------------------------------------------------
175 | | Custom Validation Attributes
176 | |--------------------------------------------------------------------------
177 | |
178 | | The following language lines are used to swap our attribute placeholder
179 | | with something more reader friendly such as "E-Mail Address" instead
180 | | of "email". This simply helps us make our message more expressive.
181 | |
182 | */
183 |
184 | 'attributes' => [],
185 |
186 | ];
187 |
--------------------------------------------------------------------------------