From 028e7df9918ff578c06a0236581cd39f5b6d874a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 10 Apr 2024 16:40:33 +0200 Subject: [PATCH] wip #6857 @1.5 --- .docker/config/passwords | 2 +- .../config/ssh/server/ssh_host_dsa_key.pub | 1 + .../config/ssh/server/ssh_host_ecdsa_key.pub | 1 + .../ssh/server/ssh_host_ed25519_key.pub | 1 + .../config/ssh/server/ssh_host_rsa_key.pub | 1 + .docker/production/docker-compose.yml | 12 +- .env.production | 48 ++-- .gitignore | 1 + app/Console/Kernel.php | 27 ++ app/Exceptions/Handler.php | 30 +++ app/Http/Controllers/Controller.php | 8 +- app/Http/Kernel.php | 68 +++++ app/Http/Middleware/Authenticate.php | 17 ++ app/Http/Middleware/EncryptCookies.php | 17 ++ .../PreventRequestsDuringMaintenance.php | 17 ++ .../Middleware/RedirectIfAuthenticated.php | 30 +++ app/Http/Middleware/TrimStrings.php | 19 ++ app/Http/Middleware/TrustHosts.php | 20 ++ app/Http/Middleware/TrustProxies.php | 28 ++ app/Http/Middleware/ValidateSignature.php | 22 ++ app/Http/Middleware/VerifyCsrfToken.php | 17 ++ app/Models/User.php | 18 +- app/Providers/AuthServiceProvider.php | 26 ++ app/Providers/BroadcastServiceProvider.php | 19 ++ app/Providers/EventServiceProvider.php | 38 +++ app/Providers/RouteServiceProvider.php | 40 +++ artisan | 50 +++- bootstrap/app.php | 69 +++-- bootstrap/providers.php | 5 - composer.json | 27 +- composer.lock | 239 +++++++++++++++++- config/app.php | 108 ++++++-- config/auth.php | 34 +-- config/broadcasting.php | 71 ++++++ config/cache.php | 30 ++- config/cors.php | 34 +++ config/database.php | 75 ++---- config/filesystems.php | 8 +- config/hashing.php | 54 ++++ config/logging.php | 29 +-- config/mail.php | 55 ++-- config/queue.php | 41 ++- config/sanctum.php | 83 ++++++ config/services.php | 14 +- config/session.php | 67 +++-- config/view.php | 36 +++ .../0001_01_01_000001_create_cache_table.php | 35 --- .../0001_01_01_000002_create_jobs_table.php | 57 ----- ... 2014_10_12_000000_create_users_table.php} | 17 -- ...000_create_password_reset_tokens_table.php | 28 ++ ..._08_19_000000_create_failed_jobs_table.php | 32 +++ ...01_create_personal_access_tokens_table.php | 33 +++ database/seeders/DatabaseSeeder.php | 11 +- package.json | 4 +- phpunit.xml | 3 +- public/index.php | 48 +++- public/info.php | 2 - resources/js/bootstrap.js | 28 ++ resources/views/welcome.blade.php | 217 +++++++--------- routes/api.php | 19 ++ routes/channels.php | 18 ++ routes/console.php | 13 +- routes/web.php | 11 + tests/CreatesApplication.php | 21 ++ tests/TestCase.php | 2 +- 65 files changed, 1714 insertions(+), 542 deletions(-) create mode 100644 .docker/config/ssh/server/ssh_host_dsa_key.pub create mode 100644 .docker/config/ssh/server/ssh_host_ecdsa_key.pub create mode 100644 .docker/config/ssh/server/ssh_host_ed25519_key.pub create mode 100644 .docker/config/ssh/server/ssh_host_rsa_key.pub create mode 100644 app/Console/Kernel.php create mode 100644 app/Exceptions/Handler.php create mode 100644 app/Http/Kernel.php create mode 100644 app/Http/Middleware/Authenticate.php create mode 100644 app/Http/Middleware/EncryptCookies.php create mode 100644 app/Http/Middleware/PreventRequestsDuringMaintenance.php create mode 100644 app/Http/Middleware/RedirectIfAuthenticated.php create mode 100644 app/Http/Middleware/TrimStrings.php create mode 100644 app/Http/Middleware/TrustHosts.php create mode 100644 app/Http/Middleware/TrustProxies.php create mode 100644 app/Http/Middleware/ValidateSignature.php create mode 100644 app/Http/Middleware/VerifyCsrfToken.php create mode 100644 app/Providers/AuthServiceProvider.php create mode 100644 app/Providers/BroadcastServiceProvider.php create mode 100644 app/Providers/EventServiceProvider.php create mode 100644 app/Providers/RouteServiceProvider.php delete mode 100644 bootstrap/providers.php create mode 100644 config/broadcasting.php create mode 100644 config/cors.php create mode 100644 config/hashing.php create mode 100644 config/sanctum.php create mode 100644 config/view.php delete mode 100644 database/migrations/0001_01_01_000001_create_cache_table.php delete mode 100644 database/migrations/0001_01_01_000002_create_jobs_table.php rename database/migrations/{0001_01_01_000000_create_users_table.php => 2014_10_12_000000_create_users_table.php} (50%) create mode 100644 database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php create mode 100644 database/migrations/2019_08_19_000000_create_failed_jobs_table.php create mode 100644 database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php delete mode 100644 public/info.php create mode 100644 routes/api.php create mode 100644 routes/channels.php create mode 100644 tests/CreatesApplication.php diff --git a/.docker/config/passwords b/.docker/config/passwords index 551c9fd..bcafddb 100644 --- a/.docker/config/passwords +++ b/.docker/config/passwords @@ -1 +1 @@ -bastide-resah:kKi5Q0eaxdQpV6OJ +bastide-resah:NW2dDOdqz1mH2ZOb diff --git a/.docker/config/ssh/server/ssh_host_dsa_key.pub b/.docker/config/ssh/server/ssh_host_dsa_key.pub new file mode 100644 index 0000000..e72cec4 --- /dev/null +++ b/.docker/config/ssh/server/ssh_host_dsa_key.pub @@ -0,0 +1 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAPQRU+G8CcTy7PyD57vU2Io4maMdhTQPBJpS96xYYxSXZcgAuGvknH/049TpqTVTAIlQQzjHmC6txOeIj1yhSC9dfhdfKYzG+QGds1vTglCKkQvyTOOd71ZwdEnRhS6S07zccU96YHMI62Zt05uWmfVxytXlpz/11P8QbLbukf1vAAAAFQCtg7yVKZAla0wiv0TX8CJoPnQQ1QAAAIEAwIMem03FGOM/ph/6QOepDCodLXUp33x4panT0OAwZjkm9YXWVGiQwNcv579i6pi7JXnLU3SUswOBrGZADjvjNG5SupebMDXN/wtKJSjvpWrRl7pUrk8byN9fP2lKFCmxmdg9vh1oROUGzTFddNLHwR4GRpFjrWp2ldDQd/C2Yy4AAACAfA5r5jNNDm+C9Ud2D62+AbnrlDZ6xOnFIchD+zu7Q7dbNPyu6r0XheUKR1FWCwtf2QPnJNihOiHrdT2ICTdJ60XXB50CsoiDD5uA9FYUaA9kyfKpzNYLr280I2k2+XrUaz5rWuKeSyjk+GUFfLdmVmqw4YT51kbrKLgUya+PiZo= root@bastide-resah diff --git a/.docker/config/ssh/server/ssh_host_ecdsa_key.pub b/.docker/config/ssh/server/ssh_host_ecdsa_key.pub new file mode 100644 index 0000000..5c894b5 --- /dev/null +++ b/.docker/config/ssh/server/ssh_host_ecdsa_key.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMMOwfTrfUG2VA/eEP25Pjh82DWQ+FkEOBeLPw8iJY0DPcGAR/Aozpw+S2YbMxJQXNrLF2M3LfzmzugWAVUs0wQ= root@bastide-resah diff --git a/.docker/config/ssh/server/ssh_host_ed25519_key.pub b/.docker/config/ssh/server/ssh_host_ed25519_key.pub new file mode 100644 index 0000000..44b9f99 --- /dev/null +++ b/.docker/config/ssh/server/ssh_host_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFFJZE2rA5/aTDHrMVehkg8atKK6uxxt8ZKeqaAzhSaR root@bastide-resah diff --git a/.docker/config/ssh/server/ssh_host_rsa_key.pub b/.docker/config/ssh/server/ssh_host_rsa_key.pub new file mode 100644 index 0000000..8958fbd --- /dev/null +++ b/.docker/config/ssh/server/ssh_host_rsa_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDA+RqsN3CV52sg/PulKKxxIl3fJ5SsFm9QngX3Ece1ueDDkQC3/vMRVpYXGVg/P0IJK5FzMDl5nk9dYfNz01t5z6jmVpuV24gM3mWY0nxnFM3bFLKTrxFb3Kf0MYYpsmJjeejY1e9LsuBvBgPdVIyQll48kFx7bD0+w2FDN2btcS3iNiPSjhHGwoJPBxH8nPcPSyuY4zNo+/wfgo0++Tx4TtMShpUa5lKjE7qp7rDXJFx4R2i7YC1HQld9a0n40E1NsGbUB0gqyrBnOPIgcMsS82M7UFYo8V5JFuvxiw2e1qFh3jPn69+laR0En3z/MEeGu27MrySDzCWATeinjoYOGp28GO34wDZ1NaIf11HadqkVeprfhW9f9Q3TbW2BASGLw4JYhhOl8L8kyx0sPH/xuHmivyhbatlDvWdoampVaq22IL+ta+p5A5Mrtie59r496cRR5fHbzvF6eY8C1nbCaqdHOpCUwZL8UnLRBSywpSN3UC3uZL1NqFXpk8E5z3M= root@bastide-resah diff --git a/.docker/production/docker-compose.yml b/.docker/production/docker-compose.yml index bb9e39d..3c24175 100644 --- a/.docker/production/docker-compose.yml +++ b/.docker/production/docker-compose.yml @@ -45,7 +45,7 @@ services: # Web path - './www:/application' ports: - - '40106:22' + - '49360:22' networks: - bastide-resah restart: unless-stopped @@ -66,7 +66,7 @@ services: image: 'mariadb:latest' restart: unless-stopped environment: - MARIADB_ROOT_PASSWORD: LT7TYCjdUhXe0gF1 + MARIADB_ROOT_PASSWORD: YmIHpWHNko3YOozA MARIADB_DATABASE: bastide-resah MARIADB_AUTO_UPGRADE: 1 volumes: @@ -89,7 +89,7 @@ services: - "./database/backup:/backup" environment: USERNAME: root - PASSWORD: LT7TYCjdUhXe0gF1 + PASSWORD: YmIHpWHNko3YOozA DBHOST: bastide-resah-mariadb DBEXCLUDE: "performance_schema information_schema" CRON_SCHEDULE: "0 0 * * *" @@ -114,7 +114,7 @@ services: volumes: - ./matomo/database/data:/var/lib/mysql environment: - MARIADB_ROOT_PASSWORD: "9YBHV5KR8vGfO8An" + MARIADB_ROOT_PASSWORD: "uUDqGW5ldRscceSf" MARIADB_DATABASE: bastide-resah-matomo MARIADB_AUTO_UPGRADE: 1 networks: @@ -126,7 +126,7 @@ services: environment: MATOMO_DATABASE_ADAPTER: mysql MATOMO_DATABASE_USERNAME: root - MATOMO_DATABASE_PASSWORD: "9YBHV5KR8vGfO8An" + MATOMO_DATABASE_PASSWORD: "uUDqGW5ldRscceSf" MATOMO_DATABASE_DBNAME: bastide-resah-matomo VIRTUAL_HOST: matomo.bastide-resah.fluidbook.com LETSENCRYPT_HOST: matomo.bastide-resah.fluidbook.com @@ -146,7 +146,7 @@ services: - "./matomo/database/backup:/backup" environment: USERNAME: root - PASSWORD: "9YBHV5KR8vGfO8An" + PASSWORD: "uUDqGW5ldRscceSf" DBHOST: bastide-resah-matomo-mariadb DBEXCLUDE: "performance_schema information_schema" CRON_SCHEDULE: "0 0 * * *" diff --git a/.env.production b/.env.production index 6cd66fd..32d53a8 100644 --- a/.env.production +++ b/.env.production @@ -1,36 +1,28 @@ APP_NAME=bastide-resah APP_ENV=production -APP_KEY=base64:OLpj3q71ujJmMiX+yUep7akqcrx1HDpzgOaKoR340OU= +APP_KEY=base64:OpYzvRTnIiViilkl5ngdoPNJ6UQeQUB8WBKhR4XD/UY= APP_DEBUG=true -APP_TIMEZONE=UTC APP_URL=https://bastide-resah.fluidbook.com -APP_LOCALE=en -APP_FALLBACK_LOCALE=en -APP_FAKER_LOCALE=en_US -APP_MAINTENANCE_DRIVER=file -APP_MAINTENANCE_STORE=database -BCRYPT_ROUNDS=12 LOG_CHANNEL=stack -LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql -SESSION_DRIVER=redis -SESSION_LIFETIME=1200 -SESSION_ENCRYPT=false -SESSION_PATH=/ -SESSION_DOMAIN=null -BROADCAST_CONNECTION=log +DB_HOST=bastide-resah-mariadb +DB_PORT=3306 +DB_DATABASE=bastide-resah +DB_USERNAME=root +DB_PASSWORD=YmIHpWHNko3YOozA +BROADCAST_DRIVER=log +CACHE_DRIVER=redis FILESYSTEM_DISK=local QUEUE_CONNECTION=database -CACHE_STORE=database -CACHE_PREFIX= +SESSION_DRIVER=redis +SESSION_LIFETIME=1200 MEMCACHED_HOST=127.0.0.1 -REDIS_CLIENT=phpredis REDIS_HOST=bastide-resah-redis REDIS_PASSWORD=null REDIS_PORT=6379 -MAIL_MAILER=log +MAIL_MAILER=smtp MAIL_HOST=mail2.cubedesigners.com MAIL_PORT=587 MAIL_USERNAME=external@cubedesigners.com @@ -43,16 +35,22 @@ AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https +PUSHER_APP_CLUSTER=mt1 VITE_APP_NAME=Laravel +VITE_PUSHER_APP_KEY= +VITE_PUSHER_HOST= +VITE_PUSHER_PORT=443 +VITE_PUSHER_SCHEME=https +VITE_PUSHER_APP_CLUSTER=mt1 DEBUGBAR_ENABLED=true DEBUGBAR_OPEN_STORAGE=true MAIL_BCC_ALL=test+bastide-resah@cubedesigners.com BACKPACK_LOCALES=en,fr TIMEZONE=Europe/Paris POWERED_BY_LINK=https://www.cubedesigners.com/ -DB_HOST=bastide-resah-mariadb -DB_PORT=3306 -DB_DATABASE=bastide-resah -DB_USERNAME=root -DB_PASSWORD=LT7TYCjdUhXe0gF1 -CACHE_DRIVER=redis diff --git a/.gitignore b/.gitignore index fb7e227..7fe978f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /vendor .env .env.backup +.env.production .phpunit.result.cache Homestead.json Homestead.yaml diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php new file mode 100644 index 0000000..e6b9960 --- /dev/null +++ b/app/Console/Kernel.php @@ -0,0 +1,27 @@ +command('inspire')->hourly(); + } + + /** + * Register the commands for the application. + */ + protected function commands(): void + { + $this->load(__DIR__.'/Commands'); + + require base_path('routes/console.php'); + } +} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php new file mode 100644 index 0000000..56af264 --- /dev/null +++ b/app/Exceptions/Handler.php @@ -0,0 +1,30 @@ + + */ + protected $dontFlash = [ + 'current_password', + 'password', + 'password_confirmation', + ]; + + /** + * Register the exception handling callbacks for the application. + */ + public function register(): void + { + $this->reportable(function (Throwable $e) { + // + }); + } +} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 8677cd5..77ec359 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,7 +2,11 @@ namespace App\Http\Controllers; -abstract class Controller +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Routing\Controller as BaseController; + +class Controller extends BaseController { - // + use AuthorizesRequests, ValidatesRequests; } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php new file mode 100644 index 0000000..494c050 --- /dev/null +++ b/app/Http/Kernel.php @@ -0,0 +1,68 @@ + + */ + protected $middleware = [ + // \App\Http\Middleware\TrustHosts::class, + \App\Http\Middleware\TrustProxies::class, + \Illuminate\Http\Middleware\HandleCors::class, + \App\Http\Middleware\PreventRequestsDuringMaintenance::class, + \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, + \App\Http\Middleware\TrimStrings::class, + \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + ]; + + /** + * The application's route middleware groups. + * + * @var array> + */ + protected $middlewareGroups = [ + 'web' => [ + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + \App\Http\Middleware\VerifyCsrfToken::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + + 'api' => [ + // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + ]; + + /** + * The application's middleware aliases. + * + * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. + * + * @var array + */ + protected $middlewareAliases = [ + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, + 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, + 'signed' => \App\Http\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + ]; +} diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php new file mode 100644 index 0000000..d4ef644 --- /dev/null +++ b/app/Http/Middleware/Authenticate.php @@ -0,0 +1,17 @@ +expectsJson() ? null : route('login'); + } +} diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php new file mode 100644 index 0000000..867695b --- /dev/null +++ b/app/Http/Middleware/EncryptCookies.php @@ -0,0 +1,17 @@ + + */ + protected $except = [ + // + ]; +} diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php new file mode 100644 index 0000000..74cbd9a --- /dev/null +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -0,0 +1,17 @@ + + */ + protected $except = [ + // + ]; +} diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php new file mode 100644 index 0000000..afc78c4 --- /dev/null +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -0,0 +1,30 @@ +check()) { + return redirect(RouteServiceProvider::HOME); + } + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php new file mode 100644 index 0000000..88cadca --- /dev/null +++ b/app/Http/Middleware/TrimStrings.php @@ -0,0 +1,19 @@ + + */ + protected $except = [ + 'current_password', + 'password', + 'password_confirmation', + ]; +} diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php new file mode 100644 index 0000000..c9c58bd --- /dev/null +++ b/app/Http/Middleware/TrustHosts.php @@ -0,0 +1,20 @@ + + */ + public function hosts(): array + { + return [ + $this->allSubdomainsOfApplicationUrl(), + ]; + } +} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php new file mode 100644 index 0000000..3391630 --- /dev/null +++ b/app/Http/Middleware/TrustProxies.php @@ -0,0 +1,28 @@ +|string|null + */ + protected $proxies; + + /** + * The headers that should be used to detect proxies. + * + * @var int + */ + protected $headers = + Request::HEADER_X_FORWARDED_FOR | + Request::HEADER_X_FORWARDED_HOST | + Request::HEADER_X_FORWARDED_PORT | + Request::HEADER_X_FORWARDED_PROTO | + Request::HEADER_X_FORWARDED_AWS_ELB; +} diff --git a/app/Http/Middleware/ValidateSignature.php b/app/Http/Middleware/ValidateSignature.php new file mode 100644 index 0000000..093bf64 --- /dev/null +++ b/app/Http/Middleware/ValidateSignature.php @@ -0,0 +1,22 @@ + + */ + protected $except = [ + // 'fbclid', + // 'utm_campaign', + // 'utm_content', + // 'utm_medium', + // 'utm_source', + // 'utm_term', + ]; +} diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php new file mode 100644 index 0000000..9e86521 --- /dev/null +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -0,0 +1,17 @@ + + */ + protected $except = [ + // + ]; +} diff --git a/app/Models/User.php b/app/Models/User.php index def621f..4d7f70f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,10 +6,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { - use HasFactory, Notifiable; + use HasApiTokens, HasFactory, Notifiable; /** * The attributes that are mass assignable. @@ -33,15 +34,12 @@ class User extends Authenticatable ]; /** - * Get the attributes that should be cast. + * The attributes that should be cast. * - * @return array + * @var array */ - protected function casts(): array - { - return [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - } + protected $casts = [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php new file mode 100644 index 0000000..54756cd --- /dev/null +++ b/app/Providers/AuthServiceProvider.php @@ -0,0 +1,26 @@ + + */ + protected $policies = [ + // + ]; + + /** + * Register any authentication / authorization services. + */ + public function boot(): void + { + // + } +} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php new file mode 100644 index 0000000..2be04f5 --- /dev/null +++ b/app/Providers/BroadcastServiceProvider.php @@ -0,0 +1,19 @@ +> + */ + protected $listen = [ + Registered::class => [ + SendEmailVerificationNotification::class, + ], + ]; + + /** + * Register any events for your application. + */ + public function boot(): void + { + // + } + + /** + * Determine if events and listeners should be automatically discovered. + */ + public function shouldDiscoverEvents(): bool + { + return false; + } +} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..1cf5f15 --- /dev/null +++ b/app/Providers/RouteServiceProvider.php @@ -0,0 +1,40 @@ +by($request->user()?->id ?: $request->ip()); + }); + + $this->routes(function () { + Route::middleware('api') + ->prefix('api') + ->group(base_path('routes/api.php')); + + Route::middleware('web') + ->group(base_path('routes/web.php')); + }); + } +} diff --git a/artisan b/artisan index 8e04b42..67a3329 100644 --- a/artisan +++ b/artisan @@ -1,15 +1,53 @@ #!/usr/bin/env php handleCommand(new ArgvInput); +$app = require_once __DIR__.'/bootstrap/app.php'; + +/* +|-------------------------------------------------------------------------- +| Run The Artisan Application +|-------------------------------------------------------------------------- +| +| When we run the console application, the current CLI command will be +| executed in this console and the response sent back to a terminal +| or another output device for the developers. Here goes nothing! +| +*/ + +$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); + +$status = $kernel->handle( + $input = new Symfony\Component\Console\Input\ArgvInput, + new Symfony\Component\Console\Output\ConsoleOutput +); + +/* +|-------------------------------------------------------------------------- +| Shutdown The Application +|-------------------------------------------------------------------------- +| +| Once Artisan has finished running, we will fire off the shutdown events +| so that any final work may be done by the application before we shut +| down the process. This is the last thing to happen to the request. +| +*/ + +$kernel->terminate($input, $status); exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index 7b162da..037e17d 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,18 +1,55 @@ withRouting( - web: __DIR__.'/../routes/web.php', - commands: __DIR__.'/../routes/console.php', - health: '/up', - ) - ->withMiddleware(function (Middleware $middleware) { - // - }) - ->withExceptions(function (Exceptions $exceptions) { - // - })->create(); +/* +|-------------------------------------------------------------------------- +| Create The Application +|-------------------------------------------------------------------------- +| +| The first thing we will do is create a new Laravel application instance +| which serves as the "glue" for all the components of Laravel, and is +| the IoC container for the system binding all of the various parts. +| +*/ + +$app = new Illuminate\Foundation\Application( + $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) +); + +/* +|-------------------------------------------------------------------------- +| Bind Important Interfaces +|-------------------------------------------------------------------------- +| +| Next, we need to bind some important interfaces into the container so +| we will be able to resolve them when needed. The kernels serve the +| incoming requests to this application from both the web and CLI. +| +*/ + +$app->singleton( + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); + +/* +|-------------------------------------------------------------------------- +| Return The Application +|-------------------------------------------------------------------------- +| +| This script returns the application instance. The instance is given to +| the calling script so we can separate the building of the instances +| from the actual running of the application and sending responses. +| +*/ + +return $app; diff --git a/bootstrap/providers.php b/bootstrap/providers.php deleted file mode 100644 index 38b258d..0000000 --- a/bootstrap/providers.php +++ /dev/null @@ -1,5 +0,0 @@ -=11.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.3.0", + "laravel/framework": "^10.28.0", + "laravel/pint": "^1.13.3", + "laravel/sail": "^1.25.0", + "laravel/sanctum": "^3.3.1", + "laravel/tinker": "^2.8.2", + "nunomaduro/larastan": "^2.6.4", + "orchestra/testbench-core": "^8.13.0", + "pestphp/pest": "^2.23.2", + "phpunit/phpunit": "^10.4.1", + "sebastian/environment": "^6.0.1", + "spatie/laravel-ignition": "^2.3.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ], + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2023-10-11T15:45:01+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -13367,8 +13600,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.6.0" } diff --git a/config/app.php b/config/app.php index f467267..9207160 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,8 @@ env('APP_URL', 'http://localhost'), + 'asset_url' => env('ASSET_URL'), + /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. The timezone - | is set to "UTC" by default as it is suitable for most use cases. + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. | */ - 'timezone' => env('APP_TIMEZONE', 'UTC'), + 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- @@ -73,37 +78,53 @@ return [ |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used - | by Laravel's translation / localization methods. This option can be - | set to any locale for which you plan to have translation strings. + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. | */ - 'locale' => env('APP_LOCALE', 'en'), + 'locale' => 'en', - 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ - 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), + 'fallback_locale' => 'en', /* |-------------------------------------------------------------------------- - | Encryption Key + | Faker Locale |-------------------------------------------------------------------------- | - | This key is utilized by Laravel's encryption services and should be set - | to a random, 32 character string to ensure that all encrypted values - | are secure. You should do this prior to deploying the application. + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. | */ - 'cipher' => 'AES-256-CBC', + 'faker_locale' => 'en_US', + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ 'key' => env('APP_KEY'), - 'previous_keys' => [ - ...array_filter( - explode(',', env('APP_PREVIOUS_KEYS', '')) - ), - ], + 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- @@ -119,8 +140,49 @@ return [ */ 'maintenance' => [ - 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), - 'store' => env('APP_MAINTENANCE_STORE', 'database'), + 'driver' => 'file', + // 'store' => 'redis', ], + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ + + 'providers' => ServiceProvider::defaultProviders()->merge([ + /* + * Package Service Providers... + */ + + /* + * Application Service Providers... + */ + App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\RouteServiceProvider::class, + ])->toArray(), + + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ + + 'aliases' => Facade::defaultAliases()->merge([ + // 'Example' => App\Facades\Example::class, + ])->toArray(), + ]; diff --git a/config/auth.php b/config/auth.php index 0ba5d5d..9548c15 100644 --- a/config/auth.php +++ b/config/auth.php @@ -7,15 +7,15 @@ return [ | Authentication Defaults |-------------------------------------------------------------------------- | - | This option defines the default authentication "guard" and password - | reset "broker" for your application. You may change these values + | This option controls the default authentication "guard" and password + | reset options for your application. You may change these defaults | as required, but they're a perfect start for most applications. | */ 'defaults' => [ - 'guard' => env('AUTH_GUARD', 'web'), - 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), + 'guard' => 'web', + 'passwords' => 'users', ], /* @@ -25,11 +25,11 @@ return [ | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you - | which utilizes session storage plus the Eloquent user provider. + | here which uses session storage and the Eloquent user provider. | - | All authentication guards have a user provider, which defines how the + | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage - | system used by the application. Typically, Eloquent is utilized. + | mechanisms used by this application to persist your user's data. | | Supported: "session" | @@ -47,12 +47,12 @@ return [ | User Providers |-------------------------------------------------------------------------- | - | All authentication guards have a user provider, which defines how the + | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage - | system used by the application. Typically, Eloquent is utilized. + | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple - | providers to represent the model / table. These providers may then + | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" @@ -62,7 +62,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => env('AUTH_MODEL', App\Models\User::class), + 'model' => App\Models\User::class, ], // 'users' => [ @@ -76,9 +76,9 @@ return [ | Resetting Passwords |-------------------------------------------------------------------------- | - | These configuration options specify the behavior of Laravel's password - | reset functionality, including the table utilized for token storage - | and the user provider that is invoked to actually retrieve users. + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | separate password reset settings based on the specific user types. | | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so @@ -93,7 +93,7 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], @@ -105,11 +105,11 @@ return [ |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation - | window expires and users are asked to re-enter their password via the + | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ - 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), + 'password_timeout' => 10800, ]; diff --git a/config/broadcasting.php b/config/broadcasting.php new file mode 100644 index 0000000..2410485 --- /dev/null +++ b/config/broadcasting.php @@ -0,0 +1,71 @@ + env('BROADCAST_DRIVER', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), + 'encrypted' => true, + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', + ], + 'client_options' => [ + // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html + ], + ], + + 'ably' => [ + 'driver' => 'ably', + 'key' => env('ABLY_KEY'), + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + + ], + +]; diff --git a/config/cache.php b/config/cache.php index 3868091..d4171e2 100644 --- a/config/cache.php +++ b/config/cache.php @@ -9,13 +9,13 @@ return [ | Default Cache Store |-------------------------------------------------------------------------- | - | This option controls the default cache store that will be used by the - | framework. This connection is utilized if another isn't explicitly - | specified when running a cache operation inside the application. + | This option controls the default cache connection that gets used while + | using this caching library. This connection is used when another is + | not explicitly specified when executing a given caching function. | */ - 'default' => env('CACHE_STORE', 'database'), + 'default' => env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- @@ -26,13 +26,17 @@ return [ | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | - | Supported drivers: "apc", "array", "database", "file", "memcached", - | "redis", "dynamodb", "octane", "null" + | Supported drivers: "apc", "array", "database", "file", + | "memcached", "redis", "dynamodb", "octane", "null" | */ 'stores' => [ + 'apc' => [ + 'driver' => 'apc', + ], + 'array' => [ 'driver' => 'array', 'serialize' => false, @@ -40,9 +44,9 @@ return [ 'database' => [ 'driver' => 'database', - 'table' => env('DB_CACHE_TABLE', 'cache'), - 'connection' => env('DB_CACHE_CONNECTION'), - 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), + 'table' => 'cache', + 'connection' => null, + 'lock_connection' => null, ], 'file' => [ @@ -72,8 +76,8 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), - 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), + 'connection' => 'cache', + 'lock_connection' => 'default', ], 'dynamodb' => [ @@ -96,8 +100,8 @@ return [ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing the APC, database, memcached, Redis, and DynamoDB cache - | stores, there might be other applications using the same cache. For + | When utilizing the APC, database, memcached, Redis, or DynamoDB cache + | stores there might be other applications using the same cache. For | that reason, you may prefix every cache key to avoid collisions. | */ diff --git a/config/cors.php b/config/cors.php new file mode 100644 index 0000000..8a39e6d --- /dev/null +++ b/config/cors.php @@ -0,0 +1,34 @@ + ['api/*', 'sanctum/csrf-cookie'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => false, + +]; diff --git a/config/database.php b/config/database.php index f8e8dcb..137ad18 100644 --- a/config/database.php +++ b/config/database.php @@ -10,22 +10,26 @@ return [ |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish - | to use as your default connection for database operations. This is - | the connection which will be utilized unless another connection - | is explicitly specified when you execute a query / statement. + | to use as your default connection for all database work. Of course + | you may use many connections at once using the Database library. | */ - 'default' => env('DB_CONNECTION', 'sqlite'), + 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | - | Below are all of the database connections defined for your application. - | An example configuration is provided for each database system which - | is supported by Laravel. You're free to add / remove connections. + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. | */ @@ -33,7 +37,7 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', - 'url' => env('DB_URL'), + 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), @@ -41,35 +45,15 @@ return [ 'mysql' => [ 'driver' => 'mysql', - 'url' => env('DB_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => env('DB_CHARSET', 'utf8mb4'), - 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], - ], - - 'mariadb' => [ - 'driver' => 'mariadb', - 'url' => env('DB_URL'), + 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => env('DB_CHARSET', 'utf8mb4'), - 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, @@ -81,13 +65,13 @@ return [ 'pgsql' => [ 'driver' => 'pgsql', - 'url' => env('DB_URL'), + 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => env('DB_CHARSET', 'utf8'), + 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'search_path' => 'public', @@ -96,13 +80,13 @@ return [ 'sqlsrv' => [ 'driver' => 'sqlsrv', - 'url' => env('DB_URL'), + 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'laravel'), - 'username' => env('DB_USERNAME', 'root'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => env('DB_CHARSET', 'utf8'), + 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, // 'encrypt' => env('DB_ENCRYPT', 'yes'), @@ -118,14 +102,11 @@ return [ | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run on the database. + | the migrations on disk haven't actually been run in the database. | */ - 'migrations' => [ - 'table' => 'migrations', - 'update_date_on_publish' => true, - ], + 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- @@ -134,7 +115,7 @@ return [ | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system - | such as Memcached. You may define your connection settings here. + | such as APC or Memcached. Laravel makes it easy to dig right in. | */ diff --git a/config/filesystems.php b/config/filesystems.php index 44fe9c8..e9d9dbd 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -9,7 +9,7 @@ return [ | | Here you may specify the default filesystem disk that should be used | by the framework. The "local" disk, as well as a variety of cloud - | based disks are available to your application for file storage. + | based disks are available to your application. Just store away! | */ @@ -20,9 +20,9 @@ return [ | Filesystem Disks |-------------------------------------------------------------------------- | - | Below you may configure as many filesystem disks as necessary, and you - | may even configure multiple disks for the same driver. Examples for - | most supported storage drivers are configured here for reference. + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been set up for each driver as an example of the required values. | | Supported Drivers: "local", "ftp", "sftp", "s3" | diff --git a/config/hashing.php b/config/hashing.php new file mode 100644 index 0000000..0e8a0bb --- /dev/null +++ b/config/hashing.php @@ -0,0 +1,54 @@ + 'bcrypt', + + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 12), + 'verify' => true, + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 65536, + 'threads' => 1, + 'time' => 4, + 'verify' => true, + ], + +]; diff --git a/config/logging.php b/config/logging.php index d526b64..c44d276 100644 --- a/config/logging.php +++ b/config/logging.php @@ -12,9 +12,9 @@ return [ | Default Log Channel |-------------------------------------------------------------------------- | - | This option defines the default log channel that is utilized to write - | messages to your logs. The value provided here should match one of - | the channels present in the list of "channels" configured below. + | This option defines the default log channel that gets used when writing + | messages to the logs. The name specified in this option should match + | one of the channels defined in the "channels" configuration array. | */ @@ -33,7 +33,7 @@ return [ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => env('LOG_DEPRECATIONS_TRACE', false), + 'trace' => false, ], /* @@ -41,20 +41,20 @@ return [ | Log Channels |-------------------------------------------------------------------------- | - | Here you may configure the log channels for your application. Laravel - | utilizes the Monolog PHP logging library, which includes a variety - | of powerful log handlers and formatters that you're free to use. + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", "custom", "stack" + | "errorlog", "monolog", + | "custom", "stack" | */ 'channels' => [ - 'stack' => [ 'driver' => 'stack', - 'channels' => explode(',', env('LOG_STACK', 'single')), + 'channels' => ['single'], 'ignore_exceptions' => false, ], @@ -69,15 +69,15 @@ return [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), - 'days' => env('LOG_DAILY_DAYS', 14), + 'days' => 14, 'replace_placeholders' => true, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), - 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), 'replace_placeholders' => true, ], @@ -108,7 +108,7 @@ return [ 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), + 'facility' => LOG_USER, 'replace_placeholders' => true, ], @@ -126,7 +126,6 @@ return [ 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], - ], ]; diff --git a/config/mail.php b/config/mail.php index 8666659..e894b2e 100644 --- a/config/mail.php +++ b/config/mail.php @@ -7,14 +7,13 @@ return [ | Default Mailer |-------------------------------------------------------------------------- | - | This option controls the default mailer that is used to send all email - | messages unless another mailer is explicitly specified when sending - | the message. All additional mailers can be configured within the - | "mailers" array. Examples of each type of mailer are provided. + | This option controls the default mailer that is used to send any email + | messages sent by your application. Alternative mailers may be setup + | and used as needed; however, this mailer will be used by default. | */ - 'default' => env('MAIL_MAILER', 'log'), + 'default' => env('MAIL_MAILER', 'smtp'), /* |-------------------------------------------------------------------------- @@ -25,9 +24,9 @@ return [ | their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | - | Laravel supports a variety of mail "transport" drivers that can be used - | when delivering an email. You may specify which one you're using for - | your mailers below. You may also add additional mailers if needed. + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover", "roundrobin" @@ -35,12 +34,11 @@ return [ */ 'mailers' => [ - 'smtp' => [ 'transport' => 'smtp', 'url' => env('MAIL_URL'), - 'host' => env('MAIL_HOST', '127.0.0.1'), - 'port' => env('MAIL_PORT', 2525), + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), @@ -54,7 +52,14 @@ return [ 'postmark' => [ 'transport' => 'postmark', - // 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), + // 'message_stream_id' => null, + // 'client' => [ + // 'timeout' => 5, + // ], + ], + + 'mailgun' => [ + 'transport' => 'mailgun', // 'client' => [ // 'timeout' => 5, // ], @@ -89,7 +94,6 @@ return [ 'postmark', ], ], - ], /* @@ -97,9 +101,9 @@ return [ | Global "From" Address |-------------------------------------------------------------------------- | - | You may wish for all emails sent by your application to be sent from - | the same address. Here you may specify a name and address that is - | used globally for all emails that are sent by your application. + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. | */ @@ -108,4 +112,23 @@ return [ 'name' => env('MAIL_FROM_NAME', 'Example'), ], + /* + |-------------------------------------------------------------------------- + | Markdown Mail Settings + |-------------------------------------------------------------------------- + | + | If you are using Markdown based email rendering, you may configure your + | theme and component paths here, allowing you to customize the design + | of the emails. Or, you may simply stick with the Laravel defaults! + | + */ + + 'markdown' => [ + 'theme' => 'default', + + 'paths' => [ + resource_path('views/vendor/mail'), + ], + ], + ]; diff --git a/config/queue.php b/config/queue.php index 116bd8d..01c6b05 100644 --- a/config/queue.php +++ b/config/queue.php @@ -7,22 +7,22 @@ return [ | Default Queue Connection Name |-------------------------------------------------------------------------- | - | Laravel's queue supports a variety of backends via a single, unified - | API, giving you convenient access to each backend using identical - | syntax for each. The default queue connection is defined below. + | Laravel's queue API supports an assortment of back-ends via a single + | API, giving you convenient access to each back-end using the same + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_CONNECTION', 'database'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | - | Here you may configure the connection options for every queue backend - | used by your application. An example configuration is provided for - | each backend supported by Laravel. You're also free to add more. + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | @@ -36,18 +36,17 @@ return [ 'database' => [ 'driver' => 'database', - 'connection' => env('DB_QUEUE_CONNECTION'), - 'table' => env('DB_QUEUE_TABLE', 'jobs'), - 'queue' => env('DB_QUEUE', 'default'), - 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', - 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), - 'queue' => env('BEANSTALKD_QUEUE', 'default'), - 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, 'block_for' => 0, 'after_commit' => false, ], @@ -65,9 +64,9 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), + 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), + 'retry_after' => 90, 'block_for' => null, 'after_commit' => false, ], @@ -86,7 +85,7 @@ return [ */ 'batching' => [ - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'job_batches', ], @@ -96,16 +95,14 @@ return [ |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you - | can control how and where failed jobs are stored. Laravel ships with - | support for storing failed jobs in a simple file or in a database. - | - | Supported drivers: "database-uuids", "dynamodb", "file", "null" + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], diff --git a/config/sanctum.php b/config/sanctum.php new file mode 100644 index 0000000..35d75b3 --- /dev/null +++ b/config/sanctum.php @@ -0,0 +1,83 @@ + explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', + Sanctum::currentApplicationUrlWithPort() + ))), + + /* + |-------------------------------------------------------------------------- + | Sanctum Guards + |-------------------------------------------------------------------------- + | + | This array contains the authentication guards that will be checked when + | Sanctum is trying to authenticate a request. If none of these guards + | are able to authenticate the request, Sanctum will use the bearer + | token that's present on an incoming request for authentication. + | + */ + + 'guard' => ['web'], + + /* + |-------------------------------------------------------------------------- + | Expiration Minutes + |-------------------------------------------------------------------------- + | + | This value controls the number of minutes until an issued token will be + | considered expired. This will override any values set in the token's + | "expires_at" attribute, but first-party sessions are not affected. + | + */ + + 'expiration' => null, + + /* + |-------------------------------------------------------------------------- + | Token Prefix + |-------------------------------------------------------------------------- + | + | Sanctum can prefix new tokens in order to take advantage of numerous + | security scanning initiatives maintained by open source platforms + | that notify developers if they commit tokens into repositories. + | + | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning + | + */ + + 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), + + /* + |-------------------------------------------------------------------------- + | Sanctum Middleware + |-------------------------------------------------------------------------- + | + | When authenticating your first-party SPA with Sanctum you may need to + | customize some of the middleware Sanctum uses while processing the + | request. You may change the middleware listed below as required. + | + */ + + 'middleware' => [ + 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, + 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, + 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, + ], + +]; diff --git a/config/services.php b/config/services.php index 6bb68f6..0ace530 100644 --- a/config/services.php +++ b/config/services.php @@ -14,6 +14,13 @@ return [ | */ + 'mailgun' => [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + 'scheme' => 'https', + ], + 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], @@ -24,11 +31,4 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], - 'slack' => [ - 'notifications' => [ - 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), - 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), - ], - ], - ]; diff --git a/config/session.php b/config/session.php index f0b6541..e738cb3 100644 --- a/config/session.php +++ b/config/session.php @@ -9,16 +9,16 @@ return [ | Default Session Driver |-------------------------------------------------------------------------- | - | This option determines the default session driver that is utilized for - | incoming requests. Laravel supports a variety of storage options to - | persist session data. Database storage is a great default choice. + | This option controls the default session "driver" that will be used on + | requests. By default, we will use the lightweight native driver but + | you may specify any of the other wonderful drivers provided here. | | Supported: "file", "cookie", "database", "apc", | "memcached", "redis", "dynamodb", "array" | */ - 'driver' => env('SESSION_DRIVER', 'database'), + 'driver' => env('SESSION_DRIVER', 'file'), /* |-------------------------------------------------------------------------- @@ -27,14 +27,13 @@ return [ | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them - | to expire immediately when the browser is closed then you may - | indicate that via the expire_on_close configuration option. + | to immediately expire on the browser closing, set that option. | */ 'lifetime' => env('SESSION_LIFETIME', 120), - 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), + 'expire_on_close' => false, /* |-------------------------------------------------------------------------- @@ -42,21 +41,21 @@ return [ |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data - | should be encrypted before it's stored. All encryption is performed - | automatically by Laravel and you may use the session like normal. + | should be encrypted before it is stored. All encryption will be run + | automatically by Laravel and you can use the Session like normal. | */ - 'encrypt' => env('SESSION_ENCRYPT', false), + 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | - | When utilizing the "file" session driver, the session files are placed - | on disk. The default storage location is defined here; however, you - | are free to provide another location where they should be stored. + | When using the native session driver, we need a location where session + | files may be stored. A default has been set for you but a different + | location may be specified. This is only needed for file sessions. | */ @@ -80,22 +79,22 @@ return [ | Session Database Table |-------------------------------------------------------------------------- | - | When using the "database" session driver, you may specify the table to - | be used to store sessions. Of course, a sensible default is defined - | for you; however, you're welcome to change this to another table. + | When using the "database" session driver, you may specify the table we + | should use to manage the sessions. Of course, a sensible default is + | provided for you; however, you are free to change this as needed. | */ - 'table' => env('SESSION_TABLE', 'sessions'), + 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | - | When using one of the framework's cache driven session backends, you may - | define the cache store which should be used to store the session data - | between requests. This must match one of your defined cache stores. + | While using one of the framework's cache driven session backends you may + | list a cache store that should be used for these sessions. This value + | must match with one of the application's configured cache "stores". | | Affects: "apc", "dynamodb", "memcached", "redis" | @@ -121,9 +120,9 @@ return [ | Session Cookie Name |-------------------------------------------------------------------------- | - | Here you may change the name of the session cookie that is created by - | the framework. Typically, you should not need to change this value - | since doing so does not grant a meaningful security improvement. + | Here you may change the name of the cookie used to identify a session + | instance by ID. The name specified here will get used every time a + | new session cookie is created by the framework for every driver. | */ @@ -139,20 +138,20 @@ return [ | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of - | your application, but you're free to change this when necessary. + | your application but you are free to change this when necessary. | */ - 'path' => env('SESSION_PATH', '/'), + 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | - | This value determines the domain and subdomains the session cookie is - | available to. By default, the cookie will be available to the root - | domain and all subdomains. Typically, this shouldn't be changed. + | Here you may change the domain of the cookie used to identify a session + | in your application. This will determine which domains the cookie is + | available to in your application. A sensible default has been set. | */ @@ -178,11 +177,11 @@ return [ | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. It's unlikely you should disable this option. + | the HTTP protocol. You are free to modify this option if needed. | */ - 'http_only' => env('SESSION_HTTP_ONLY', true), + 'http_only' => true, /* |-------------------------------------------------------------------------- @@ -191,15 +190,13 @@ return [ | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we - | will set this value to "lax" to permit secure cross-site requests. - | - | See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value + | will set this value to "lax" since this is a secure default value. | | Supported: "lax", "strict", "none", null | */ - 'same_site' => env('SESSION_SAME_SITE', 'lax'), + 'same_site' => 'lax', /* |-------------------------------------------------------------------------- @@ -212,6 +209,6 @@ return [ | */ - 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false), + 'partitioned' => false, ]; diff --git a/config/view.php b/config/view.php new file mode 100644 index 0000000..22b8a18 --- /dev/null +++ b/config/view.php @@ -0,0 +1,36 @@ + [ + resource_path('views'), + ], + + /* + |-------------------------------------------------------------------------- + | Compiled View Path + |-------------------------------------------------------------------------- + | + | This option determines where all the compiled Blade templates will be + | stored for your application. Typically, this is within the storage + | directory. However, as usual, you are free to change this value. + | + */ + + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), + +]; diff --git a/database/migrations/0001_01_01_000001_create_cache_table.php b/database/migrations/0001_01_01_000001_create_cache_table.php deleted file mode 100644 index b9c106b..0000000 --- a/database/migrations/0001_01_01_000001_create_cache_table.php +++ /dev/null @@ -1,35 +0,0 @@ -string('key')->primary(); - $table->mediumText('value'); - $table->integer('expiration'); - }); - - Schema::create('cache_locks', function (Blueprint $table) { - $table->string('key')->primary(); - $table->string('owner'); - $table->integer('expiration'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('cache'); - Schema::dropIfExists('cache_locks'); - } -}; diff --git a/database/migrations/0001_01_01_000002_create_jobs_table.php b/database/migrations/0001_01_01_000002_create_jobs_table.php deleted file mode 100644 index 425e705..0000000 --- a/database/migrations/0001_01_01_000002_create_jobs_table.php +++ /dev/null @@ -1,57 +0,0 @@ -id(); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - - Schema::create('job_batches', function (Blueprint $table) { - $table->string('id')->primary(); - $table->string('name'); - $table->integer('total_jobs'); - $table->integer('pending_jobs'); - $table->integer('failed_jobs'); - $table->longText('failed_job_ids'); - $table->mediumText('options')->nullable(); - $table->integer('cancelled_at')->nullable(); - $table->integer('created_at'); - $table->integer('finished_at')->nullable(); - }); - - Schema::create('failed_jobs', function (Blueprint $table) { - $table->id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('jobs'); - Schema::dropIfExists('job_batches'); - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php similarity index 50% rename from database/migrations/0001_01_01_000000_create_users_table.php rename to database/migrations/2014_10_12_000000_create_users_table.php index 05fb5d9..444fafb 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -20,21 +20,6 @@ return new class extends Migration $table->rememberToken(); $table->timestamps(); }); - - Schema::create('password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - - Schema::create('sessions', function (Blueprint $table) { - $table->string('id')->primary(); - $table->foreignId('user_id')->nullable()->index(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent')->nullable(); - $table->longText('payload'); - $table->integer('last_activity')->index(); - }); } /** @@ -43,7 +28,5 @@ return new class extends Migration public function down(): void { Schema::dropIfExists('users'); - Schema::dropIfExists('password_reset_tokens'); - Schema::dropIfExists('sessions'); } }; diff --git a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php new file mode 100644 index 0000000..81a7229 --- /dev/null +++ b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -0,0 +1,28 @@ +string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('password_reset_tokens'); + } +}; diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php new file mode 100644 index 0000000..249da81 --- /dev/null +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('failed_jobs'); + } +}; diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php new file mode 100644 index 0000000..e828ad8 --- /dev/null +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -0,0 +1,33 @@ +id(); + $table->morphs('tokenable'); + $table->string('name'); + $table->string('token', 64)->unique(); + $table->text('abilities')->nullable(); + $table->timestamp('last_used_at')->nullable(); + $table->timestamp('expires_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('personal_access_tokens'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index d01a0ef..a9f4519 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,7 +2,6 @@ namespace Database\Seeders; -use App\Models\User; // use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; @@ -13,11 +12,11 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - // User::factory(10)->create(); + // \App\Models\User::factory(10)->create(); - User::factory()->create([ - 'name' => 'Test User', - 'email' => 'test@example.com', - ]); + // \App\Models\User::factory()->create([ + // 'name' => 'Test User', + // 'email' => 'test@example.com', + // ]); } } diff --git a/package.json b/package.json index 4e934ca..56f5ddc 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "axios": "^1.6.4", - "laravel-vite-plugin": "^1.0", - "vite": "^5.0" + "laravel-vite-plugin": "^1.0.0", + "vite": "^5.0.0" } } diff --git a/phpunit.xml b/phpunit.xml index 506b9a3..bc86714 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,9 +19,8 @@ - - + diff --git a/public/index.php b/public/index.php index 947d989..1d69f3a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,17 +1,55 @@ handleRequest(Request::capture()); +/* +|-------------------------------------------------------------------------- +| Run The Application +|-------------------------------------------------------------------------- +| +| Once we have the application, we can handle the incoming request using +| the application's HTTP kernel. Then, we will send the response back +| to this client's browser, allowing them to enjoy our application. +| +*/ + +$app = require_once __DIR__.'/../bootstrap/app.php'; + +$kernel = $app->make(Kernel::class); + +$response = $kernel->handle( + $request = Request::capture() +)->send(); + +$kernel->terminate($request, $response); diff --git a/public/info.php b/public/info.php deleted file mode 100644 index 61ace19..0000000 --- a/public/info.php +++ /dev/null @@ -1,2 +0,0 @@ - - -
- -
-
-
-
- -
- @if (Route::has('login')) - + +
+ @if (Route::has('login')) +
+ @auth + Home + @else + Log in + + @if (Route::has('register')) + Register @endif -
- -
-
- -
- Laravel documentation screenshot - -
+ @endauth +
+ @endif + +
+
+ + + +
+ +
+
+ + - - - -
+
+
+ +
+
+   +
-
+
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) -
+
diff --git a/routes/api.php b/routes/api.php new file mode 100644 index 0000000..889937e --- /dev/null +++ b/routes/api.php @@ -0,0 +1,19 @@ +get('/user', function (Request $request) { + return $request->user(); +}); diff --git a/routes/channels.php b/routes/channels.php new file mode 100644 index 0000000..1f87c11 --- /dev/null +++ b/routes/channels.php @@ -0,0 +1,18 @@ +id === (int) $id; +}); diff --git a/routes/console.php b/routes/console.php index eff2ed2..e05f4c9 100644 --- a/routes/console.php +++ b/routes/console.php @@ -3,6 +3,17 @@ use Illuminate\Foundation\Inspiring; use Illuminate\Support\Facades\Artisan; +/* +|-------------------------------------------------------------------------- +| Console Routes +|-------------------------------------------------------------------------- +| +| This file is where you may define all of your Closure based console +| commands. Each Closure is bound to a command instance allowing a +| simple approach to interacting with each command's IO methods. +| +*/ + Artisan::command('inspire', function () { $this->comment(Inspiring::quote()); -})->purpose('Display an inspiring quote')->hourly(); +})->purpose('Display an inspiring quote'); diff --git a/routes/web.php b/routes/web.php index 86a06c5..d259f33 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,17 @@ use Illuminate\Support\Facades\Route; +/* +|-------------------------------------------------------------------------- +| Web Routes +|-------------------------------------------------------------------------- +| +| Here is where you can register web routes for your application. These +| routes are loaded by the RouteServiceProvider and all of them will +| be assigned to the "web" middleware group. Make something great! +| +*/ + Route::get('/', function () { return view('welcome'); }); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php new file mode 100644 index 0000000..cc68301 --- /dev/null +++ b/tests/CreatesApplication.php @@ -0,0 +1,21 @@ +make(Kernel::class)->bootstrap(); + + return $app; + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index fe1ffc2..2932d4a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,5 +6,5 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { - // + use CreatesApplication; } -- 2.39.5