diff --git a/.env.example b/.env.example index 86c7167..04dc455 100644 --- a/.env.example +++ b/.env.example @@ -47,6 +47,9 @@ AWS_USE_PATH_STYLE_ENDPOINT=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= +PUSHER_APP_CLUSTER=mt1PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" @@ -56,3 +59,9 @@ SANCTUM_STATEFUL_DOMAINS="localhost,localhost:3000,localhost:8000,127.0.0.1,127. DEFAULT_ROLE_SLUG=user DELETE_PREVIOUS_ACCESS_TOKENS_ON_LOGIN=false + +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_HOST="${PUSHER_HOST}" +VITE_PUSHER_PORT="${PUSHER_PORT}" +VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/.gitattributes b/.gitattributes index 510d996..fcb21d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -* text=auto +* text=auto eol=lf *.blade.php diff=html *.css diff=css @@ -8,3 +8,4 @@ /.github export-ignore CHANGELOG.md export-ignore +.styleci.yml export-ignore diff --git a/.gitignore b/.gitignore index d3c208f..595c900 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,20 @@ +/.phpunit.cache /node_modules +/public/build /public/hot /public/storage /storage/*.key /vendor .env .env.backup +.env.production .phpunit.result.cache Homestead.json Homestead.yaml +auth.json npm-debug.log yarn-error.log +/.fleet /.idea /.vscode database.sqlite diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 40d4dbf..e6b9960 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -5,23 +5,21 @@ namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -class Kernel extends ConsoleKernel { +class Kernel extends ConsoleKernel +{ /** * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void */ - protected function schedule(Schedule $schedule) { + protected function schedule(Schedule $schedule): void + { // $schedule->command('inspire')->hourly(); } /** * Register the commands for the application. - * - * @return void */ - protected function commands() { + 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 index 8c859d9..bc5839e 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -7,7 +7,8 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Laravel\Sanctum\Exceptions\MissingAbilityException; use Throwable; -class Handler extends ExceptionHandler { +class Handler extends ExceptionHandler +{ /** * A list of exception types with their corresponding custom log levels. * @@ -39,26 +40,26 @@ class Handler extends ExceptionHandler { /** * Register the exception handling callbacks for the application. - * - * @return void */ - public function register() { + public function register() : void + { $this->reportable(function (Throwable $e) { // }); } - public function render($request, Throwable $exception) { + public function render($request, Throwable $exception) + { if ($exception instanceof ModelNotFoundException) { return response([ - 'error' => 1, + 'error' => 1, 'message' => $exception->getMessage(), ], 404); } if ($exception instanceof MissingAbilityException) { return response([ - 'error' => 1, + 'error' => 1, 'message' => 'Not authorized', ], 409); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 5f1acc4..77ec359 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -3,10 +3,10 @@ namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; -class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; +class Controller extends BaseController +{ + use AuthorizesRequests, ValidatesRequests; } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 88660d3..358fe2e 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -4,7 +4,8 @@ namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; -class Kernel extends HttpKernel { +class Kernel extends HttpKernel +{ /** * The application's global HTTP middleware stack. * @@ -39,19 +40,19 @@ class Kernel extends HttpKernel { 'api' => [ \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - 'throttle:api', + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used to conveniently assign middleware to routes and groups. * * @var array */ - protected $routeMiddleware = [ + protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, @@ -59,7 +60,7 @@ class Kernel extends HttpKernel { 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'abilities' => \Laravel\Sanctum\Http\Middleware\CheckAbilities::class, diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index d8770c4..d4ef644 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -3,17 +3,15 @@ namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; +use Illuminate\Http\Request; -class Authenticate extends Middleware { +class Authenticate extends Middleware +{ /** * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string|null */ - protected function redirectTo($request) { - if (! $request->expectsJson()) { - return route('login'); - } + protected function redirectTo(Request $request): ?string + { + return $request->expectsJson() ? null : route('login'); } } diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index b8f5743..867695b 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -4,7 +4,8 @@ namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; -class EncryptCookies extends Middleware { +class EncryptCookies extends Middleware +{ /** * The names of the cookies that should not be encrypted. * diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index fe31bf9..74cbd9a 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -4,7 +4,8 @@ namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware; -class PreventRequestsDuringMaintenance extends Middleware { +class PreventRequestsDuringMaintenance extends Middleware +{ /** * The URIs that should be reachable while maintenance mode is enabled. * diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index fbd3570..afc78c4 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -6,17 +6,17 @@ use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\Response; -class RedirectIfAuthenticated { +class RedirectIfAuthenticated +{ /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @param string|null ...$guards - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ - public function handle(Request $request, Closure $next, ...$guards) { + public function handle(Request $request, Closure $next, string ...$guards): Response + { $guards = empty($guards) ? [null] : $guards; foreach ($guards as $guard) { diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index f9db2f9..88cadca 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -4,7 +4,8 @@ namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; -class TrimStrings extends Middleware { +class TrimStrings extends Middleware +{ /** * The names of the attributes that should not be trimmed. * diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index 1e9d9a1..c9c58bd 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -4,13 +4,15 @@ namespace App\Http\Middleware; use Illuminate\Http\Middleware\TrustHosts as Middleware; -class TrustHosts extends Middleware { +class TrustHosts extends Middleware +{ /** * Get the host patterns that should be trusted. * * @return array */ - public function hosts() { + public function hosts(): array + { return [ $this->allSubdomainsOfApplicationUrl(), ]; diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index cb842aa..3391630 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -5,7 +5,8 @@ namespace App\Http\Middleware; use Illuminate\Http\Middleware\TrustProxies as Middleware; use Illuminate\Http\Request; -class TrustProxies extends Middleware { +class TrustProxies extends Middleware +{ /** * The trusted proxies for this application. * 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 index 5430966..9e86521 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -4,7 +4,8 @@ namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; -class VerifyCsrfToken extends Middleware { +class VerifyCsrfToken extends Middleware +{ /** * The URIs that should be excluded from CSRF verification. * diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5a7cf2f..452e6b6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,22 +4,21 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; -class AppServiceProvider extends ServiceProvider { +class AppServiceProvider extends ServiceProvider +{ /** * Register any application services. - * - * @return void */ - public function register() { + public function register(): void + { // } /** * Bootstrap any application services. - * - * @return void */ - public function boot() { + public function boot(): void + { // } } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index b1783f4..faa84c0 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -4,7 +4,8 @@ namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; -class AuthServiceProvider extends ServiceProvider { +class AuthServiceProvider extends ServiceProvider +{ /** * The model to policy mappings for the application. * @@ -16,12 +17,9 @@ class AuthServiceProvider extends ServiceProvider { /** * Register any authentication / authorization services. - * - * @return void */ - public function boot() { - $this->registerPolicies(); - + public function boot(): void + { // } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 26a236a..2be04f5 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -5,13 +5,13 @@ namespace App\Providers; use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\ServiceProvider; -class BroadcastServiceProvider extends ServiceProvider { +class BroadcastServiceProvider extends ServiceProvider +{ /** * Bootstrap any application services. - * - * @return void */ - public function boot() { + public function boot(): void + { Broadcast::routes(); require base_path('routes/channels.php'); diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 591e739..2d65aac 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -7,7 +7,8 @@ use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Event; -class EventServiceProvider extends ServiceProvider { +class EventServiceProvider extends ServiceProvider +{ /** * The event to listener mappings for the application. * @@ -21,19 +22,17 @@ class EventServiceProvider extends ServiceProvider { /** * Register any events for your application. - * - * @return void */ - public function boot() { + public function boot(): void + { // } /** * Determine if events and listeners should be automatically discovered. - * - * @return bool */ - public function shouldDiscoverEvents() { + public function shouldDiscoverEvents(): bool + { return false; } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index aea6e8e..bc49109 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -8,7 +8,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; -class RouteServiceProvider extends ServiceProvider { +class RouteServiceProvider extends ServiceProvider +{ /** * The path to the "home" route for your application. * @@ -20,10 +21,9 @@ class RouteServiceProvider extends ServiceProvider { /** * Define your route model bindings, pattern filters, and other route configuration. - * - * @return void */ - public function boot() { + public function boot(): void + { $this->configureRateLimiting(); $this->routes(function () { @@ -38,10 +38,9 @@ class RouteServiceProvider extends ServiceProvider { /** * Configure the rate limiters for the application. - * - * @return void */ - protected function configureRateLimiting() { + protected function configureRateLimiting(): void + { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); diff --git a/composer.json b/composer.json index ebd4d20..4958668 100644 --- a/composer.json +++ b/composer.json @@ -2,26 +2,23 @@ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", - "keywords": [ - "framework", - "laravel" - ], + "keywords": ["framework", "laravel"], "license": "MIT", "require": { - "php": "^8.0.2", - "guzzlehttp/guzzle": "^7.4.4", - "laravel/framework": "^9.23", - "laravel/sanctum": "^2.15.1", - "laravel/tinker": "^2.7" + "php": "^8.1", + "guzzlehttp/guzzle": "^7.2", + "laravel/framework": "^10.0", + "laravel/sanctum": "^3.2", + "laravel/tinker": "^2.8" }, "require-dev": { "fakerphp/faker": "^1.9.1", - "laravel/pint": "^1.1.0", - "laravel/sail": "^1.15", + "laravel/pint": "^1.0", + "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", - "nunomaduro/collision": "^6.2", - "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ignition": "^1.0" + "nunomaduro/collision": "^7.0", + "phpunit/phpunit": "^10.0", + "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { @@ -58,8 +55,12 @@ "config": { "optimize-autoloader": true, "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "php-http/discovery": true + } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } diff --git a/config/auth.php b/config/auth.php index d8c6cee..9548c15 100644 --- a/config/auth.php +++ b/config/auth.php @@ -80,16 +80,20 @@ return [ | 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 expire time is the number of minutes that each reset token will be + | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 67fcbbd..9e4d4aa 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,8 +36,11 @@ return [ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'cluster' => env('PUSHER_APP_CLUSTER'), - 'useTLS' => true, + '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 diff --git a/config/database.php b/config/database.php index 651fc6b..137ad18 100644 --- a/config/database.php +++ b/config/database.php @@ -38,7 +38,7 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), - 'database' => database_path(env('DB_DATABASE', 'database.sqlite')), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], diff --git a/config/logging.php b/config/logging.php index 5aa1dbb..4c3df4c 100644 --- a/config/logging.php +++ b/config/logging.php @@ -102,6 +102,7 @@ return [ 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, ], 'errorlog' => [ diff --git a/config/mail.php b/config/mail.php index 534395a..542d98c 100644 --- a/config/mail.php +++ b/config/mail.php @@ -28,7 +28,7 @@ return [ | 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", + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | */ @@ -51,10 +51,16 @@ return [ 'mailgun' => [ 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'postmark' => [ 'transport' => 'postmark', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index bc2f498..a6ecc0a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -8,16 +8,18 @@ use Illuminate\Support\Str; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> */ -class UserFactory extends Factory { +class UserFactory extends Factory +{ /** * Define the model's default state. * * @return array */ - public function definition() { + public function definition(): array + { return [ - 'name' => $this->faker->name(), - 'email' => $this->faker->unique()->safeEmail(), + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'remember_token' => Str::random(10), @@ -26,14 +28,11 @@ class UserFactory extends Factory { /** * Indicate that the model's email address should be unverified. - * - * @return static */ - public function unverified() { - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); + public function unverified(): static + { + return $this->state(fn (array $attributes) => [ + 'email_verified_at' => null, + ]); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 545e2f7..444fafb 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -4,13 +4,13 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ /** * Run the migrations. - * - * @return void */ - public function up() { + public function up(): void + { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); @@ -24,10 +24,9 @@ return new class extends Migration { /** * Reverse the migrations. - * - * @return void */ - public function down() { + public function down(): void + { Schema::dropIfExists('users'); } }; diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php similarity index 52% rename from database/migrations/2014_10_12_100000_create_password_resets_table.php rename to database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index 7c0aa50..81a7229 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -4,15 +4,15 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ /** * Run the migrations. - * - * @return void */ - public function up() { - Schema::create('password_resets', function (Blueprint $table) { - $table->string('email')->index(); + public function up(): void + { + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); @@ -20,10 +20,9 @@ return new class extends Migration { /** * Reverse the migrations. - * - * @return void */ - public function down() { - Schema::dropIfExists('password_resets'); + 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 index 3608f1e..249da81 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -4,13 +4,13 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ /** * Run the migrations. - * - * @return void */ - public function up() { + public function up(): void + { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); $table->string('uuid')->unique(); @@ -24,10 +24,9 @@ return new class extends Migration { /** * Reverse the migrations. - * - * @return void */ - public function down() { + 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 index abf2ce9..e828ad8 100644 --- 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 @@ -4,13 +4,13 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ /** * Run the migrations. - * - * @return void */ - public function up() { + public function up(): void + { Schema::create('personal_access_tokens', function (Blueprint $table) { $table->id(); $table->morphs('tokenable'); @@ -18,16 +18,16 @@ return new class extends Migration { $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. - * - * @return void */ - public function down() { + public function down(): void + { Schema::dropIfExists('personal_access_tokens'); } }; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 8ccf378..21b9cbd 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,21 +2,23 @@ namespace Database\Seeders; +// use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; -class DatabaseSeeder extends Seeder { +class DatabaseSeeder extends Seeder +{ /** * Seed the application's database. - * - * @return void */ - public function run() { + public function run() : void + { // \App\Models\User::factory(10)->create(); // \App\Models\User::factory()->create([ // 'name' => 'Test User', // 'email' => 'test@example.com', // ]); + $this->call([ RoleSeeder::class, UsersSeeder::class, diff --git a/package.json b/package.json index 7a9aecd..3a76ed0 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,12 @@ { "private": true, "scripts": { - "dev": "npm run development", - "development": "mix", - "watch": "mix watch", - "watch-poll": "mix watch -- --watch-options-poll=1000", - "hot": "mix watch --hot", - "prod": "npm run production", - "production": "mix --production" + "dev": "vite", + "build": "vite build" }, "devDependencies": { - "axios": "^0.25", - "laravel-mix": "^6.0.6", - "lodash": "^4.17.19", - "postcss": "^8.1.14" + "axios": "^1.1.2", + "laravel-vite-plugin": "^0.7.2", + "vite": "^4.0.0" } } diff --git a/phpunit.xml b/phpunit.xml index 2ac86a1..eb13aff 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,7 +12,7 @@ ./tests/Feature - + ./app diff --git a/resources/js/app.js b/resources/js/app.js index e74d43c..e59d6a0 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,2 +1 @@ -require('./bootstrap'); - +import './bootstrap'; diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 2bb9958..846d350 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -1,13 +1,12 @@ -window._ = require('lodash'); - /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the * CSRF token as a header based on the value of the "XSRF" token cookie. */ -window.axios = require('axios'); -// window.axios.defaults.withCredentials = true; +import axios from 'axios'; +window.axios = axios; + window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; /** @@ -18,11 +17,16 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // import Echo from 'laravel-echo'; -// window.Pusher = require('pusher-js'); +// import Pusher from 'pusher-js'; +// window.Pusher = Pusher; // window.Echo = new Echo({ // broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// forceTLS: true +// key: import.meta.env.VITE_PUSHER_APP_KEY, +// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', +// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, +// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, +// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, +// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', +// enabledTransports: ['ws', 'wss'], // }); diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index dd6a45d..0406510 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -7,122 +7,130 @@ Laravel - + + - - -
+
@if (Route::has('login')) -