]> BookStack Code Mirror - bookstack/commitdiff
Laravel 8 shift squash & merge (#3029)
authorDan Brown <redacted>
Sat, 30 Oct 2021 20:29:59 +0000 (21:29 +0100)
committerGitHub <redacted>
Sat, 30 Oct 2021 20:29:59 +0000 (21:29 +0100)
* Temporarily moved back config path
* Apply Laravel coding style
* Shift exception handler
* Shift HTTP kernel and middleware
* Shift service providers
* Convert options array to fluent methods
* Shift to class based routes
* Shift console routes
* Ignore temporary framework files
* Shift to class based factories
* Namespace seeders
* Shift PSR-4 autoloading
* Shift config files
* Default config files
* Shift Laravel dependencies
* Shift return type of base TestCase methods
* Shift cleanup
* Applied stylci style changes
* Reverted config files location
* Applied manual changes to Laravel 8 shift

Co-authored-by: Shift <redacted>
71 files changed:
app/Actions/Comment.php
app/Actions/Tag.php
app/Auth/Role.php
app/Auth/User.php
app/Config/app.php [changed mode: 0755->0644]
app/Config/auth.php
app/Config/broadcasting.php
app/Config/cache.php
app/Config/filesystems.php
app/Config/logging.php
app/Config/queue.php
app/Entities/Models/Book.php
app/Entities/Models/Bookshelf.php
app/Entities/Models/Chapter.php
app/Entities/Models/Page.php
app/Exceptions/Handler.php
app/Http/Kernel.php
app/Http/Middleware/PreventRequestsDuringMaintenance.php [moved from app/Http/Middleware/CheckForMaintenanceMode.php with 58% similarity]
app/Http/Middleware/RedirectIfAuthenticated.php
app/Http/Middleware/TrustHosts.php
app/Http/Middleware/TrustProxies.php
app/Providers/AppServiceProvider.php
app/Providers/EventServiceProvider.php
app/Providers/RouteServiceProvider.php
app/Uploads/Image.php
composer.json
composer.lock
database/factories/Actions/CommentFactory.php [new file with mode: 0644]
database/factories/Actions/TagFactory.php [new file with mode: 0644]
database/factories/Auth/RoleFactory.php [new file with mode: 0644]
database/factories/Auth/UserFactory.php [new file with mode: 0644]
database/factories/Entities/Models/BookFactory.php [new file with mode: 0644]
database/factories/Entities/Models/BookshelfFactory.php [new file with mode: 0644]
database/factories/Entities/Models/ChapterFactory.php [new file with mode: 0644]
database/factories/Entities/Models/PageFactory.php [new file with mode: 0644]
database/factories/ModelFactory.php [deleted file]
database/factories/Uploads/ImageFactory.php [new file with mode: 0644]
database/seeders/.gitkeep [moved from database/seeds/.gitkeep with 100% similarity]
database/seeders/DatabaseSeeder.php [moved from database/seeds/DatabaseSeeder.php with 92% similarity]
database/seeders/DummyContentSeeder.php [moved from database/seeds/DummyContentSeeder.php with 71% similarity]
database/seeders/LargeContentSeeder.php [moved from database/seeds/LargeContentSeeder.php with 60% similarity]
public/index.php
routes/api.php
routes/console.php [new file with mode: 0644]
routes/web.php
storage/framework/.gitignore
tests/AuditLogTest.php
tests/Auth/AuthTest.php
tests/Auth/LdapTest.php
tests/Auth/OidcTest.php
tests/Auth/Saml2Test.php
tests/Auth/SocialAuthTest.php
tests/Entity/BookShelfTest.php
tests/Entity/BookTest.php
tests/Entity/ChapterTest.php
tests/Entity/CommentSettingTest.php
tests/Entity/CommentTest.php
tests/Entity/PageDraftTest.php
tests/Entity/PageEditorTest.php
tests/Entity/PageTest.php
tests/Entity/SortTest.php
tests/Entity/TagTest.php
tests/HomepageTest.php
tests/LanguageTest.php
tests/Permissions/EntityPermissionsTest.php
tests/Permissions/RolesTest.php
tests/SharedTestHelpers.php
tests/ThemeTest.php
tests/Uploads/AvatarTest.php
tests/User/UserManagementTest.php
tests/User/UserProfileTest.php

index 34fd84709ec1d746bd84c2de87854a3845743b01..885ba6ed1ac72d991f7003025ac671ee9d8dd99d 100644 (file)
@@ -4,6 +4,7 @@ namespace BookStack\Actions;
 
 use BookStack\Model;
 use BookStack\Traits\HasCreatorAndUpdater;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\MorphTo;
 
 /**
@@ -15,6 +16,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
  */
 class Comment extends Model
 {
+    use HasFactory;
     use HasCreatorAndUpdater;
 
     protected $fillable = ['text', 'parent_id'];
index ce0954f00cd347c50e21806caa8949d256a863cd..db9328b7d59e0f4b2ebd74faf449a523bc3a1426 100644 (file)
@@ -3,10 +3,13 @@
 namespace BookStack\Actions;
 
 use BookStack\Model;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\MorphTo;
 
 class Tag extends Model
 {
+    use HasFactory;
+
     protected $fillable = ['name', 'value', 'order'];
     protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
 
index fc2e39aa9c5425c9262e1ab9bdb11eb24f3e6062..71da88e19b1be5200cb4f41dd6396427efd7c65b 100644 (file)
@@ -7,6 +7,7 @@ use BookStack\Auth\Permissions\RolePermission;
 use BookStack\Interfaces\Loggable;
 use BookStack\Model;
 use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 use Illuminate\Database\Eloquent\Relations\HasMany;
 
@@ -23,6 +24,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
  */
 class Role extends Model implements Loggable
 {
+    use HasFactory;
+
     protected $fillable = ['display_name', 'description', 'external_auth_id'];
 
     /**
index aa8b44e9fd843003c19db21cde3b6dbe73d32874..68e2ad6253a6bcc83d9dbfa748bc1782a53c9201 100644 (file)
@@ -18,6 +18,7 @@ use Illuminate\Auth\Passwords\CanResetPassword;
 use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
 use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
 use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -43,6 +44,7 @@ use Illuminate\Support\Collection;
  */
 class User extends Model implements AuthenticatableContract, CanResetPasswordContract, Loggable, Sluggable
 {
+    use HasFactory;
     use Authenticatable;
     use CanResetPassword;
     use Notifiable;
old mode 100755 (executable)
new mode 100644 (file)
index f90a7dd..44e382c
@@ -143,7 +143,6 @@ return [
 
     // Class aliases, Registered on application start
     'aliases' => [
-
         // Laravel
         'App'          => Illuminate\Support\Facades\App::class,
         'Arr'          => Illuminate\Support\Arr::class,
@@ -155,21 +154,23 @@ return [
         'Config'       => Illuminate\Support\Facades\Config::class,
         'Cookie'       => Illuminate\Support\Facades\Cookie::class,
         'Crypt'        => Illuminate\Support\Facades\Crypt::class,
+        'Date'         => Illuminate\Support\Facades\Date::class,
         'DB'           => Illuminate\Support\Facades\DB::class,
         'Eloquent'     => Illuminate\Database\Eloquent\Model::class,
         'Event'        => Illuminate\Support\Facades\Event::class,
         'File'         => Illuminate\Support\Facades\File::class,
+        'Gate'         => Illuminate\Support\Facades\Gate::class,
         'Hash'         => Illuminate\Support\Facades\Hash::class,
-        'Input'        => Illuminate\Support\Facades\Input::class,
-        'Inspiring'    => Illuminate\Foundation\Inspiring::class,
+        'Http'         => Illuminate\Support\Facades\Http::class,
         'Lang'         => Illuminate\Support\Facades\Lang::class,
         'Log'          => Illuminate\Support\Facades\Log::class,
         'Mail'         => Illuminate\Support\Facades\Mail::class,
         'Notification' => Illuminate\Support\Facades\Notification::class,
         'Password'     => Illuminate\Support\Facades\Password::class,
         'Queue'        => Illuminate\Support\Facades\Queue::class,
+        'RateLimiter'  => Illuminate\Support\Facades\RateLimiter::class,
         'Redirect'     => Illuminate\Support\Facades\Redirect::class,
-        'Redis'        => Illuminate\Support\Facades\Redis::class,
+        // 'Redis'        => Illuminate\Support\Facades\Redis::class,
         'Request'      => Illuminate\Support\Facades\Request::class,
         'Response'     => Illuminate\Support\Facades\Response::class,
         'Route'        => Illuminate\Support\Facades\Route::class,
@@ -180,6 +181,8 @@ return [
         'URL'          => Illuminate\Support\Facades\URL::class,
         'Validator'    => Illuminate\Support\Facades\Validator::class,
         'View'         => Illuminate\Support\Facades\View::class,
+
+        // Laravel Packages
         'Socialite'    => Laravel\Socialite\Facades\Socialite::class,
 
         // Third Party
index 88c22e70aca0760315963f942422adf6d2f8c511..1e1a9d3507c737cf0ff7284cd52d97325620efac 100644 (file)
@@ -10,7 +10,6 @@
 
 return [
 
-    // Method of authentication to use
     // Options: standard, ldap, saml2, oidc
     'method' => env('AUTH_METHOD', 'standard'),
 
@@ -45,7 +44,7 @@ return [
             'provider' => 'external',
         ],
         'api' => [
-            'driver' => 'api-token',
+            'driver'   => 'api-token',
         ],
     ],
 
@@ -58,10 +57,16 @@ return [
             'driver' => 'eloquent',
             'model'  => \BookStack\Auth\User::class,
         ],
+
         'external' => [
             'driver' => 'external-users',
             'model'  => \BookStack\Auth\User::class,
         ],
+
+        // 'users' => [
+        //     'driver' => 'database',
+        //     'table' => 'users',
+        // ],
     ],
 
     // Resetting Passwords
@@ -78,4 +83,10 @@ return [
         ],
     ],
 
+    // Password Confirmation Timeout
+    // Here you may define the amount of seconds before a password confirmation
+    // 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' => 10800,
+
 ];
index 5e929d3730faa5fd4e53f95a056782937531c981..be0d7376c7fc7763c64709131c4671925ae89580 100644 (file)
@@ -1,51 +1,79 @@
 <?php
 
 /**
- * Broadcasting configuration options.
+ * Caching configuration options.
  *
  * Changes to these config files are not supported by BookStack and may break upon updates.
  * Configuration should be altered via the `.env` file or environment variables.
  * Do not edit this file unless you're happy to maintain any changes yourself.
  */
 
+// MEMCACHED - Split out configuration into an array
+if (env('CACHE_DRIVER') === 'memcached') {
+    $memcachedServerKeys = ['host', 'port', 'weight'];
+    $memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
+    foreach ($memcachedServers as $index => $memcachedServer) {
+        $memcachedServerDetails = explode(':', $memcachedServer);
+        if (count($memcachedServerDetails) < 2) {
+            $memcachedServerDetails[] = '11211';
+        }
+        if (count($memcachedServerDetails) < 3) {
+            $memcachedServerDetails[] = '100';
+        }
+        $memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
+    }
+}
+
 return [
 
-    // Default Broadcaster
-    // This option controls the default broadcaster that will be used by the
-    // framework when an event needs to be broadcast. This can be set to
-    // any of the connections defined in the "connections" array below.
-    'default' => env('BROADCAST_DRIVER', 'pusher'),
-
-    // 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'),
-                'useTLS'  => true,
-            ],
+    // Default cache store to use
+    // Can be overridden at cache call-time
+    'default' => env('CACHE_DRIVER', 'file'),
+
+    // Available caches stores
+    'stores' => [
+
+        'apc' => [
+            'driver' => 'apc',
         ],
 
-        'redis' => [
-            'driver'     => 'redis',
-            'connection' => 'default',
+        'array' => [
+            'driver'    => 'array',
+            'serialize' => false,
+        ],
+
+        'database' => [
+            'driver'          => 'database',
+            'table'           => 'cache',
+            'connection'      => null,
+            'lock_connection' => null,
         ],
 
-        'log' => [
-            'driver' => 'log',
+        'file' => [
+            'driver' => 'file',
+            'path'   => storage_path('framework/cache'),
         ],
 
-        'null' => [
-            'driver' => 'null',
+        'memcached' => [
+            'driver'  => 'memcached',
+            'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
+            'options' => [],
+        ],
+
+        'redis' => [
+            'driver'          => 'redis',
+            'connection'      => 'default',
+            'lock_connection' => 'default',
+        ],
+
+        'octane' => [
+            'driver' => 'octane',
         ],
 
     ],
 
+    // Cache key prefix
+    // Used to prevent collisions in shared cache systems.
+    'prefix' => env('CACHE_PREFIX', 'bookstack_cache'),
+
 ];
index f9b7ed1d20ecb9ff295f6bc94ce7657583b778ee..6fd4807da3341c2b8a3f5a2c70faad7a4e2bdecc 100644 (file)
@@ -1,36 +1,36 @@
 <?php
 
-/**
- * Caching configuration options.
- *
- * Changes to these config files are not supported by BookStack and may break upon updates.
- * Configuration should be altered via the `.env` file or environment variables.
- * Do not edit this file unless you're happy to maintain any changes yourself.
- */
-
-// MEMCACHED - Split out configuration into an array
-if (env('CACHE_DRIVER') === 'memcached') {
-    $memcachedServerKeys = ['host', 'port', 'weight'];
-    $memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
-    foreach ($memcachedServers as $index => $memcachedServer) {
-        $memcachedServerDetails = explode(':', $memcachedServer);
-        if (count($memcachedServerDetails) < 2) {
-            $memcachedServerDetails[] = '11211';
-        }
-        if (count($memcachedServerDetails) < 3) {
-            $memcachedServerDetails[] = '100';
-        }
-        $memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
-    }
-}
+use Illuminate\Support\Str;
 
 return [
 
-    // Default cache store to use
-    // Can be overridden at cache call-time
+    /*
+    |--------------------------------------------------------------------------
+    | Default Cache Store
+    |--------------------------------------------------------------------------
+    |
+    | 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_DRIVER', 'file'),
 
-    // Available caches stores
+    /*
+    |--------------------------------------------------------------------------
+    | Cache Stores
+    |--------------------------------------------------------------------------
+    |
+    | Here you may define all of the cache "stores" for your application as
+    | 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"
+    |
+    */
+
     'stores' => [
 
         'apc' => [
@@ -38,13 +38,15 @@ return [
         ],
 
         'array' => [
-            'driver' => 'array',
+            'driver'    => 'array',
+            'serialize' => false,
         ],
 
         'database' => [
-            'driver'     => 'database',
-            'table'      => 'cache',
-            'connection' => null,
+            'driver'          => 'database',
+            'table'           => 'cache',
+            'connection'      => null,
+            'lock_connection' => null,
         ],
 
         'file' => [
@@ -53,19 +55,50 @@ return [
         ],
 
         'memcached' => [
-            'driver'  => 'memcached',
+            'driver'        => 'memcached',
+            'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
+            'sasl'          => [
+                env('MEMCACHED_USERNAME'),
+                env('MEMCACHED_PASSWORD'),
+            ],
+            'options' => [
+                // Memcached::OPT_CONNECT_TIMEOUT => 2000,
+            ],
             'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
         ],
 
         'redis' => [
-            'driver'     => 'redis',
-            'connection' => 'default',
+            'driver'          => 'redis',
+            'connection'      => 'default',
+            'lock_connection' => 'default',
+        ],
+
+        'dynamodb' => [
+            'driver'   => 'dynamodb',
+            'key'      => env('AWS_ACCESS_KEY_ID'),
+            'secret'   => env('AWS_SECRET_ACCESS_KEY'),
+            'region'   => env('AWS_DEFAULT_REGION', 'us-east-1'),
+            'table'    => env('DYNAMODB_CACHE_TABLE', 'cache'),
+            'endpoint' => env('DYNAMODB_ENDPOINT'),
+        ],
+
+        'octane' => [
+            'driver' => 'octane',
         ],
 
     ],
 
-    // Cache key prefix
-    // Used to prevent collisions in shared cache systems.
-    'prefix' => env('CACHE_PREFIX', 'bookstack_cache'),
+    /*
+    |--------------------------------------------------------------------------
+    | Cache Key Prefix
+    |--------------------------------------------------------------------------
+    |
+    | When utilizing a RAM based store such as APC or Memcached, there might
+    | be other applications utilizing the same cache. So, we'll specify a
+    | value to get prefixed to all our keys so we can avoid collisions.
+    |
+    */
+
+    'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
 
 ];
index a6b05c8c4aa3644f14030afd781ef6f7e56866d9..4d59ba9192dcd06840b5c31a39f09b15a84422e7 100644 (file)
@@ -25,9 +25,6 @@ return [
     // file storage service, such as s3, to store publicly accessible assets.
     'url' => env('STORAGE_URL', false),
 
-    // Default Cloud Filesystem Disk
-    'cloud' => 's3',
-
     // Available filesystem disks
     // Only local, local_secure & s3 are supported by BookStack
     'disks' => [
@@ -35,6 +32,7 @@ return [
         'local' => [
             'driver' => 'local',
             'root'   => public_path(),
+            'visibility' => 'public',
         ],
 
         'local_secure_attachments' => [
@@ -45,6 +43,7 @@ return [
         'local_secure_images' => [
             'driver' => 'local',
             'root'   => storage_path('uploads/images/'),
+            'visibility' => 'public',
         ],
 
         's3' => [
@@ -59,4 +58,12 @@ return [
 
     ],
 
+    // Symbolic Links
+    // Here you may configure the symbolic links that will be created when the
+    // `storage:link` Artisan command is executed. The array keys should be
+    // the locations of the links and the values should be their targets.
+    'links' => [
+        public_path('storage') => storage_path('app/public'),
+    ],
+
 ];
index 220aa0607044482d1b213d6c4f3ec34a911596fe..2b80147c8c7ef5a3d086eeafbce31abb1a4cff49 100644 (file)
@@ -49,16 +49,9 @@ return [
             'days'   => 7,
         ],
 
-        'slack' => [
-            'driver'   => 'slack',
-            'url'      => env('LOG_SLACK_WEBHOOK_URL'),
-            'username' => 'Laravel Log',
-            'emoji'    => ':boom:',
-            'level'    => 'critical',
-        ],
-
         'stderr' => [
             'driver'  => 'monolog',
+            'level'   => 'debug',
             'handler' => StreamHandler::class,
             'with'    => [
                 'stream' => 'php://stderr',
@@ -99,6 +92,10 @@ return [
         'testing' => [
             'driver' => 'testing',
         ],
+
+        'emergency' => [
+            'path' => storage_path('logs/laravel.log'),
+        ],
     ],
 
     // Failed Login Message
index 0c79fcdd20ce3a51e876cf0cc30f46a2f4b76482..0f5ee3ce594432d563527cf577948448c367a8a7 100644 (file)
@@ -22,25 +22,29 @@ return [
         ],
 
         'database' => [
-            'driver'      => 'database',
-            'table'       => 'jobs',
-            'queue'       => 'default',
-            'retry_after' => 90,
+            'driver'       => 'database',
+            'table'        => 'jobs',
+            'queue'        => 'default',
+            'retry_after'  => 90,
+            'after_commit' => false,
         ],
 
         'redis' => [
-            'driver'      => 'redis',
-            'connection'  => 'default',
-            'queue'       => env('REDIS_QUEUE', 'default'),
-            'retry_after' => 90,
-            'block_for'   => null,
+            'driver'       => 'redis',
+            'connection'   => 'default',
+            'queue'        => env('REDIS_QUEUE', 'default'),
+            'retry_after'  => 90,
+            'block_for'    => null,
+            'after_commit' => false,
         ],
 
     ],
 
     // Failed queue job logging
     'failed' => [
-        'database' => 'mysql', 'table' => 'failed_jobs',
+        'driver'   => 'database-uuids',
+        'database' => 'mysql',
+        'table'    => 'failed_jobs',
     ],
 
 ];
index 1e4591bd75d3f385e5a4cffe217b5f8c7f643f2c..982df5c90a703f588b96045ae2a40bbb87fa04df 100644 (file)
@@ -4,6 +4,7 @@ namespace BookStack\Entities\Models;
 
 use BookStack\Uploads\Image;
 use Exception;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -21,6 +22,8 @@ use Illuminate\Support\Collection;
  */
 class Book extends Entity implements HasCoverImage
 {
+    use HasFactory;
+
     public $searchFactor = 2;
 
     protected $fillable = ['name', 'description'];
index f427baf49fcea4c0bb616eb9270302ffd6f85728..8fe9dbe4159b0a3bfb05203be31bd27edf2d7335 100644 (file)
@@ -3,11 +3,14 @@
 namespace BookStack\Entities\Models;
 
 use BookStack\Uploads\Image;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 
 class Bookshelf extends Entity implements HasCoverImage
 {
+    use HasFactory;
+
     protected $table = 'bookshelves';
 
     public $searchFactor = 3;
index f6f8427a3a0050e6908250cab0be9fdf9491878d..abf496b44b38e9d3c300f1389b45e62e7c68cf45 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace BookStack\Entities\Models;
 
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Support\Collection;
 
 /**
@@ -12,6 +13,8 @@ use Illuminate\Support\Collection;
  */
 class Chapter extends BookChild
 {
+    use HasFactory;
+
     public $searchFactor = 1.3;
 
     protected $fillable = ['name', 'description', 'priority', 'book_id'];
index 45296566717c788a73529a9485ab5f21a6b42aab..fbe0db41b4cbfc48952604a6cf7827b9943585a4 100644 (file)
@@ -6,6 +6,7 @@ use BookStack\Entities\Tools\PageContent;
 use BookStack\Uploads\Attachment;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\HasMany;
 use Permissions;
@@ -25,6 +26,8 @@ use Permissions;
  */
 class Page extends BookChild
 {
+    use HasFactory;
+
     public static $listAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'text', 'created_at', 'updated_at', 'priority'];
     public static $contentAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'html', 'text', 'created_at', 'updated_at', 'priority'];
 
index 63b5cfc5ae314a74a554001bfdfab8dad6a44e21..3b4ad4a4da54ae46e003a004988c7aacc24fd803 100644 (file)
@@ -28,6 +28,7 @@ class Handler extends ExceptionHandler
      * @var array
      */
     protected $dontFlash = [
+        'current_password',
         'password',
         'password_confirmation',
     ];
index 7a09493afc80488ca3d09832662e90e85a81ce67..91dbdd9634c2bfa02624a69b2f0e188726ef83f8 100644 (file)
@@ -11,7 +11,7 @@ class Kernel extends HttpKernel
      * These middleware are run during every request to your application.
      */
     protected $middleware = [
-        \BookStack\Http\Middleware\CheckForMaintenanceMode::class,
+        \BookStack\Http\Middleware\PreventRequestsDuringMaintenance::class,
         \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
         \BookStack\Http\Middleware\TrimStrings::class,
         \BookStack\Http\Middleware\TrustProxies::class,
similarity index 58%
rename from app/Http/Middleware/CheckForMaintenanceMode.php
rename to app/Http/Middleware/PreventRequestsDuringMaintenance.php
index 0c76838367e3adc9bb7336a6938b24fb0dfdda45..dfb9592e106ec3d6f0f3ea42d65cf8dbe585ef01 100644 (file)
@@ -2,9 +2,9 @@
 
 namespace BookStack\Http\Middleware;
 
-use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
+use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
 
-class CheckForMaintenanceMode extends Middleware
+class PreventRequestsDuringMaintenance extends Middleware
 {
     /**
      * The URIs that should be reachable while maintenance mode is enabled.
index 6853809ea9d03b5db7a74a817c6f256ef00d832a..76e64a3b9d6660eece36bdd5762bdd0cac40f202 100644 (file)
@@ -2,45 +2,31 @@
 
 namespace BookStack\Http\Middleware;
 
+use BookStack\Providers\RouteServiceProvider;
 use Closure;
-use Illuminate\Contracts\Auth\Guard;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 
 class RedirectIfAuthenticated
 {
-    /**
-     * The Guard implementation.
-     *
-     * @var Guard
-     */
-    protected $auth;
-
-    /**
-     * Create a new filter instance.
-     *
-     * @param Guard $auth
-     *
-     * @return void
-     */
-    public function __construct(Guard $auth)
-    {
-        $this->auth = $auth;
-    }
-
     /**
      * Handle an incoming request.
      *
-     * @param \Illuminate\Http\Request $request
-     * @param \Closure                 $next
-     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @param  string|null  ...$guards
      * @return mixed
      */
-    public function handle($request, Closure $next)
+    public function handle(Request $request, Closure $next, ...$guards)
     {
-        $requireConfirmation = setting('registration-confirmation');
-        if ($this->auth->check() && (!$requireConfirmation || ($requireConfirmation && $this->auth->user()->email_confirmed))) {
-            return redirect('/');
+        $guards = empty($guards) ? [null] : $guards;
+
+        foreach ($guards as $guard) {
+            if (Auth::guard($guard)->check()) {
+                return redirect(RouteServiceProvider::HOME);
+            }
         }
 
         return $next($request);
     }
-}
+}
\ No newline at end of file
index b0550cfc7c61f0220b5cf7ee6a1ef2d8c4a4cab7..7bd89ee51def992b27c2fd9d1c67b5bc2b9bb343 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Http\Middleware;
+namespace BookStack\Http\Middleware;
 
 use Illuminate\Http\Middleware\TrustHosts as Middleware;
 
index 3f8b32eb2cbe7105abde5c72487cbaaceccde723..0fe0247b829e8b4412dcbd42888c1f05bac60708 100644 (file)
@@ -3,7 +3,7 @@
 namespace BookStack\Http\Middleware;
 
 use Closure;
-use Fideloper\Proxy\TrustProxies as Middleware;
+use Illuminate\Http\Middleware\TrustProxies as Middleware;
 use Illuminate\Http\Request;
 
 class TrustProxies extends Middleware
@@ -20,7 +20,7 @@ class TrustProxies extends Middleware
      *
      * @var int
      */
-    protected $headers = Request::HEADER_X_FORWARDED_ALL;
+    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;
 
     /**
      * Handle the request, Set the correct user-configured proxy information.
index 34a3a290f0c0cf200537217abf0f0d677c38a5d3..fc712632e9b876117f605d36d5bd0971f4290468 100644 (file)
@@ -16,6 +16,7 @@ use BookStack\Util\CspService;
 use GuzzleHttp\Client;
 use Illuminate\Contracts\Cache\Repository;
 use Illuminate\Database\Eloquent\Relations\Relation;
+use Illuminate\Pagination\Paginator;
 use Illuminate\Support\Facades\Blade;
 use Illuminate\Support\Facades\Schema;
 use Illuminate\Support\Facades\URL;
@@ -60,6 +61,9 @@ class AppServiceProvider extends ServiceProvider
 
         // View Composers
         View::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class);
+
+        // Set paginator to use bootstrap-style pagination
+        Paginator::useBootstrap();
     }
 
     /**
index a826185d82de7bdfa49a7db17bbd9b4ac6c3c84b..659843ce33bff2b022b70a121013accd15bd836f 100644 (file)
@@ -30,6 +30,5 @@ class EventServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        parent::boot();
     }
 }
index b60443a452895fc19a8c4a5dcffdfeb03f339b52..ac3307f2ded53c4799d8e8d1dcef465bd008da37 100644 (file)
@@ -2,11 +2,23 @@
 
 namespace BookStack\Providers;
 
+use Illuminate\Cache\RateLimiting\Limit;
 use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\RateLimiter;
 use Illuminate\Support\Facades\Route;
 
 class RouteServiceProvider extends ServiceProvider
 {
+    /**
+     * The path to the "home" route for your application.
+     *
+     * This is used by Laravel authentication to redirect users after login.
+     *
+     * @var string
+     */
+    public const HOME = '/';
+
     /**
      * This namespace is applied to the controller routes in your routes file.
      *
@@ -14,7 +26,6 @@ class RouteServiceProvider extends ServiceProvider
      *
      * @var string
      */
-    protected $namespace = 'BookStack\Http\Controllers';
 
     /**
      * Define your route model bindings, pattern filters, etc.
@@ -23,18 +34,12 @@ class RouteServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        parent::boot();
-    }
+        $this->configureRateLimiting();
 
-    /**
-     * Define the routes for the application.
-     *
-     * @return void
-     */
-    public function map()
-    {
-        $this->mapWebRoutes();
-        $this->mapApiRoutes();
+        $this->routes(function () {
+            $this->mapWebRoutes();
+            $this->mapApiRoutes();
+        });
     }
 
     /**
@@ -71,4 +76,16 @@ class RouteServiceProvider extends ServiceProvider
             require base_path('routes/api.php');
         });
     }
+
+    /**
+     * Configure the rate limiters for the application.
+     *
+     * @return void
+     */
+    protected function configureRateLimiting()
+    {
+        RateLimiter::for('api', function (Request $request) {
+            return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
+        });
+    }
 }
index 4e0abc85b9a4d49128d4841cfc35548dff4dcb3b..bdf10f080fe99cd991f52bc0174e75cc4c5ac00f 100644 (file)
@@ -5,6 +5,7 @@ namespace BookStack\Uploads;
 use BookStack\Entities\Models\Page;
 use BookStack\Model;
 use BookStack\Traits\HasCreatorAndUpdater;
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 
 /**
  * @property int    $id
@@ -18,6 +19,7 @@ use BookStack\Traits\HasCreatorAndUpdater;
  */
 class Image extends Model
 {
+    use HasFactory;
     use HasCreatorAndUpdater;
 
     protected $fillable = ['name'];
index b50cee7621a02d9f9512a497a1889b504472b3eb..c1d5c1e4b77f2a6bbbe65b8773ae8b898ed06f2f 100644 (file)
         "barryvdh/laravel-dompdf": "^0.9.0",
         "barryvdh/laravel-snappy": "^0.4.8",
         "doctrine/dbal": "^3.1",
-        "fideloper/proxy": "^4.4.1",
         "filp/whoops": "^2.14",
+        "guzzlehttp/guzzle": "^7.4",
         "intervention/image": "^2.7",
-        "laravel/framework": "^7.29",
+        "laravel/framework": "^8.68",
         "laravel/socialite": "^5.2",
+        "laravel/tinker": "^2.5",
+        "laravel/ui": "^3.3",
         "league/commonmark": "^1.5",
         "league/flysystem-aws-s3-v3": "^1.0.29",
         "league/html-to-markdown": "^5.0.0",
         "onelogin/php-saml": "^4.0",
         "phpseclib/phpseclib": "~3.0",
         "pragmarx/google2fa": "^8.0",
-        "predis/predis": "^1.1.6",
+        "predis/predis": "^1.1",
         "socialiteproviders/discord": "^4.1",
         "socialiteproviders/gitlab": "^4.1",
         "socialiteproviders/microsoft-azure": "^4.1",
         "socialiteproviders/okta": "^4.1",
         "socialiteproviders/slack": "^4.1",
         "socialiteproviders/twitch": "^5.3",
-        "ssddanbrown/htmldiff": "^1.0.1",
-        "laravel/ui": "^2.5",
-        "guzzlehttp/guzzle": "^7.4.0",
-        "laravel/tinker": "^2.5"
+        "ssddanbrown/htmldiff": "^1.0.1"
     },
     "require-dev": {
         "barryvdh/laravel-debugbar": "^3.6",
         "fakerphp/faker": "^1.13.0",
-        "mockery/mockery": "^1.3.3",
+        "mockery/mockery": "^1.4.2",
         "phpunit/phpunit": "^9.5.3",
         "symfony/dom-crawler": "^5.3",
-        "nunomaduro/collision": "^4.3"
+        "nunomaduro/collision": "^5.0"
     },
     "autoload": {
-        "classmap": [
-            "database/seeds",
-            "database/factories"
-        ],
         "psr-4": {
-            "BookStack\\": "app/"
+            "BookStack\\": "app/",
+            "Database\\Factories\\": "database/factories/",
+            "Database\\Seeders\\": "database/seeders/"
         },
         "files": [
             "app/helpers.php"
         }
     },
     "scripts": {
+        "post-autoload-dump": [
+            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
+            "@php artisan package:discover --ansi"
+        ],
         "post-root-package-install": [
             "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
         ],
             "@php artisan cache:clear",
             "@php artisan view:clear"
         ],
-        "post-autoload-dump": [
-            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
-            "@php artisan package:discover --ansi"
-        ],
         "refresh-test-database": [
             "@php artisan migrate:refresh --database=mysql_testing",
             "@php artisan db:seed --class=DummyContentSeeder --database=mysql_testing"
index f07d610627465f02a08426218486a5f3fd849ac0..17e57df7109c8d5c9588cd9671c427cdf56018ba 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "491a3de7d49182613d0c81032a7001e1",
+    "content-hash": "9a5d92382b2955dd7de41de5fa9f86b5",
     "packages": [
         {
             "name": "aws/aws-crt-php",
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.199.4",
+            "version": "3.199.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "047f6ce04b1de9320ca00bf393d6f03b9d036fa5"
+                "reference": "fda176884d2952cffc7e67209470bff49609339c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/047f6ce04b1de9320ca00bf393d6f03b9d036fa5",
-                "reference": "047f6ce04b1de9320ca00bf393d6f03b9d036fa5",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fda176884d2952cffc7e67209470bff49609339c",
+                "reference": "fda176884d2952cffc7e67209470bff49609339c",
                 "shasum": ""
             },
             "require": {
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.199.4"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.199.7"
             },
-            "time": "2021-10-26T18:14:35+00:00"
+            "time": "2021-10-29T18:25:02+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
         },
         {
             "name": "dragonmantank/cron-expression",
-            "version": "v2.3.1",
+            "version": "v3.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/dragonmantank/cron-expression.git",
-                "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2"
+                "reference": "7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2",
-                "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2",
+                "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c",
+                "reference": "7a8c6e56ab3ffcc538d05e8155bb42269abf1a0c",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0|^8.0"
+                "php": "^7.2|^8.0",
+                "webmozart/assert": "^1.7.0"
+            },
+            "replace": {
+                "mtdowling/cron-expression": "^1.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0"
+                "phpstan/extension-installer": "^1.0",
+                "phpstan/phpstan": "^0.12",
+                "phpstan/phpstan-webmozart-assert": "^0.12.7",
+                "phpunit/phpunit": "^7.0|^8.0|^9.0"
             },
             "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.3-dev"
-                }
-            },
             "autoload": {
                 "psr-4": {
                     "Cron\\": "src/Cron/"
                 "MIT"
             ],
             "authors": [
-                {
-                    "name": "Michael Dowling",
-                    "email": "[email protected]",
-                    "homepage": "https://github.com/mtdowling"
-                },
                 {
                     "name": "Chris Tankersley",
                     "email": "[email protected]",
             ],
             "support": {
                 "issues": "https://github.com/dragonmantank/cron-expression/issues",
-                "source": "https://github.com/dragonmantank/cron-expression/tree/v2.3.1"
+                "source": "https://github.com/dragonmantank/cron-expression/tree/v3.1.0"
             },
             "funding": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2020-10-13T00:52:37+00:00"
+            "time": "2020-11-24T19:55:57+00:00"
         },
         {
             "name": "egulias/email-validator",
             ],
             "time": "2020-12-29T14:50:06+00:00"
         },
-        {
-            "name": "fideloper/proxy",
-            "version": "4.4.1",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/fideloper/TrustedProxy.git",
-                "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/c073b2bd04d1c90e04dc1b787662b558dd65ade0",
-                "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0",
-                "shasum": ""
-            },
-            "require": {
-                "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0",
-                "php": ">=5.4.0"
-            },
-            "require-dev": {
-                "illuminate/http": "^5.0|^6.0|^7.0|^8.0|^9.0",
-                "mockery/mockery": "^1.0",
-                "phpunit/phpunit": "^6.0"
-            },
-            "type": "library",
-            "extra": {
-                "laravel": {
-                    "providers": [
-                        "Fideloper\\Proxy\\TrustedProxyServiceProvider"
-                    ]
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Fideloper\\Proxy\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Chris Fidao",
-                    "email": "[email protected]"
-                }
-            ],
-            "description": "Set trusted proxies for Laravel",
-            "keywords": [
-                "load balancing",
-                "proxy",
-                "trusted proxy"
-            ],
-            "support": {
-                "issues": "https://github.com/fideloper/TrustedProxy/issues",
-                "source": "https://github.com/fideloper/TrustedProxy/tree/4.4.1"
-            },
-            "time": "2020-10-22T13:48:01+00:00"
-        },
         {
             "name": "filp/whoops",
             "version": "2.14.4",
             ],
             "time": "2021-10-03T12:00:00+00:00"
         },
+        {
+            "name": "graham-campbell/result-type",
+            "version": "v1.0.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/GrahamCampbell/Result-Type.git",
+                "reference": "296c015dc30ec4322168c5ad3ee5cc11dae827ac"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/296c015dc30ec4322168c5ad3ee5cc11dae827ac",
+                "reference": "296c015dc30ec4322168c5ad3ee5cc11dae827ac",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.0 || ^8.0",
+                "phpoption/phpoption": "^1.8"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "GrahamCampbell\\ResultType\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Graham Campbell",
+                    "email": "[email protected]"
+                }
+            ],
+            "description": "An Implementation Of The Result Type",
+            "keywords": [
+                "Graham Campbell",
+                "GrahamCampbell",
+                "Result Type",
+                "Result-Type",
+                "result"
+            ],
+            "support": {
+                "issues": "https://github.com/GrahamCampbell/Result-Type/issues",
+                "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.3"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/GrahamCampbell",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2021-10-17T19:48:54+00:00"
+        },
         {
             "name": "guzzlehttp/guzzle",
             "version": "7.4.0",
         },
         {
             "name": "laravel/framework",
-            "version": "v7.30.4",
+            "version": "v8.68.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "9dd38140dc2924daa1a020a3d7a45f9ceff03df3"
+                "reference": "abe985ff1fb82dd04aab03bc1dc56e83fe61a59f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/9dd38140dc2924daa1a020a3d7a45f9ceff03df3",
-                "reference": "9dd38140dc2924daa1a020a3d7a45f9ceff03df3",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/abe985ff1fb82dd04aab03bc1dc56e83fe61a59f",
+                "reference": "abe985ff1fb82dd04aab03bc1dc56e83fe61a59f",
                 "shasum": ""
             },
             "require": {
                 "doctrine/inflector": "^1.4|^2.0",
-                "dragonmantank/cron-expression": "^2.3.1",
+                "dragonmantank/cron-expression": "^3.0.2",
                 "egulias/email-validator": "^2.1.10",
                 "ext-json": "*",
                 "ext-mbstring": "*",
                 "ext-openssl": "*",
-                "league/commonmark": "^1.3",
+                "laravel/serializable-closure": "^1.0",
+                "league/commonmark": "^1.3|^2.0.2",
                 "league/flysystem": "^1.1",
                 "monolog/monolog": "^2.0",
-                "nesbot/carbon": "^2.31",
+                "nesbot/carbon": "^2.53.1",
                 "opis/closure": "^3.6",
-                "php": "^7.2.5|^8.0",
+                "php": "^7.3|^8.0",
                 "psr/container": "^1.0",
+                "psr/log": "^1.0 || ^2.0",
                 "psr/simple-cache": "^1.0",
-                "ramsey/uuid": "^3.7|^4.0",
-                "swiftmailer/swiftmailer": "^6.0",
-                "symfony/console": "^5.0",
-                "symfony/error-handler": "^5.0",
-                "symfony/finder": "^5.0",
-                "symfony/http-foundation": "^5.0",
-                "symfony/http-kernel": "^5.0",
-                "symfony/mime": "^5.0",
-                "symfony/polyfill-php73": "^1.17",
-                "symfony/process": "^5.0",
-                "symfony/routing": "^5.0",
-                "symfony/var-dumper": "^5.0",
+                "ramsey/uuid": "^4.2.2",
+                "swiftmailer/swiftmailer": "^6.3",
+                "symfony/console": "^5.1.4",
+                "symfony/error-handler": "^5.1.4",
+                "symfony/finder": "^5.1.4",
+                "symfony/http-foundation": "^5.1.4",
+                "symfony/http-kernel": "^5.1.4",
+                "symfony/mime": "^5.1.4",
+                "symfony/process": "^5.1.4",
+                "symfony/routing": "^5.1.4",
+                "symfony/var-dumper": "^5.1.4",
                 "tijsverkoyen/css-to-inline-styles": "^2.2.2",
-                "vlucas/phpdotenv": "^4.0",
+                "vlucas/phpdotenv": "^5.2",
                 "voku/portable-ascii": "^1.4.8"
             },
             "conflict": {
                 "tightenco/collect": "<5.5.33"
             },
             "provide": {
-                "psr/container-implementation": "1.0"
+                "psr/container-implementation": "1.0",
+                "psr/simple-cache-implementation": "1.0"
             },
             "replace": {
                 "illuminate/auth": "self.version",
                 "illuminate/broadcasting": "self.version",
                 "illuminate/bus": "self.version",
                 "illuminate/cache": "self.version",
+                "illuminate/collections": "self.version",
                 "illuminate/config": "self.version",
                 "illuminate/console": "self.version",
                 "illuminate/container": "self.version",
                 "illuminate/hashing": "self.version",
                 "illuminate/http": "self.version",
                 "illuminate/log": "self.version",
+                "illuminate/macroable": "self.version",
                 "illuminate/mail": "self.version",
                 "illuminate/notifications": "self.version",
                 "illuminate/pagination": "self.version",
                 "illuminate/view": "self.version"
             },
             "require-dev": {
-                "aws/aws-sdk-php": "^3.155",
-                "doctrine/dbal": "^2.6",
-                "filp/whoops": "^2.8",
-                "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
+                "aws/aws-sdk-php": "^3.198.1",
+                "doctrine/dbal": "^2.13.3|^3.1.2",
+                "filp/whoops": "^2.14.3",
+                "guzzlehttp/guzzle": "^6.5.5|^7.0.1",
                 "league/flysystem-cached-adapter": "^1.0",
-                "mockery/mockery": "~1.3.3|^1.4.2",
-                "moontoast/math": "^1.1",
-                "orchestra/testbench-core": "^5.8",
+                "mockery/mockery": "^1.4.4",
+                "orchestra/testbench-core": "^6.23",
                 "pda/pheanstalk": "^4.0",
-                "phpunit/phpunit": "^8.4|^9.3.3",
-                "predis/predis": "^1.1.1",
-                "symfony/cache": "^5.0"
+                "phpunit/phpunit": "^8.5.19|^9.5.8",
+                "predis/predis": "^1.1.9",
+                "symfony/cache": "^5.1.4"
             },
             "suggest": {
-                "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).",
-                "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).",
+                "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.198.1).",
+                "brianium/paratest": "Required to run tests in parallel (^6.0).",
+                "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.2).",
+                "ext-bcmath": "Required to use the multiple_of validation rule.",
                 "ext-ftp": "Required to use the Flysystem FTP driver.",
                 "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
                 "ext-memcached": "Required to use the memcache cache driver.",
                 "ext-posix": "Required to use all features of the queue worker.",
                 "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
                 "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
-                "filp/whoops": "Required for friendly error pages in development (^2.8).",
-                "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0.1).",
+                "filp/whoops": "Required for friendly error pages in development (^2.14.3).",
+                "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).",
                 "laravel/tinker": "Required to use the tinker console command (^2.0).",
                 "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
                 "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
                 "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
-                "mockery/mockery": "Required to use mocking (~1.3.3|^1.4.2).",
-                "moontoast/math": "Required to use ordered UUIDs (^1.1).",
+                "mockery/mockery": "Required to use mocking (^1.4.4).",
                 "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
                 "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
-                "phpunit/phpunit": "Required to use assertions and run tests (^8.4|^9.3.3).",
-                "predis/predis": "Required to use the predis connector (^1.1.2).",
+                "phpunit/phpunit": "Required to use assertions and run tests (^8.5.19|^9.5.8).",
+                "predis/predis": "Required to use the predis connector (^1.1.9).",
                 "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
-                "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).",
-                "symfony/cache": "Required to PSR-6 cache bridge (^5.0).",
-                "symfony/filesystem": "Required to create relative storage directory symbolic links (^5.0).",
+                "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0|^6.0).",
+                "symfony/cache": "Required to PSR-6 cache bridge (^5.1.4).",
+                "symfony/filesystem": "Required to enable support for relative symbolic links (^5.1.4).",
                 "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
                 "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "7.x-dev"
+                    "dev-master": "8.x-dev"
                 }
             },
             "autoload": {
                 "files": [
+                    "src/Illuminate/Collections/helpers.php",
+                    "src/Illuminate/Events/functions.php",
                     "src/Illuminate/Foundation/helpers.php",
                     "src/Illuminate/Support/helpers.php"
                 ],
                 "psr-4": {
-                    "Illuminate\\": "src/Illuminate/"
+                    "Illuminate\\": "src/Illuminate/",
+                    "Illuminate\\Support\\": [
+                        "src/Illuminate/Macroable/",
+                        "src/Illuminate/Collections/"
+                    ]
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2021-01-21T14:10:48+00:00"
+            "time": "2021-10-27T12:31:46+00:00"
+        },
+        {
+            "name": "laravel/serializable-closure",
+            "version": "v1.0.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/laravel/serializable-closure.git",
+                "reference": "6cfc678735f22ccedad761b8cae2bab14c3d8e5b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/6cfc678735f22ccedad761b8cae2bab14c3d8e5b",
+                "reference": "6cfc678735f22ccedad761b8cae2bab14c3d8e5b",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.3|^8.0"
+            },
+            "require-dev": {
+                "pestphp/pest": "^1.18",
+                "phpstan/phpstan": "^0.12.98",
+                "symfony/var-dumper": "^5.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Laravel\\SerializableClosure\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Taylor Otwell",
+                    "email": "[email protected]"
+                },
+                {
+                    "name": "Nuno Maduro",
+                    "email": "[email protected]"
+                }
+            ],
+            "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.",
+            "keywords": [
+                "closure",
+                "laravel",
+                "serializable"
+            ],
+            "support": {
+                "issues": "https://github.com/laravel/serializable-closure/issues",
+                "source": "https://github.com/laravel/serializable-closure"
+            },
+            "time": "2021-10-07T14:00:57+00:00"
         },
         {
             "name": "laravel/socialite",
         },
         {
             "name": "laravel/ui",
-            "version": "v2.5.0",
+            "version": "v3.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/ui.git",
-                "reference": "d01a705763c243b07be795e9d1bb47f89260f73d"
+                "reference": "07d725813350c695c779382cbd6dac0ab8665537"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/ui/zipball/d01a705763c243b07be795e9d1bb47f89260f73d",
-                "reference": "d01a705763c243b07be795e9d1bb47f89260f73d",
+                "url": "https://api.github.com/repos/laravel/ui/zipball/07d725813350c695c779382cbd6dac0ab8665537",
+                "reference": "07d725813350c695c779382cbd6dac0ab8665537",
                 "shasum": ""
             },
             "require": {
-                "illuminate/console": "^7.0",
-                "illuminate/filesystem": "^7.0",
-                "illuminate/support": "^7.0",
-                "php": "^7.2.5|^8.0"
+                "illuminate/console": "^8.42",
+                "illuminate/filesystem": "^8.42",
+                "illuminate/support": "^8.42",
+                "illuminate/validation": "^8.42",
+                "php": "^7.3|^8.0"
             },
             "type": "library",
             "extra": {
+                "branch-alias": {
+                    "dev-master": "3.x-dev"
+                },
                 "laravel": {
                     "providers": [
                         "Laravel\\Ui\\UiServiceProvider"
                 "ui"
             ],
             "support": {
-                "issues": "https://github.com/laravel/ui/issues",
-                "source": "https://github.com/laravel/ui/tree/v2.5.0"
+                "source": "https://github.com/laravel/ui/tree/v3.3.0"
             },
-            "time": "2020-11-03T19:45:19+00:00"
+            "time": "2021-05-25T16:45:33+00:00"
         },
         {
             "name": "league/commonmark",
         },
         {
             "name": "phpseclib/phpseclib",
-            "version": "3.0.10",
+            "version": "3.0.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpseclib/phpseclib.git",
-                "reference": "62fcc5a94ac83b1506f52d7558d828617fac9187"
+                "reference": "6e794226a35159eb06f355efe59a0075a16551dd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/62fcc5a94ac83b1506f52d7558d828617fac9187",
-                "reference": "62fcc5a94ac83b1506f52d7558d828617fac9187",
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/6e794226a35159eb06f355efe59a0075a16551dd",
+                "reference": "6e794226a35159eb06f355efe59a0075a16551dd",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/phpseclib/phpseclib/issues",
-                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.10"
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.11"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-16T04:24:45+00:00"
+            "time": "2021-10-27T03:01:46+00:00"
         },
         {
             "name": "pragmarx/google2fa",
         },
         {
             "name": "symfony/console",
-            "version": "v5.3.7",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/console.git",
-                "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a"
+                "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a",
-                "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a",
+                "url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
+                "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
                 "shasum": ""
             },
             "require": {
                 "terminal"
             ],
             "support": {
-                "source": "https://github.com/symfony/console/tree/v5.3.7"
+                "source": "https://github.com/symfony/console/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-25T20:02:16+00:00"
+            "time": "2021-10-26T09:30:15+00:00"
         },
         {
             "name": "symfony/css-selector",
         },
         {
             "name": "symfony/http-foundation",
-            "version": "v5.3.7",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/http-foundation.git",
-                "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5"
+                "reference": "9f34f02e8a5fdc7a56bafe011cea1ce97300e54c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5",
-                "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5",
+                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9f34f02e8a5fdc7a56bafe011cea1ce97300e54c",
+                "reference": "9f34f02e8a5fdc7a56bafe011cea1ce97300e54c",
                 "shasum": ""
             },
             "require": {
             "description": "Defines an object-oriented layer for the HTTP specification",
             "homepage": "https://symfony.com",
             "support": {
-                "source": "https://github.com/symfony/http-foundation/tree/v5.3.7"
+                "source": "https://github.com/symfony/http-foundation/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-27T11:20:35+00:00"
+            "time": "2021-10-11T15:41:55+00:00"
         },
         {
             "name": "symfony/http-kernel",
-            "version": "v5.3.9",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/http-kernel.git",
-                "reference": "ceaf46a992f60e90645e7279825a830f733a17c5"
+                "reference": "703e4079920468e9522b72cf47fd76ce8d795e86"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ceaf46a992f60e90645e7279825a830f733a17c5",
-                "reference": "ceaf46a992f60e90645e7279825a830f733a17c5",
+                "url": "https://api.github.com/repos/symfony/http-kernel/zipball/703e4079920468e9522b72cf47fd76ce8d795e86",
+                "reference": "703e4079920468e9522b72cf47fd76ce8d795e86",
                 "shasum": ""
             },
             "require": {
             "description": "Provides a structured process for converting a Request into a Response",
             "homepage": "https://symfony.com",
             "support": {
-                "source": "https://github.com/symfony/http-kernel/tree/v5.3.9"
+                "source": "https://github.com/symfony/http-kernel/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-09-28T10:25:11+00:00"
+            "time": "2021-10-29T08:36:48+00:00"
         },
         {
             "name": "symfony/mime",
         },
         {
             "name": "symfony/string",
-            "version": "v5.3.7",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/string.git",
-                "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5"
+                "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5",
-                "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5",
+                "url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
+                "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
                 "shasum": ""
             },
             "require": {
                 "utf8"
             ],
             "support": {
-                "source": "https://github.com/symfony/string/tree/v5.3.7"
+                "source": "https://github.com/symfony/string/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-26T08:00:08+00:00"
+            "time": "2021-10-27T18:21:46+00:00"
         },
         {
             "name": "symfony/translation",
-            "version": "v5.3.9",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/translation.git",
-                "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886"
+                "reference": "6ef197aea2ac8b9cd63e0da7522b3771714035aa"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/translation/zipball/6e69f3551c1a3356cf6ea8d019bf039a0f8b6886",
-                "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886",
+                "url": "https://api.github.com/repos/symfony/translation/zipball/6ef197aea2ac8b9cd63e0da7522b3771714035aa",
+                "reference": "6ef197aea2ac8b9cd63e0da7522b3771714035aa",
                 "shasum": ""
             },
             "require": {
             "description": "Provides tools to internationalize your application",
             "homepage": "https://symfony.com",
             "support": {
-                "source": "https://github.com/symfony/translation/tree/v5.3.9"
+                "source": "https://github.com/symfony/translation/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-26T08:22:53+00:00"
+            "time": "2021-10-10T06:43:24+00:00"
         },
         {
             "name": "symfony/translation-contracts",
         },
         {
             "name": "symfony/var-dumper",
-            "version": "v5.3.8",
+            "version": "v5.3.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/var-dumper.git",
-                "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da"
+                "reference": "875432adb5f5570fff21036fd22aee244636b7d1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da",
-                "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da",
+                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/875432adb5f5570fff21036fd22aee244636b7d1",
+                "reference": "875432adb5f5570fff21036fd22aee244636b7d1",
                 "shasum": ""
             },
             "require": {
                 "dump"
             ],
             "support": {
-                "source": "https://github.com/symfony/var-dumper/tree/v5.3.8"
+                "source": "https://github.com/symfony/var-dumper/tree/v5.3.10"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-09-24T15:59:58+00:00"
+            "time": "2021-10-26T09:30:15+00:00"
         },
         {
             "name": "tijsverkoyen/css-to-inline-styles",
         },
         {
             "name": "vlucas/phpdotenv",
-            "version": "v4.2.1",
+            "version": "v5.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/vlucas/phpdotenv.git",
-                "reference": "d38f4d1edcbe32515a0ad593cbd4c858e337263c"
+                "reference": "accaddf133651d4b5cf81a119f25296736ffc850"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/d38f4d1edcbe32515a0ad593cbd4c858e337263c",
-                "reference": "d38f4d1edcbe32515a0ad593cbd4c858e337263c",
+                "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/accaddf133651d4b5cf81a119f25296736ffc850",
+                "reference": "accaddf133651d4b5cf81a119f25296736ffc850",
                 "shasum": ""
             },
             "require": {
-                "php": "^5.5.9 || ^7.0 || ^8.0",
-                "phpoption/phpoption": "^1.7.3",
-                "symfony/polyfill-ctype": "^1.17"
+                "ext-pcre": "*",
+                "graham-campbell/result-type": "^1.0.2",
+                "php": "^7.1.3 || ^8.0",
+                "phpoption/phpoption": "^1.8",
+                "symfony/polyfill-ctype": "^1.23",
+                "symfony/polyfill-mbstring": "^1.23.1",
+                "symfony/polyfill-php80": "^1.23.1"
             },
             "require-dev": {
                 "bamarni/composer-bin-plugin": "^1.4.1",
                 "ext-filter": "*",
-                "ext-pcre": "*",
-                "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21"
+                "phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10"
             },
             "suggest": {
-                "ext-filter": "Required to use the boolean validator.",
-                "ext-pcre": "Required to use most of the library."
+                "ext-filter": "Required to use the boolean validator."
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "4.2-dev"
+                    "dev-master": "5.3-dev"
                 }
             },
             "autoload": {
             ],
             "support": {
                 "issues": "https://github.com/vlucas/phpdotenv/issues",
-                "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.1"
+                "source": "https://github.com/vlucas/phpdotenv/tree/v5.3.1"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-10-02T19:17:08+00:00"
+            "time": "2021-10-02T19:24:42+00:00"
         },
         {
             "name": "voku/portable-ascii",
                 }
             ],
             "time": "2020-11-12T00:07:28+00:00"
+        },
+        {
+            "name": "webmozart/assert",
+            "version": "1.10.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/webmozarts/assert.git",
+                "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
+                "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.2 || ^8.0",
+                "symfony/polyfill-ctype": "^1.8"
+            },
+            "conflict": {
+                "phpstan/phpstan": "<0.12.20",
+                "vimeo/psalm": "<4.6.1 || 4.6.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^8.5.13"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.10-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Webmozart\\Assert\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "[email protected]"
+                }
+            ],
+            "description": "Assertions to validate method input/output with nice error messages.",
+            "keywords": [
+                "assert",
+                "check",
+                "validate"
+            ],
+            "support": {
+                "issues": "https://github.com/webmozarts/assert/issues",
+                "source": "https://github.com/webmozarts/assert/tree/1.10.0"
+            },
+            "time": "2021-03-09T10:59:23+00:00"
         }
     ],
     "packages-dev": [
         },
         {
             "name": "nunomaduro/collision",
-            "version": "v4.3.0",
+            "version": "v5.10.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/nunomaduro/collision.git",
-                "reference": "7c125dc2463f3e144ddc7e05e63077109508c94e"
+                "reference": "3004cfa49c022183395eabc6d0e5207dfe498d00"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/nunomaduro/collision/zipball/7c125dc2463f3e144ddc7e05e63077109508c94e",
-                "reference": "7c125dc2463f3e144ddc7e05e63077109508c94e",
+                "url": "https://api.github.com/repos/nunomaduro/collision/zipball/3004cfa49c022183395eabc6d0e5207dfe498d00",
+                "reference": "3004cfa49c022183395eabc6d0e5207dfe498d00",
                 "shasum": ""
             },
             "require": {
                 "facade/ignition-contracts": "^1.0",
-                "filp/whoops": "^2.4",
-                "php": "^7.2.5 || ^8.0",
+                "filp/whoops": "^2.14.3",
+                "php": "^7.3 || ^8.0",
                 "symfony/console": "^5.0"
             },
             "require-dev": {
-                "facade/ignition": "^2.0",
-                "fideloper/proxy": "^4.2",
-                "friendsofphp/php-cs-fixer": "^2.16",
-                "fruitcake/laravel-cors": "^1.0",
-                "laravel/framework": "^7.0",
-                "laravel/tinker": "^2.0",
-                "nunomaduro/larastan": "^0.6",
-                "orchestra/testbench": "^5.0",
-                "phpstan/phpstan": "^0.12.3",
-                "phpunit/phpunit": "^8.5.1 || ^9.0"
+                "brianium/paratest": "^6.1",
+                "fideloper/proxy": "^4.4.1",
+                "fruitcake/laravel-cors": "^2.0.3",
+                "laravel/framework": "8.x-dev",
+                "nunomaduro/larastan": "^0.6.2",
+                "nunomaduro/mock-final-classes": "^1.0",
+                "orchestra/testbench": "^6.0",
+                "phpstan/phpstan": "^0.12.64",
+                "phpunit/phpunit": "^9.5.0"
             },
             "type": "library",
             "extra": {
                     "type": "patreon"
                 }
             ],
-            "time": "2020-10-29T15:12:23+00:00"
+            "time": "2021-09-20T15:06:32+00:00"
         },
         {
             "name": "phar-io/manifest",
         },
         {
             "name": "phpunit/php-code-coverage",
-            "version": "9.2.7",
+            "version": "9.2.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
-                "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218"
+                "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218",
-                "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
+                "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
                 "shasum": ""
             },
             "require": {
                 "ext-dom": "*",
                 "ext-libxml": "*",
                 "ext-xmlwriter": "*",
-                "nikic/php-parser": "^4.12.0",
+                "nikic/php-parser": "^4.13.0",
                 "php": ">=7.3",
                 "phpunit/php-file-iterator": "^3.0.3",
                 "phpunit/php-text-template": "^2.0.2",
             ],
             "support": {
                 "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
-                "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7"
+                "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.8"
             },
             "funding": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2021-09-17T05:39:03+00:00"
+            "time": "2021-10-30T08:01:38+00:00"
         },
         {
             "name": "phpunit/php-file-iterator",
                 }
             ],
             "time": "2021-07-28T10:34:58+00:00"
-        },
-        {
-            "name": "webmozart/assert",
-            "version": "1.10.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/webmozarts/assert.git",
-                "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
-                "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
-                "shasum": ""
-            },
-            "require": {
-                "php": "^7.2 || ^8.0",
-                "symfony/polyfill-ctype": "^1.8"
-            },
-            "conflict": {
-                "phpstan/phpstan": "<0.12.20",
-                "vimeo/psalm": "<4.6.1 || 4.6.2"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "^8.5.13"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.10-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Webmozart\\Assert\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Bernhard Schussek",
-                    "email": "[email protected]"
-                }
-            ],
-            "description": "Assertions to validate method input/output with nice error messages.",
-            "keywords": [
-                "assert",
-                "check",
-                "validate"
-            ],
-            "support": {
-                "issues": "https://github.com/webmozarts/assert/issues",
-                "source": "https://github.com/webmozarts/assert/tree/1.10.0"
-            },
-            "time": "2021-03-09T10:59:23+00:00"
         }
     ],
     "aliases": [],
diff --git a/database/factories/Actions/CommentFactory.php b/database/factories/Actions/CommentFactory.php
new file mode 100644 (file)
index 0000000..e81f3fe
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Database\Factories\Actions;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+
+class CommentFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Actions\Comment::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        $text = $this->faker->paragraph(1);
+        $html = '<p>' . $text . '</p>';
+
+        return [
+            'html'      => $html,
+            'text'      => $text,
+            'parent_id' => null,
+        ];
+    }
+}
diff --git a/database/factories/Actions/TagFactory.php b/database/factories/Actions/TagFactory.php
new file mode 100644 (file)
index 0000000..8d5c77e
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Database\Factories\Actions;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+
+class TagFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Actions\Tag::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'name'  => $this->faker->city,
+            'value' => $this->faker->sentence(3),
+        ];
+    }
+}
diff --git a/database/factories/Auth/RoleFactory.php b/database/factories/Auth/RoleFactory.php
new file mode 100644 (file)
index 0000000..a952e04
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Database\Factories\Auth;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+
+class RoleFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Auth\Role::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'display_name' => $this->faker->sentence(3),
+            'description'  => $this->faker->sentence(10),
+        ];
+    }
+}
diff --git a/database/factories/Auth/UserFactory.php b/database/factories/Auth/UserFactory.php
new file mode 100644 (file)
index 0000000..77d63ac
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace Database\Factories\Auth;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Str;
+
+class UserFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Auth\User::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        $name = $this->faker->name;
+
+        return [
+            'name'            => $name,
+            'email'           => $this->faker->email,
+            'slug'            => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
+            'password'        => Str::random(10),
+            'remember_token'  => Str::random(10),
+            'email_confirmed' => 1,
+        ];
+    }
+}
diff --git a/database/factories/Entities/Models/BookFactory.php b/database/factories/Entities/Models/BookFactory.php
new file mode 100644 (file)
index 0000000..0613800
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Database\Factories\Entities\Models;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Str;
+
+class BookFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Entities\Models\Book::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'name'        => $this->faker->sentence,
+            'slug'        => Str::random(10),
+            'description' => $this->faker->paragraph,
+        ];
+    }
+}
diff --git a/database/factories/Entities/Models/BookshelfFactory.php b/database/factories/Entities/Models/BookshelfFactory.php
new file mode 100644 (file)
index 0000000..66dd1c1
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Database\Factories\Entities\Models;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Str;
+
+class BookshelfFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Entities\Models\Bookshelf::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'name'        => $this->faker->sentence,
+            'slug'        => Str::random(10),
+            'description' => $this->faker->paragraph,
+        ];
+    }
+}
diff --git a/database/factories/Entities/Models/ChapterFactory.php b/database/factories/Entities/Models/ChapterFactory.php
new file mode 100644 (file)
index 0000000..4fcd69c
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Database\Factories\Entities\Models;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Str;
+
+class ChapterFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Entities\Models\Chapter::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'name'        => $this->faker->sentence,
+            'slug'        => Str::random(10),
+            'description' => $this->faker->paragraph,
+        ];
+    }
+}
diff --git a/database/factories/Entities/Models/PageFactory.php b/database/factories/Entities/Models/PageFactory.php
new file mode 100644 (file)
index 0000000..c83e0f8
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Database\Factories\Entities\Models;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Str;
+
+class PageFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Entities\Models\Page::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        $html = '<p>' . implode('</p>', $this->faker->paragraphs(5)) . '</p>';
+
+        return [
+            'name'           => $this->faker->sentence,
+            'slug'           => Str::random(10),
+            'html'           => $html,
+            'text'           => strip_tags($html),
+            'revision_count' => 1,
+        ];
+    }
+}
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
deleted file mode 100644 (file)
index dc06455..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/*
-|--------------------------------------------------------------------------
-| Model Factories
-|--------------------------------------------------------------------------
-|
-| Here you may define all of your model factories. Model factories give
-| you a convenient way to create models for testing and seeding your
-| database. Just tell the factory how a default model should look.
-|
-*/
-
-$factory->define(\BookStack\Auth\User::class, function ($faker) {
-    $name = $faker->name;
-
-    return [
-        'name'            => $name,
-        'email'           => $faker->email,
-        'slug'            => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
-        'password'        => Str::random(10),
-        'remember_token'  => Str::random(10),
-        'email_confirmed' => 1,
-    ];
-});
-
-$factory->define(\BookStack\Entities\Models\Bookshelf::class, function ($faker) {
-    return [
-        'name'        => $faker->sentence,
-        'slug'        => Str::random(10),
-        'description' => $faker->paragraph,
-    ];
-});
-
-$factory->define(\BookStack\Entities\Models\Book::class, function ($faker) {
-    return [
-        'name'        => $faker->sentence,
-        'slug'        => Str::random(10),
-        'description' => $faker->paragraph,
-    ];
-});
-
-$factory->define(\BookStack\Entities\Models\Chapter::class, function ($faker) {
-    return [
-        'name'        => $faker->sentence,
-        'slug'        => Str::random(10),
-        'description' => $faker->paragraph,
-    ];
-});
-
-$factory->define(\BookStack\Entities\Models\Page::class, function ($faker) {
-    $html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
-
-    return [
-        'name'           => $faker->sentence,
-        'slug'           => Str::random(10),
-        'html'           => $html,
-        'text'           => strip_tags($html),
-        'revision_count' => 1,
-    ];
-});
-
-$factory->define(\BookStack\Auth\Role::class, function ($faker) {
-    return [
-        'display_name' => $faker->sentence(3),
-        'description'  => $faker->sentence(10),
-    ];
-});
-
-$factory->define(\BookStack\Actions\Tag::class, function ($faker) {
-    return [
-        'name'  => $faker->city,
-        'value' => $faker->sentence(3),
-    ];
-});
-
-$factory->define(\BookStack\Uploads\Image::class, function ($faker) {
-    return [
-        'name'        => $faker->slug . '.jpg',
-        'url'         => $faker->url,
-        'path'        => $faker->url,
-        'type'        => 'gallery',
-        'uploaded_to' => 0,
-    ];
-});
-
-$factory->define(\BookStack\Actions\Comment::class, function ($faker) {
-    $text = $faker->paragraph(1);
-    $html = '<p>' . $text . '</p>';
-
-    return [
-        'html'      => $html,
-        'text'      => $text,
-        'parent_id' => null,
-    ];
-});
diff --git a/database/factories/Uploads/ImageFactory.php b/database/factories/Uploads/ImageFactory.php
new file mode 100644 (file)
index 0000000..c6d0e08
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+namespace Database\Factories\Uploads;
+
+use Illuminate\Database\Eloquent\Factories\Factory;
+
+class ImageFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = \BookStack\Uploads\Image::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+        return [
+            'name'        => $this->faker->slug . '.jpg',
+            'url'         => $this->faker->url,
+            'path'        => $this->faker->url,
+            'type'        => 'gallery',
+            'uploaded_to' => 0,
+        ];
+    }
+}
similarity index 92%
rename from database/seeds/DatabaseSeeder.php
rename to database/seeders/DatabaseSeeder.php
index 069765eb48cb36aed6610d4d73452a18b1abfb41..21eaefb19ffde6f1633af29a87340585bcd31c55 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+namespace Database\Seeders;
+
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Seeder;
 
similarity index 71%
rename from database/seeds/DummyContentSeeder.php
rename to database/seeders/DummyContentSeeder.php
index 7463a3b3760ac006bb26c3e5845d3300e8f3cb67..d54732b26357338c7d9b20bcd367254c1a0afe9c 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+namespace Database\Seeders;
+
 use BookStack\Api\ApiToken;
 use BookStack\Auth\Permissions\PermissionService;
 use BookStack\Auth\Permissions\RolePermission;
@@ -10,6 +12,7 @@ use BookStack\Entities\Models\Chapter;
 use BookStack\Entities\Models\Page;
 use BookStack\Entities\Tools\SearchIndex;
 use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Str;
 
 class DummyContentSeeder extends Seeder
@@ -22,36 +25,36 @@ class DummyContentSeeder extends Seeder
     public function run()
     {
         // Create an editor user
-        $editorUser = factory(User::class)->create();
+        $editorUser = User::factory()->create();
         $editorRole = Role::getRole('editor');
         $editorUser->attachRole($editorRole);
 
         // Create a viewer user
-        $viewerUser = factory(User::class)->create();
+        $viewerUser = User::factory()->create();
         $role = Role::getRole('viewer');
         $viewerUser->attachRole($role);
 
         $byData = ['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'owned_by' => $editorUser->id];
 
-        factory(\BookStack\Entities\Models\Book::class, 5)->create($byData)
+        \BookStack\Entities\Models\Book::factory()->count(5)->create($byData)
             ->each(function ($book) use ($byData) {
-                $chapters = factory(Chapter::class, 3)->create($byData)
+                $chapters = Chapter::factory()->count(3)->create($byData)
                     ->each(function ($chapter) use ($book, $byData) {
-                        $pages = factory(Page::class, 3)->make(array_merge($byData, ['book_id' => $book->id]));
+                        $pages = Page::factory()->count(3)->make(array_merge($byData, ['book_id' => $book->id]));
                         $chapter->pages()->saveMany($pages);
                     });
-                $pages = factory(Page::class, 3)->make($byData);
+                $pages = Page::factory()->count(3)->make($byData);
                 $book->chapters()->saveMany($chapters);
                 $book->pages()->saveMany($pages);
             });
 
-        $largeBook = factory(\BookStack\Entities\Models\Book::class)->create(array_merge($byData, ['name' => 'Large book' . Str::random(10)]));
-        $pages = factory(Page::class, 200)->make($byData);
-        $chapters = factory(Chapter::class, 50)->make($byData);
+        $largeBook = \BookStack\Entities\Models\Book::factory()->create(array_merge($byData, ['name' => 'Large book' . Str::random(10)]));
+        $pages = Page::factory()->count(200)->make($byData);
+        $chapters = Chapter::factory()->count(50)->make($byData);
         $largeBook->pages()->saveMany($pages);
         $largeBook->chapters()->saveMany($chapters);
 
-        $shelves = factory(Bookshelf::class, 10)->create($byData);
+        $shelves = Bookshelf::factory()->count(10)->create($byData);
         $largeBook->shelves()->attach($shelves->pluck('id'));
 
         // Assign API permission to editor role and create an API key
similarity index 60%
rename from database/seeds/LargeContentSeeder.php
rename to database/seeders/LargeContentSeeder.php
index 535626b8f794e8c74fb3d28a8b0bfe6ce7612975..2fbf4a5c9822c9234ebffb42f43975d944ff4ff4 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+namespace Database\Seeders;
+
 use BookStack\Auth\Permissions\PermissionService;
 use BookStack\Auth\Role;
 use BookStack\Auth\User;
@@ -19,13 +21,13 @@ class LargeContentSeeder extends Seeder
     public function run()
     {
         // Create an editor user
-        $editorUser = factory(User::class)->create();
+        $editorUser = User::factory()->create();
         $editorRole = Role::getRole('editor');
         $editorUser->attachRole($editorRole);
 
-        $largeBook = factory(\BookStack\Entities\Models\Book::class)->create(['name' => 'Large book' . Str::random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
-        $pages = factory(Page::class, 200)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
-        $chapters = factory(Chapter::class, 50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
+        $largeBook = \BookStack\Entities\Models\Book::factory()->create(['name' => 'Large book' . Str::random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
+        $pages = Page::factory()->count(200)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
+        $chapters = Chapter::factory()->count(50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]);
         $largeBook->pages()->saveMany($pages);
         $largeBook->chapters()->saveMany($chapters);
         app(PermissionService::class)->buildJointPermissions();
index 7e4ef97c7074672e42069c9595e217005224892a..c2f34d4bf27c8f206a049e7586c4f2cc5597238e 100644 (file)
@@ -1,59 +1,56 @@
 <?php
 
-/**
- * Laravel - A PHP Framework For Web Artisans.
- *
- * @author   Taylor Otwell <[email protected]>
- */
+use Illuminate\Contracts\Http\Kernel;
+use BookStack\Http\Request;
+
 define('LARAVEL_START', microtime(true));
 
 /*
 |--------------------------------------------------------------------------
-| Register The Auto Loader
+| Check If The Application Is Under Maintenance
 |--------------------------------------------------------------------------
 |
-| Composer provides a convenient, automatically generated class loader for
-| our application. We just need to utilize it! We'll simply require it
-| into the script here so that we don't have to worry about manual
-| loading any of our classes later on. It feels great to relax.
+| If the application is in maintenance / demo mode via the "down" command
+| we will load this file so that any pre-rendered content can be shown
+| instead of starting the framework, which could cause an exception.
 |
 */
 
-require __DIR__ . '/../vendor/autoload.php';
+if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
+    require __DIR__ . '/../storage/framework/maintenance.php';
+}
 
 /*
 |--------------------------------------------------------------------------
-| Turn On The Lights
+| Register The Auto Loader
 |--------------------------------------------------------------------------
 |
-| We need to illuminate PHP development, so let us turn on the lights.
-| This bootstraps the framework and gets it ready for use, then it
-| will load up this application so that we can run it and send
-| the responses back to the browser and delight our users.
+| Composer provides a convenient, automatically generated class loader for
+| this application. We just need to utilize it! We'll simply require it
+| into the script here so we don't need to manually load our classes.
 |
 */
 
-$app = require_once __DIR__ . '/../bootstrap/app.php';
-$app->alias('request', \BookStack\Http\Request::class);
+require __DIR__ . '/../vendor/autoload.php';
 
 /*
 |--------------------------------------------------------------------------
 | Run The Application
 |--------------------------------------------------------------------------
 |
-| Once we have the application, we can handle the incoming request
-| through the kernel, and send the associated response back to
-| the client's browser allowing them to enjoy the creative
-| and wonderful application we have prepared for them.
+| 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.
 |
 */
 
-$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
+$app = require_once __DIR__ . '/../bootstrap/app.php';
+$app->alias('request', Request::class);
 
-$response = $kernel->handle(
-    $request = \BookStack\Http\Request::capture()
-);
+$kernel = $app->make(Kernel::class);
 
-$response->send();
+$response = tap($kernel->handle(
+    $request = Request::capture()
+))->send();
 
-$kernel->terminate($request, $response);
+$kernel->terminate($request, $response);
\ No newline at end of file
index 49521bb89190ceddf4205ba495406f5815551b4d..4ba49946247a719532c817cd16c5ef865ac8a945 100644 (file)
@@ -1,53 +1,64 @@
 <?php
 
+use BookStack\Http\Controllers\Api\ApiDocsController;
+use BookStack\Http\Controllers\Api\AttachmentApiController;
+use BookStack\Http\Controllers\Api\BookApiController;
+use BookStack\Http\Controllers\Api\BookExportApiController;
+use BookStack\Http\Controllers\Api\BookshelfApiController;
+use BookStack\Http\Controllers\Api\ChapterApiController;
+use BookStack\Http\Controllers\Api\ChapterExportApiController;
+use BookStack\Http\Controllers\Api\PageApiController;
+use BookStack\Http\Controllers\Api\PageExportApiController;
+use Illuminate\Support\Facades\Route;
+
 /**
  * Routes for the BookStack API.
  * Routes have a uri prefix of /api/.
  * Controllers are all within app/Http/Controllers/Api.
  */
-Route::get('docs.json', 'ApiDocsController@json');
-
-Route::get('attachments', 'AttachmentApiController@list');
-Route::post('attachments', 'AttachmentApiController@create');
-Route::get('attachments/{id}', 'AttachmentApiController@read');
-Route::put('attachments/{id}', 'AttachmentApiController@update');
-Route::delete('attachments/{id}', 'AttachmentApiController@delete');
-
-Route::get('books', 'BookApiController@list');
-Route::post('books', 'BookApiController@create');
-Route::get('books/{id}', 'BookApiController@read');
-Route::put('books/{id}', 'BookApiController@update');
-Route::delete('books/{id}', 'BookApiController@delete');
-
-Route::get('books/{id}/export/html', 'BookExportApiController@exportHtml');
-Route::get('books/{id}/export/pdf', 'BookExportApiController@exportPdf');
-Route::get('books/{id}/export/plaintext', 'BookExportApiController@exportPlainText');
-Route::get('books/{id}/export/markdown', 'BookExportApiController@exportMarkdown');
-
-Route::get('chapters', 'ChapterApiController@list');
-Route::post('chapters', 'ChapterApiController@create');
-Route::get('chapters/{id}', 'ChapterApiController@read');
-Route::put('chapters/{id}', 'ChapterApiController@update');
-Route::delete('chapters/{id}', 'ChapterApiController@delete');
-
-Route::get('chapters/{id}/export/html', 'ChapterExportApiController@exportHtml');
-Route::get('chapters/{id}/export/pdf', 'ChapterExportApiController@exportPdf');
-Route::get('chapters/{id}/export/plaintext', 'ChapterExportApiController@exportPlainText');
-Route::get('chapters/{id}/export/markdown', 'ChapterExportApiController@exportMarkdown');
-
-Route::get('pages', 'PageApiController@list');
-Route::post('pages', 'PageApiController@create');
-Route::get('pages/{id}', 'PageApiController@read');
-Route::put('pages/{id}', 'PageApiController@update');
-Route::delete('pages/{id}', 'PageApiController@delete');
-
-Route::get('pages/{id}/export/html', 'PageExportApiController@exportHtml');
-Route::get('pages/{id}/export/pdf', 'PageExportApiController@exportPdf');
-Route::get('pages/{id}/export/plaintext', 'PageExportApiController@exportPlainText');
-Route::get('pages/{id}/export/markdown', 'PageExportApiController@exportMarkDown');
-
-Route::get('shelves', 'BookshelfApiController@list');
-Route::post('shelves', 'BookshelfApiController@create');
-Route::get('shelves/{id}', 'BookshelfApiController@read');
-Route::put('shelves/{id}', 'BookshelfApiController@update');
-Route::delete('shelves/{id}', 'BookshelfApiController@delete');
+Route::get('docs.json', [ApiDocsController::class, 'json']);
+
+Route::get('attachments', [AttachmentApiController::class, 'list']);
+Route::post('attachments', [AttachmentApiController::class, 'create']);
+Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
+Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
+Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
+
+Route::get('books', [BookApiController::class, 'list']);
+Route::post('books', [BookApiController::class, 'create']);
+Route::get('books/{id}', [BookApiController::class, 'read']);
+Route::put('books/{id}', [BookApiController::class, 'update']);
+Route::delete('books/{id}', [BookApiController::class, 'delete']);
+
+Route::get('books/{id}/export/html', [BookExportApiController::class, 'exportHtml']);
+Route::get('books/{id}/export/pdf', [BookExportApiController::class, 'exportPdf']);
+Route::get('books/{id}/export/plaintext', [BookExportApiController::class, 'exportPlainText']);
+Route::get('books/{id}/export/markdown', [BookExportApiController::class, 'exportMarkdown']);
+
+Route::get('chapters', [ChapterApiController::class, 'list']);
+Route::post('chapters', [ChapterApiController::class, 'create']);
+Route::get('chapters/{id}', [ChapterApiController::class, 'read']);
+Route::put('chapters/{id}', [ChapterApiController::class, 'update']);
+Route::delete('chapters/{id}', [ChapterApiController::class, 'delete']);
+
+Route::get('chapters/{id}/export/html', [ChapterExportApiController::class, 'exportHtml']);
+Route::get('chapters/{id}/export/pdf', [ChapterExportApiController::class, 'exportPdf']);
+Route::get('chapters/{id}/export/plaintext', [ChapterExportApiController::class, 'exportPlainText']);
+Route::get('chapters/{id}/export/markdown', [ChapterExportApiController::class, 'exportMarkdown']);
+
+Route::get('pages', [PageApiController::class, 'list']);
+Route::post('pages', [PageApiController::class, 'create']);
+Route::get('pages/{id}', [PageApiController::class, 'read']);
+Route::put('pages/{id}', [PageApiController::class, 'update']);
+Route::delete('pages/{id}', [PageApiController::class, 'delete']);
+
+Route::get('pages/{id}/export/html', [PageExportApiController::class, 'exportHtml']);
+Route::get('pages/{id}/export/pdf', [PageExportApiController::class, 'exportPdf']);
+Route::get('pages/{id}/export/plaintext', [PageExportApiController::class, 'exportPlainText']);
+Route::get('pages/{id}/export/markdown', [PageExportApiController::class, 'exportMarkDown']);
+
+Route::get('shelves', [BookshelfApiController::class, 'list']);
+Route::post('shelves', [BookshelfApiController::class, 'create']);
+Route::get('shelves/{id}', [BookshelfApiController::class, 'read']);
+Route::put('shelves/{id}', [BookshelfApiController::class, 'update']);
+Route::delete('shelves/{id}', [BookshelfApiController::class, 'delete']);
diff --git a/routes/console.php b/routes/console.php
new file mode 100644 (file)
index 0000000..e05f4c9
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+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');
index a5f35fb8af4a60f8f9e9540c2abe8b13a60f1a5d..419a1e7f5b18634ded8c9592a9bff6e7dbfea610 100644 (file)
 <?php
 
-Route::get('/status', 'StatusController@show');
-Route::get('/robots.txt', 'HomeController@robots');
+use BookStack\Http\Controllers\Api;
+use BookStack\Http\Controllers\AttachmentController;
+use BookStack\Http\Controllers\AuditLogController;
+use BookStack\Http\Controllers\Auth;
+use BookStack\Http\Controllers\BookController;
+use BookStack\Http\Controllers\BookExportController;
+use BookStack\Http\Controllers\BookshelfController;
+use BookStack\Http\Controllers\BookSortController;
+use BookStack\Http\Controllers\ChapterController;
+use BookStack\Http\Controllers\ChapterExportController;
+use BookStack\Http\Controllers\CommentController;
+use BookStack\Http\Controllers\FavouriteController;
+use BookStack\Http\Controllers\HomeController;
+use BookStack\Http\Controllers\Images;
+use BookStack\Http\Controllers\MaintenanceController;
+use BookStack\Http\Controllers\PageController;
+use BookStack\Http\Controllers\PageExportController;
+use BookStack\Http\Controllers\PageRevisionController;
+use BookStack\Http\Controllers\PageTemplateController;
+use BookStack\Http\Controllers\RecycleBinController;
+use BookStack\Http\Controllers\RoleController;
+use BookStack\Http\Controllers\SearchController;
+use BookStack\Http\Controllers\SettingController;
+use BookStack\Http\Controllers\StatusController;
+use BookStack\Http\Controllers\TagController;
+use BookStack\Http\Controllers\UserApiTokenController;
+use BookStack\Http\Controllers\UserController;
+use BookStack\Http\Controllers\UserProfileController;
+use BookStack\Http\Controllers\UserSearchController;
+use Illuminate\Support\Facades\Route;
+
+Route::get('/status', [StatusController::class, 'show']);
+Route::get('/robots.txt', [HomeController::class, 'robots']);
 
 // Authenticated routes...
-Route::group(['middleware' => 'auth'], function () {
+Route::middleware('auth')->group(function () {
 
     // Secure images routing
-    Route::get('/uploads/images/{path}', 'Images\ImageController@showImage')
+    Route::get('/uploads/images/{path}', [Images\ImageController::class, 'showImage'])
         ->where('path', '.*$');
 
     // API docs routes
-    Route::get('/api/docs', 'Api\ApiDocsController@display');
+    Route::get('/api/docs', [Api\ApiDocsController::class, 'display']);
 
-    Route::get('/pages/recently-updated', 'PageController@showRecentlyUpdated');
+    Route::get('/pages/recently-updated', [PageController::class, 'showRecentlyUpdated']);
 
     // Shelves
-    Route::get('/create-shelf', 'BookshelfController@create');
-    Route::group(['prefix' => 'shelves'], function () {
-        Route::get('/', 'BookshelfController@index');
-        Route::post('/', 'BookshelfController@store');
-        Route::get('/{slug}/edit', 'BookshelfController@edit');
-        Route::get('/{slug}/delete', 'BookshelfController@showDelete');
-        Route::get('/{slug}', 'BookshelfController@show');
-        Route::put('/{slug}', 'BookshelfController@update');
-        Route::delete('/{slug}', 'BookshelfController@destroy');
-        Route::get('/{slug}/permissions', 'BookshelfController@showPermissions');
-        Route::put('/{slug}/permissions', 'BookshelfController@permissions');
-        Route::post('/{slug}/copy-permissions', 'BookshelfController@copyPermissions');
-
-        Route::get('/{shelfSlug}/create-book', 'BookController@create');
-        Route::post('/{shelfSlug}/create-book', 'BookController@store');
+    Route::get('/create-shelf', [BookshelfController::class, 'create']);
+    Route::prefix('shelves')->group(function () {
+        Route::get('/', [BookshelfController::class, 'index']);
+        Route::post('/', [BookshelfController::class, 'store']);
+        Route::get('/{slug}/edit', [BookshelfController::class, 'edit']);
+        Route::get('/{slug}/delete', [BookshelfController::class, 'showDelete']);
+        Route::get('/{slug}', [BookshelfController::class, 'show']);
+        Route::put('/{slug}', [BookshelfController::class, 'update']);
+        Route::delete('/{slug}', [BookshelfController::class, 'destroy']);
+        Route::get('/{slug}/permissions', [BookshelfController::class, 'showPermissions']);
+        Route::put('/{slug}/permissions', [BookshelfController::class, 'permissions']);
+        Route::post('/{slug}/copy-permissions', [BookshelfController::class, 'copyPermissions']);
+
+        Route::get('/{shelfSlug}/create-book', [BookController::class, 'create']);
+        Route::post('/{shelfSlug}/create-book', [BookController::class, 'store']);
     });
 
-    Route::get('/create-book', 'BookController@create');
-    Route::group(['prefix' => 'books'], function () {
+    Route::get('/create-book', [BookController::class, 'create']);
+    Route::prefix('books')->group(function () {
 
         // Books
-        Route::get('/', 'BookController@index');
-        Route::post('/', 'BookController@store');
-        Route::get('/{slug}/edit', 'BookController@edit');
-        Route::put('/{slug}', 'BookController@update');
-        Route::delete('/{id}', 'BookController@destroy');
-        Route::get('/{slug}/sort-item', 'BookSortController@showItem');
-        Route::get('/{slug}', 'BookController@show');
-        Route::get('/{bookSlug}/permissions', 'BookController@showPermissions');
-        Route::put('/{bookSlug}/permissions', 'BookController@permissions');
-        Route::get('/{slug}/delete', 'BookController@showDelete');
-        Route::get('/{bookSlug}/sort', 'BookSortController@show');
-        Route::put('/{bookSlug}/sort', 'BookSortController@update');
-        Route::get('/{bookSlug}/export/html', 'BookExportController@html');
-        Route::get('/{bookSlug}/export/pdf', 'BookExportController@pdf');
-        Route::get('/{bookSlug}/export/markdown', 'BookExportController@markdown');
-        Route::get('/{bookSlug}/export/zip', 'BookExportController@zip');
-        Route::get('/{bookSlug}/export/plaintext', 'BookExportController@plainText');
+        Route::get('/', [BookController::class, 'index']);
+        Route::post('/', [BookController::class, 'store']);
+        Route::get('/{slug}/edit', [BookController::class, 'edit']);
+        Route::put('/{slug}', [BookController::class, 'update']);
+        Route::delete('/{id}', [BookController::class, 'destroy']);
+        Route::get('/{slug}/sort-item', [BookSortController::class, 'showItem']);
+        Route::get('/{slug}', [BookController::class, 'show']);
+        Route::get('/{bookSlug}/permissions', [BookController::class, 'showPermissions']);
+        Route::put('/{bookSlug}/permissions', [BookController::class, 'permissions']);
+        Route::get('/{slug}/delete', [BookController::class, 'showDelete']);
+        Route::get('/{bookSlug}/sort', [BookSortController::class, 'show']);
+        Route::put('/{bookSlug}/sort', [BookSortController::class, 'update']);
+        Route::get('/{bookSlug}/export/html', [BookExportController::class, 'html']);
+        Route::get('/{bookSlug}/export/pdf', [BookExportController::class, 'pdf']);
+        Route::get('/{bookSlug}/export/markdown', [BookExportController::class, 'markdown']);
+        Route::get('/{bookSlug}/export/zip', [BookExportController::class, 'zip']);
+        Route::get('/{bookSlug}/export/plaintext', [BookExportController::class, 'plainText']);
 
         // Pages
-        Route::get('/{bookSlug}/create-page', 'PageController@create');
-        Route::post('/{bookSlug}/create-guest-page', 'PageController@createAsGuest');
-        Route::get('/{bookSlug}/draft/{pageId}', 'PageController@editDraft');
-        Route::post('/{bookSlug}/draft/{pageId}', 'PageController@store');
-        Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
-        Route::get('/{bookSlug}/page/{pageSlug}/export/pdf', 'PageExportController@pdf');
-        Route::get('/{bookSlug}/page/{pageSlug}/export/html', 'PageExportController@html');
-        Route::get('/{bookSlug}/page/{pageSlug}/export/markdown', 'PageExportController@markdown');
-        Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', 'PageExportController@plainText');
-        Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
-        Route::get('/{bookSlug}/page/{pageSlug}/move', 'PageController@showMove');
-        Route::put('/{bookSlug}/page/{pageSlug}/move', 'PageController@move');
-        Route::get('/{bookSlug}/page/{pageSlug}/copy', 'PageController@showCopy');
-        Route::post('/{bookSlug}/page/{pageSlug}/copy', 'PageController@copy');
-        Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
-        Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
-        Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showPermissions');
-        Route::put('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@permissions');
-        Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
-        Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
-        Route::delete('/{bookSlug}/draft/{pageId}', 'PageController@destroyDraft');
+        Route::get('/{bookSlug}/create-page', [PageController::class, 'create']);
+        Route::post('/{bookSlug}/create-guest-page', [PageController::class, 'createAsGuest']);
+        Route::get('/{bookSlug}/draft/{pageId}', [PageController::class, 'editDraft']);
+        Route::post('/{bookSlug}/draft/{pageId}', [PageController::class, 'store']);
+        Route::get('/{bookSlug}/page/{pageSlug}', [PageController::class, 'show']);
+        Route::get('/{bookSlug}/page/{pageSlug}/export/pdf', [PageExportController::class, 'pdf']);
+        Route::get('/{bookSlug}/page/{pageSlug}/export/html', [PageExportController::class, 'html']);
+        Route::get('/{bookSlug}/page/{pageSlug}/export/markdown', [PageExportController::class, 'markdown']);
+        Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', [PageExportController::class, 'plainText']);
+        Route::get('/{bookSlug}/page/{pageSlug}/edit', [PageController::class, 'edit']);
+        Route::get('/{bookSlug}/page/{pageSlug}/move', [PageController::class, 'showMove']);
+        Route::put('/{bookSlug}/page/{pageSlug}/move', [PageController::class, 'move']);
+        Route::get('/{bookSlug}/page/{pageSlug}/copy', [PageController::class, 'showCopy']);
+        Route::post('/{bookSlug}/page/{pageSlug}/copy', [PageController::class, 'copy']);
+        Route::get('/{bookSlug}/page/{pageSlug}/delete', [PageController::class, 'showDelete']);
+        Route::get('/{bookSlug}/draft/{pageId}/delete', [PageController::class, 'showDeleteDraft']);
+        Route::get('/{bookSlug}/page/{pageSlug}/permissions', [PageController::class, 'showPermissions']);
+        Route::put('/{bookSlug}/page/{pageSlug}/permissions', [PageController::class, 'permissions']);
+        Route::put('/{bookSlug}/page/{pageSlug}', [PageController::class, 'update']);
+        Route::delete('/{bookSlug}/page/{pageSlug}', [PageController::class, 'destroy']);
+        Route::delete('/{bookSlug}/draft/{pageId}', [PageController::class, 'destroyDraft']);
 
         // Revisions
-        Route::get('/{bookSlug}/page/{pageSlug}/revisions', 'PageRevisionController@index');
-        Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}', 'PageRevisionController@show');
-        Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}/changes', 'PageRevisionController@changes');
-        Route::put('/{bookSlug}/page/{pageSlug}/revisions/{revId}/restore', 'PageRevisionController@restore');
-        Route::delete('/{bookSlug}/page/{pageSlug}/revisions/{revId}/delete', 'PageRevisionController@destroy');
+        Route::get('/{bookSlug}/page/{pageSlug}/revisions', [PageRevisionController::class, 'index']);
+        Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}', [PageRevisionController::class, 'show']);
+        Route::get('/{bookSlug}/page/{pageSlug}/revisions/{revId}/changes', [PageRevisionController::class, 'changes']);
+        Route::put('/{bookSlug}/page/{pageSlug}/revisions/{revId}/restore', [PageRevisionController::class, 'restore']);
+        Route::delete('/{bookSlug}/page/{pageSlug}/revisions/{revId}/delete', [PageRevisionController::class, 'destroy']);
 
         // Chapters
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', 'PageController@create');
-        Route::post('/{bookSlug}/chapter/{chapterSlug}/create-guest-page', 'PageController@createAsGuest');
-        Route::get('/{bookSlug}/create-chapter', 'ChapterController@create');
-        Route::post('/{bookSlug}/create-chapter', 'ChapterController@store');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
-        Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@showMove');
-        Route::put('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@move');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@showPermissions');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', 'ChapterExportController@pdf');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', 'ChapterExportController@html');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/markdown', 'ChapterExportController@markdown');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', 'ChapterExportController@plainText');
-        Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@permissions');
-        Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
-        Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', [PageController::class, 'create']);
+        Route::post('/{bookSlug}/chapter/{chapterSlug}/create-guest-page', [PageController::class, 'createAsGuest']);
+        Route::get('/{bookSlug}/create-chapter', [ChapterController::class, 'create']);
+        Route::post('/{bookSlug}/create-chapter', [ChapterController::class, 'store']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'show']);
+        Route::put('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'update']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/move', [ChapterController::class, 'showMove']);
+        Route::put('/{bookSlug}/chapter/{chapterSlug}/move', [ChapterController::class, 'move']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', [ChapterController::class, 'edit']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', [ChapterController::class, 'showPermissions']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', [ChapterExportController::class, 'pdf']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', [ChapterExportController::class, 'html']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/markdown', [ChapterExportController::class, 'markdown']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', [ChapterExportController::class, 'plainText']);
+        Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', [ChapterController::class, 'permissions']);
+        Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', [ChapterController::class, 'showDelete']);
+        Route::delete('/{bookSlug}/chapter/{chapterSlug}', [ChapterController::class, 'destroy']);
     });
 
     // User Profile routes
-    Route::get('/user/{slug}', 'UserProfileController@show');
+    Route::get('/user/{slug}', [UserProfileController::class, 'show']);
 
     // Image routes
-    Route::get('/images/gallery', 'Images\GalleryImageController@list');
-    Route::post('/images/gallery', 'Images\GalleryImageController@create');
-    Route::get('/images/drawio', 'Images\DrawioImageController@list');
-    Route::get('/images/drawio/base64/{id}', 'Images\DrawioImageController@getAsBase64');
-    Route::post('/images/drawio', 'Images\DrawioImageController@create');
-    Route::get('/images/edit/{id}', 'Images\ImageController@edit');
-    Route::put('/images/{id}', 'Images\ImageController@update');
-    Route::delete('/images/{id}', 'Images\ImageController@destroy');
+    Route::get('/images/gallery', [Images\GalleryImageController::class, 'list']);
+    Route::post('/images/gallery', [Images\GalleryImageController::class, 'create']);
+    Route::get('/images/drawio', [Images\DrawioImageController::class, 'list']);
+    Route::get('/images/drawio/base64/{id}', [Images\DrawioImageController::class, 'getAsBase64']);
+    Route::post('/images/drawio', [Images\DrawioImageController::class, 'create']);
+    Route::get('/images/edit/{id}', [Images\ImageController::class, 'edit']);
+    Route::put('/images/{id}', [Images\ImageController::class, 'update']);
+    Route::delete('/images/{id}', [Images\ImageController::class, 'destroy']);
 
     // Attachments routes
-    Route::get('/attachments/{id}', 'AttachmentController@get');
-    Route::post('/attachments/upload', 'AttachmentController@upload');
-    Route::post('/attachments/upload/{id}', 'AttachmentController@uploadUpdate');
-    Route::post('/attachments/link', 'AttachmentController@attachLink');
-    Route::put('/attachments/{id}', 'AttachmentController@update');
-    Route::get('/attachments/edit/{id}', 'AttachmentController@getUpdateForm');
-    Route::get('/attachments/get/page/{pageId}', 'AttachmentController@listForPage');
-    Route::put('/attachments/sort/page/{pageId}', 'AttachmentController@sortForPage');
-    Route::delete('/attachments/{id}', 'AttachmentController@delete');
+    Route::get('/attachments/{id}', [AttachmentController::class, 'get']);
+    Route::post('/attachments/upload', [AttachmentController::class, 'upload']);
+    Route::post('/attachments/upload/{id}', [AttachmentController::class, 'uploadUpdate']);
+    Route::post('/attachments/link', [AttachmentController::class, 'attachLink']);
+    Route::put('/attachments/{id}', [AttachmentController::class, 'update']);
+    Route::get('/attachments/edit/{id}', [AttachmentController::class, 'getUpdateForm']);
+    Route::get('/attachments/get/page/{pageId}', [AttachmentController::class, 'listForPage']);
+    Route::put('/attachments/sort/page/{pageId}', [AttachmentController::class, 'sortForPage']);
+    Route::delete('/attachments/{id}', [AttachmentController::class, 'delete']);
 
     // AJAX routes
-    Route::put('/ajax/page/{id}/save-draft', 'PageController@saveDraft');
-    Route::get('/ajax/page/{id}', 'PageController@getPageAjax');
-    Route::delete('/ajax/page/{id}', 'PageController@ajaxDestroy');
+    Route::put('/ajax/page/{id}/save-draft', [PageController::class, 'saveDraft']);
+    Route::get('/ajax/page/{id}', [PageController::class, 'getPageAjax']);
+    Route::delete('/ajax/page/{id}', [PageController::class, 'ajaxDestroy']);
 
     // Tag routes (AJAX)
-    Route::group(['prefix' => 'ajax/tags'], function () {
-        Route::get('/suggest/names', 'TagController@getNameSuggestions');
-        Route::get('/suggest/values', 'TagController@getValueSuggestions');
+    Route::prefix('ajax/tags')->group(function () {
+        Route::get('/suggest/names', [TagController::class, 'getNameSuggestions']);
+        Route::get('/suggest/values', [TagController::class, 'getValueSuggestions']);
     });
 
-    Route::get('/ajax/search/entities', 'SearchController@searchEntitiesAjax');
+    Route::get('/ajax/search/entities', [SearchController::class, 'searchEntitiesAjax']);
 
     // Comments
-    Route::post('/comment/{pageId}', 'CommentController@savePageComment');
-    Route::put('/comment/{id}', 'CommentController@update');
-    Route::delete('/comment/{id}', 'CommentController@destroy');
+    Route::post('/comment/{pageId}', [CommentController::class, 'savePageComment']);
+    Route::put('/comment/{id}', [CommentController::class, 'update']);
+    Route::delete('/comment/{id}', [CommentController::class, 'destroy']);
 
     // Links
-    Route::get('/link/{id}', 'PageController@redirectFromLink');
+    Route::get('/link/{id}', [PageController::class, 'redirectFromLink']);
 
     // Search
-    Route::get('/search', 'SearchController@search');
-    Route::get('/search/book/{bookId}', 'SearchController@searchBook');
-    Route::get('/search/chapter/{bookId}', 'SearchController@searchChapter');
-    Route::get('/search/entity/siblings', 'SearchController@searchSiblings');
+    Route::get('/search', [SearchController::class, 'search']);
+    Route::get('/search/book/{bookId}', [SearchController::class, 'searchBook']);
+    Route::get('/search/chapter/{bookId}', [SearchController::class, 'searchChapter']);
+    Route::get('/search/entity/siblings', [SearchController::class, 'searchSiblings']);
 
     // User Search
-    Route::get('/search/users/select', 'UserSearchController@forSelect');
+    Route::get('/search/users/select', [UserSearchController::class, 'forSelect']);
 
     // Template System
-    Route::get('/templates', 'PageTemplateController@list');
-    Route::get('/templates/{templateId}', 'PageTemplateController@get');
+    Route::get('/templates', [PageTemplateController::class, 'list']);
+    Route::get('/templates/{templateId}', [PageTemplateController::class, 'get']);
 
     // Favourites
-    Route::get('/favourites', 'FavouriteController@index');
-    Route::post('/favourites/add', 'FavouriteController@add');
-    Route::post('/favourites/remove', 'FavouriteController@remove');
+    Route::get('/favourites', [FavouriteController::class, 'index']);
+    Route::post('/favourites/add', [FavouriteController::class, 'add']);
+    Route::post('/favourites/remove', [FavouriteController::class, 'remove']);
 
     // Other Pages
-    Route::get('/', 'HomeController@index');
-    Route::get('/home', 'HomeController@index');
-    Route::get('/custom-head-content', 'HomeController@customHeadContent');
+    Route::get('/', [HomeController::class, 'index']);
+    Route::get('/home', [HomeController::class, 'index']);
+    Route::get('/custom-head-content', [HomeController::class, 'customHeadContent']);
 
     // Settings
-    Route::group(['prefix' => 'settings'], function () {
-        Route::get('/', 'SettingController@index')->name('settings');
-        Route::post('/', 'SettingController@update');
+    Route::prefix('settings')->group(function () {
+        Route::get('/', [SettingController::class, 'index'])->name('settings');
+        Route::post('/', [SettingController::class, 'update']);
 
         // Maintenance
-        Route::get('/maintenance', 'MaintenanceController@index');
-        Route::delete('/maintenance/cleanup-images', 'MaintenanceController@cleanupImages');
-        Route::post('/maintenance/send-test-email', 'MaintenanceController@sendTestEmail');
+        Route::get('/maintenance', [MaintenanceController::class, 'index']);
+        Route::delete('/maintenance/cleanup-images', [MaintenanceController::class, 'cleanupImages']);
+        Route::post('/maintenance/send-test-email', [MaintenanceController::class, 'sendTestEmail']);
 
         // Recycle Bin
-        Route::get('/recycle-bin', 'RecycleBinController@index');
-        Route::post('/recycle-bin/empty', 'RecycleBinController@empty');
-        Route::get('/recycle-bin/{id}/destroy', 'RecycleBinController@showDestroy');
-        Route::delete('/recycle-bin/{id}', 'RecycleBinController@destroy');
-        Route::get('/recycle-bin/{id}/restore', 'RecycleBinController@showRestore');
-        Route::post('/recycle-bin/{id}/restore', 'RecycleBinController@restore');
+        Route::get('/recycle-bin', [RecycleBinController::class, 'index']);
+        Route::post('/recycle-bin/empty', [RecycleBinController::class, 'empty']);
+        Route::get('/recycle-bin/{id}/destroy', [RecycleBinController::class, 'showDestroy']);
+        Route::delete('/recycle-bin/{id}', [RecycleBinController::class, 'destroy']);
+        Route::get('/recycle-bin/{id}/restore', [RecycleBinController::class, 'showRestore']);
+        Route::post('/recycle-bin/{id}/restore', [RecycleBinController::class, 'restore']);
 
         // Audit Log
-        Route::get('/audit', 'AuditLogController@index');
+        Route::get('/audit', [AuditLogController::class, 'index']);
 
         // Users
-        Route::get('/users', 'UserController@index');
-        Route::get('/users/create', 'UserController@create');
-        Route::get('/users/{id}/delete', 'UserController@delete');
-        Route::patch('/users/{id}/switch-books-view', 'UserController@switchBooksView');
-        Route::patch('/users/{id}/switch-shelves-view', 'UserController@switchShelvesView');
-        Route::patch('/users/{id}/switch-shelf-view', 'UserController@switchShelfView');
-        Route::patch('/users/{id}/change-sort/{type}', 'UserController@changeSort');
-        Route::patch('/users/{id}/update-expansion-preference/{key}', 'UserController@updateExpansionPreference');
-        Route::patch('/users/toggle-dark-mode', 'UserController@toggleDarkMode');
-        Route::post('/users/create', 'UserController@store');
-        Route::get('/users/{id}', 'UserController@edit');
-        Route::put('/users/{id}', 'UserController@update');
-        Route::delete('/users/{id}', 'UserController@destroy');
+        Route::get('/users', [UserController::class, 'index']);
+        Route::get('/users/create', [UserController::class, 'create']);
+        Route::get('/users/{id}/delete', [UserController::class, 'delete']);
+        Route::patch('/users/{id}/switch-books-view', [UserController::class, 'switchBooksView']);
+        Route::patch('/users/{id}/switch-shelves-view', [UserController::class, 'switchShelvesView']);
+        Route::patch('/users/{id}/switch-shelf-view', [UserController::class, 'switchShelfView']);
+        Route::patch('/users/{id}/change-sort/{type}', [UserController::class, 'changeSort']);
+        Route::patch('/users/{id}/update-expansion-preference/{key}', [UserController::class, 'updateExpansionPreference']);
+        Route::patch('/users/toggle-dark-mode', [UserController::class, 'toggleDarkMode']);
+        Route::post('/users/create', [UserController::class, 'store']);
+        Route::get('/users/{id}', [UserController::class, 'edit']);
+        Route::put('/users/{id}', [UserController::class, 'update']);
+        Route::delete('/users/{id}', [UserController::class, 'destroy']);
 
         // User API Tokens
-        Route::get('/users/{userId}/create-api-token', 'UserApiTokenController@create');
-        Route::post('/users/{userId}/create-api-token', 'UserApiTokenController@store');
-        Route::get('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@edit');
-        Route::put('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@update');
-        Route::get('/users/{userId}/api-tokens/{tokenId}/delete', 'UserApiTokenController@delete');
-        Route::delete('/users/{userId}/api-tokens/{tokenId}', 'UserApiTokenController@destroy');
+        Route::get('/users/{userId}/create-api-token', [UserApiTokenController::class, 'create']);
+        Route::post('/users/{userId}/create-api-token', [UserApiTokenController::class, 'store']);
+        Route::get('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'edit']);
+        Route::put('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'update']);
+        Route::get('/users/{userId}/api-tokens/{tokenId}/delete', [UserApiTokenController::class, 'delete']);
+        Route::delete('/users/{userId}/api-tokens/{tokenId}', [UserApiTokenController::class, 'destroy']);
 
         // Roles
-        Route::get('/roles', 'RoleController@list');
-        Route::get('/roles/new', 'RoleController@create');
-        Route::post('/roles/new', 'RoleController@store');
-        Route::get('/roles/delete/{id}', 'RoleController@showDelete');
-        Route::delete('/roles/delete/{id}', 'RoleController@delete');
-        Route::get('/roles/{id}', 'RoleController@edit');
-        Route::put('/roles/{id}', 'RoleController@update');
+        Route::get('/roles', [RoleController::class, 'list']);
+        Route::get('/roles/new', [RoleController::class, 'create']);
+        Route::post('/roles/new', [RoleController::class, 'store']);
+        Route::get('/roles/delete/{id}', [RoleController::class, 'showDelete']);
+        Route::delete('/roles/delete/{id}', [RoleController::class, 'delete']);
+        Route::get('/roles/{id}', [RoleController::class, 'edit']);
+        Route::put('/roles/{id}', [RoleController::class, 'update']);
     });
 });
 
 // MFA routes
-Route::group(['middleware' => 'mfa-setup'], function () {
-    Route::get('/mfa/setup', 'Auth\MfaController@setup');
-    Route::get('/mfa/totp/generate', 'Auth\MfaTotpController@generate');
-    Route::post('/mfa/totp/confirm', 'Auth\MfaTotpController@confirm');
-    Route::get('/mfa/backup_codes/generate', 'Auth\MfaBackupCodesController@generate');
-    Route::post('/mfa/backup_codes/confirm', 'Auth\MfaBackupCodesController@confirm');
+Route::middleware('mfa-setup')->group(function () {
+    Route::get('/mfa/setup', [Auth\MfaController::class, 'setup']);
+    Route::get('/mfa/totp/generate', [Auth\MfaTotpController::class, 'generate']);
+    Route::post('/mfa/totp/confirm', [Auth\MfaTotpController::class, 'confirm']);
+    Route::get('/mfa/backup_codes/generate', [Auth\MfaBackupCodesController::class, 'generate']);
+    Route::post('/mfa/backup_codes/confirm', [Auth\MfaBackupCodesController::class, 'confirm']);
 });
-Route::group(['middleware' => 'guest'], function () {
-    Route::get('/mfa/verify', 'Auth\MfaController@verify');
-    Route::post('/mfa/totp/verify', 'Auth\MfaTotpController@verify');
-    Route::post('/mfa/backup_codes/verify', 'Auth\MfaBackupCodesController@verify');
+Route::middleware('guest')->group(function () {
+    Route::get('/mfa/verify', [Auth\MfaController::class, 'verify']);
+    Route::post('/mfa/totp/verify', [Auth\MfaTotpController::class, 'verify']);
+    Route::post('/mfa/backup_codes/verify', [Auth\MfaBackupCodesController::class, 'verify']);
 });
-Route::delete('/mfa/{method}/remove', 'Auth\MfaController@remove')->middleware('auth');
+Route::delete('/mfa/{method}/remove', [Auth\MfaController::class, 'remove'])->middleware('auth');
 
 // Social auth routes
-Route::get('/login/service/{socialDriver}', 'Auth\SocialController@login');
-Route::get('/login/service/{socialDriver}/callback', 'Auth\SocialController@callback');
-Route::post('/login/service/{socialDriver}/detach', 'Auth\SocialController@detach')->middleware('auth');
-Route::get('/register/service/{socialDriver}', 'Auth\SocialController@register');
+Route::get('/login/service/{socialDriver}', [Auth\SocialController::class, 'login']);
+Route::get('/login/service/{socialDriver}/callback', [Auth\SocialController::class, 'callback']);
+Route::post('/login/service/{socialDriver}/detach', [Auth\SocialController::class, 'detach'])->middleware('auth');
+Route::get('/register/service/{socialDriver}', [Auth\SocialController::class, 'register']);
 
 // Login/Logout routes
-Route::get('/login', 'Auth\LoginController@getLogin');
-Route::post('/login', 'Auth\LoginController@login');
-Route::get('/logout', 'Auth\LoginController@logout');
-Route::get('/register', 'Auth\RegisterController@getRegister');
-Route::get('/register/confirm', 'Auth\ConfirmEmailController@show');
-Route::get('/register/confirm/awaiting', 'Auth\ConfirmEmailController@showAwaiting');
-Route::post('/register/confirm/resend', 'Auth\ConfirmEmailController@resend');
-Route::get('/register/confirm/{token}', 'Auth\ConfirmEmailController@confirm');
-Route::post('/register', 'Auth\RegisterController@postRegister');
+Route::get('/login', [Auth\LoginController::class, 'getLogin']);
+Route::post('/login', [Auth\LoginController::class, 'login']);
+Route::get('/logout', [Auth\LoginController::class, 'logout']);
+Route::get('/register', [Auth\RegisterController::class, 'getRegister']);
+Route::get('/register/confirm', [Auth\ConfirmEmailController::class, 'show']);
+Route::get('/register/confirm/awaiting', [Auth\ConfirmEmailController::class, 'showAwaiting']);
+Route::post('/register/confirm/resend', [Auth\ConfirmEmailController::class, 'resend']);
+Route::get('/register/confirm/{token}', [Auth\ConfirmEmailController::class, 'confirm']);
+Route::post('/register', [Auth\RegisterController::class, 'postRegister']);
 
 // SAML routes
-Route::post('/saml2/login', 'Auth\Saml2Controller@login');
-Route::get('/saml2/logout', 'Auth\Saml2Controller@logout');
-Route::get('/saml2/metadata', 'Auth\Saml2Controller@metadata');
-Route::get('/saml2/sls', 'Auth\Saml2Controller@sls');
-Route::post('/saml2/acs', 'Auth\Saml2Controller@startAcs');
-Route::get('/saml2/acs', 'Auth\Saml2Controller@processAcs');
+Route::post('/saml2/login', [Auth\Saml2Controller::class, 'login']);
+Route::get('/saml2/logout', [Auth\Saml2Controller::class, 'logout']);
+Route::get('/saml2/metadata', [Auth\Saml2Controller::class, 'metadata']);
+Route::get('/saml2/sls', [Auth\Saml2Controller::class, 'sls']);
+Route::post('/saml2/acs', [Auth\Saml2Controller::class, 'startAcs']);
+Route::get('/saml2/acs', [Auth\Saml2Controller::class, 'processAcs']);
 
 // OIDC routes
-Route::post('/oidc/login', 'Auth\OidcController@login');
-Route::get('/oidc/callback', 'Auth\OidcController@callback');
+Route::post('/oidc/login', [Auth\OidcController::class, 'login']);
+Route::get('/oidc/callback', [Auth\OidcController::class, 'callback']);
 
 // User invitation routes
-Route::get('/register/invite/{token}', 'Auth\UserInviteController@showSetPassword');
-Route::post('/register/invite/{token}', 'Auth\UserInviteController@setPassword');
+Route::get('/register/invite/{token}', [Auth\UserInviteController::class, 'showSetPassword']);
+Route::post('/register/invite/{token}', [Auth\UserInviteController::class, 'setPassword']);
 
 // Password reset link request routes...
-Route::get('/password/email', 'Auth\ForgotPasswordController@showLinkRequestForm');
-Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
+Route::get('/password/email', [Auth\ForgotPasswordController::class, 'showLinkRequestForm']);
+Route::post('/password/email', [Auth\ForgotPasswordController::class, 'sendResetLinkEmail']);
 
 // Password reset routes...
-Route::get('/password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
-Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
+Route::get('/password/reset/{token}', [Auth\ResetPasswordController::class, 'showResetForm']);
+Route::post('/password/reset', [Auth\ResetPasswordController::class, 'reset']);
 
-Route::fallback('HomeController@notFound')->name('fallback');
+Route::fallback([HomeController::class, 'notFound'])->name('fallback');
index 953edb7a993a821605b5c040962369e7f46c9e3a..05c4471f2b53fc17d3cac9d3d252755a35479f7c 100755 (executable)
@@ -1,7 +1,9 @@
-config.php
-routes.php
 compiled.php
-services.json
+config.php
+down
 events.scanned.php
+maintenance.php
+routes.php
 routes.scanned.php
-down
+schedule-*
+services.json
index 8d13670ca95e85a084a1269d178a9dd088a259bc..f909cd79a2959e8b5d943a1add0e980164200ad5 100644 (file)
@@ -17,7 +17,7 @@ class AuditLogTest extends TestCase
     /** @var ActivityService */
     protected $activityService;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->activityService = app(ActivityService::class);
index 79f00bed093cbd28c0c550820e41e76a0b799133..66ab09d3c62dc02ebaec724c57c532f246b89a61 100644 (file)
@@ -44,7 +44,7 @@ class AuthTest extends TestCase
     {
         // Set settings and get user instance
         $this->setSettings(['registration-enabled' => 'true']);
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         // Test form and ensure user is created
         $this->get('/register')
@@ -102,7 +102,7 @@ class AuthTest extends TestCase
 
         // Set settings and get user instance
         $this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true']);
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         // Go through registration process
         $resp = $this->post('/register', $user->only('name', 'email', 'password'));
@@ -140,7 +140,7 @@ class AuthTest extends TestCase
     public function test_restricted_registration()
     {
         $this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'true', 'registration-restrict' => 'example.com']);
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         // Go through registration process
         $this->post('/register', $user->only('name', 'email', 'password'))
@@ -166,7 +166,7 @@ class AuthTest extends TestCase
     public function test_restricted_registration_with_confirmation_disabled()
     {
         $this->setSettings(['registration-enabled' => 'true', 'registration-confirmation' => 'false', 'registration-restrict' => 'example.com']);
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         // Go through registration process
         $this->post('/register', $user->only('name', 'email', 'password'))
index 9e0729a8e9fc4d278f83b2db67daafc449dd83a6..d00e8cf15df4f1de9565967bde4016d6d3b3273f 100644 (file)
@@ -20,7 +20,7 @@ class LdapTest extends TestCase
     protected $mockUser;
     protected $resourceId = 'resource-test';
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         if (!defined('LDAP_OPT_REFERRALS')) {
@@ -42,7 +42,7 @@ class LdapTest extends TestCase
         ]);
         $this->mockLdap = \Mockery::mock(Ldap::class);
         $this->app[Ldap::class] = $this->mockLdap;
-        $this->mockUser = factory(User::class)->make();
+        $this->mockUser = User::factory()->make();
     }
 
     protected function runFailedAuthLogin()
@@ -264,9 +264,9 @@ class LdapTest extends TestCase
 
     public function test_login_maps_roles_and_retains_existing_roles()
     {
-        $roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
-        $roleToReceive2 = factory(Role::class)->create(['display_name' => 'LdapTester Second']);
-        $existingRole = factory(Role::class)->create(['display_name' => 'ldaptester-existing']);
+        $roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
+        $roleToReceive2 = Role::factory()->create(['display_name' => 'LdapTester Second']);
+        $existingRole = Role::factory()->create(['display_name' => 'ldaptester-existing']);
         $this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
         $this->mockUser->attachRole($existingRole);
 
@@ -310,8 +310,8 @@ class LdapTest extends TestCase
 
     public function test_login_maps_roles_and_removes_old_roles_if_set()
     {
-        $roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
-        $existingRole = factory(Role::class)->create(['display_name' => 'ldaptester-existing']);
+        $roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
+        $existingRole = Role::factory()->create(['display_name' => 'ldaptester-existing']);
         $this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
         $this->mockUser->attachRole($existingRole);
 
@@ -350,15 +350,15 @@ class LdapTest extends TestCase
 
     public function test_external_auth_id_visible_in_roles_page_when_ldap_active()
     {
-        $role = factory(Role::class)->create(['display_name' => 'ldaptester', 'external_auth_id' => 'ex-auth-a, test-second-param']);
+        $role = Role::factory()->create(['display_name' => 'ldaptester', 'external_auth_id' => 'ex-auth-a, test-second-param']);
         $this->asAdmin()->get('/settings/roles/' . $role->id)
             ->assertSee('ex-auth-a');
     }
 
     public function test_login_maps_roles_using_external_auth_ids_if_set()
     {
-        $roleToReceive = factory(Role::class)->create(['display_name' => 'ldaptester', 'external_auth_id' => 'test-second-param, ex-auth-a']);
-        $roleToNotReceive = factory(Role::class)->create(['display_name' => 'ex-auth-a', 'external_auth_id' => 'test-second-param']);
+        $roleToReceive = Role::factory()->create(['display_name' => 'ldaptester', 'external_auth_id' => 'test-second-param, ex-auth-a']);
+        $roleToNotReceive = Role::factory()->create(['display_name' => 'ex-auth-a', 'external_auth_id' => 'test-second-param']);
 
         app('config')->set([
             'services.ldap.user_to_groups'     => true,
@@ -395,8 +395,8 @@ class LdapTest extends TestCase
 
     public function test_login_group_mapping_does_not_conflict_with_default_role()
     {
-        $roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
-        $roleToReceive2 = factory(Role::class)->create(['display_name' => 'LdapTester Second']);
+        $roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
+        $roleToReceive2 = Role::factory()->create(['display_name' => 'LdapTester Second']);
         $this->mockUser->forceFill(['external_auth_id' => $this->mockUser->name])->save();
 
         setting()->put('registration-role', $roleToReceive->id);
@@ -641,8 +641,8 @@ class LdapTest extends TestCase
 
     public function test_login_with_email_confirmation_required_maps_groups_but_shows_confirmation_screen()
     {
-        $roleToReceive = factory(Role::class)->create(['display_name' => 'LdapTester']);
-        $user = factory(User::class)->make();
+        $roleToReceive = Role::factory()->create(['display_name' => 'LdapTester']);
+        $user = User::factory()->make();
         setting()->put('registration-confirmation', 'true');
 
         app('config')->set([
index 6c806aa8ed4e99901aa84bf1060baba20e8eda6a..e7665a679a44a892bbe743863aa01579c3e780c0 100644 (file)
@@ -16,7 +16,7 @@ class OidcTest extends TestCase
     protected $keyFilePath;
     protected $keyFile;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         // Set default config for OpenID Connect
@@ -41,7 +41,7 @@ class OidcTest extends TestCase
         ]);
     }
 
-    public function tearDown(): void
+    protected function tearDown(): void
     {
         parent::tearDown();
         if (file_exists($this->keyFilePath)) {
index c534b2d78633c32cfdc306e79ac8a01e871d91a6..aac2710a889a4aa891d7df8fc9312f1d32087885 100644 (file)
@@ -8,7 +8,7 @@ use Tests\TestCase;
 
 class Saml2Test extends TestCase
 {
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         // Set default config for SAML2
@@ -119,7 +119,7 @@ class Saml2Test extends TestCase
             'saml2.remove_from_groups' => false,
         ]);
 
-        $memberRole = factory(Role::class)->create(['external_auth_id' => 'member']);
+        $memberRole = Role::factory()->create(['external_auth_id' => 'member']);
         $adminRole = Role::getSystemRole('admin');
 
         $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
@@ -141,7 +141,7 @@ class Saml2Test extends TestCase
         $acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
         $user = User::query()->where('external_auth_id', '=', 'user')->first();
 
-        $randomRole = factory(Role::class)->create(['external_auth_id' => 'random']);
+        $randomRole = Role::factory()->create(['external_auth_id' => 'random']);
         $user->attachRole($randomRole);
         $this->assertContains($randomRole->id, $user->roles()->pluck('id'));
 
@@ -295,7 +295,7 @@ class Saml2Test extends TestCase
             'saml2.remove_from_groups' => false,
         ]);
 
-        $memberRole = factory(Role::class)->create(['external_auth_id' => 'member']);
+        $memberRole = Role::factory()->create(['external_auth_id' => 'member']);
         $adminRole = Role::getSystemRole('admin');
 
         $acsPost = $this->followingRedirects()->post('/saml2/acs', ['SAMLResponse' => $this->acsPostData]);
index f70263dd278ae1a8bf93efe26c896bda300d97e3..90d7e37aa5e85065588346e22e91fd319d5ccf80 100644 (file)
@@ -15,7 +15,7 @@ class SocialAuthTest extends TestCase
 {
     public function test_social_registration()
     {
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         $this->setSettings(['registration-enabled' => 'true']);
         config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
@@ -118,7 +118,7 @@ class SocialAuthTest extends TestCase
             'APP_URL'                   => 'http://localhost',
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $mockSocialite = $this->mock(Factory::class);
         $mockSocialDriver = Mockery::mock(Provider::class);
         $mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
@@ -156,7 +156,7 @@ class SocialAuthTest extends TestCase
             'APP_URL'                   => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true,
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $mockSocialite = $this->mock(Factory::class);
         $mockSocialDriver = Mockery::mock(Provider::class);
         $mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
@@ -188,7 +188,7 @@ class SocialAuthTest extends TestCase
 
     public function test_social_registration_with_no_name_uses_email_as_name()
     {
-        $user = factory(User::class)->make(['email' => '[email protected]']);
+        $user = User::factory()->make(['email' => '[email protected]']);
 
         $this->setSettings(['registration-enabled' => 'true']);
         config(['GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
index afd6a1a065614049a2ee5a83b3606bfa9f43053f..fcbc17ea94ba40ce4c0c89f811234cc829786bd3 100644 (file)
@@ -37,7 +37,7 @@ class BookShelfTest extends TestCase
 
     public function test_shelves_shows_in_header_if_have_any_shelve_view_permission()
     {
-        $user = factory(User::class)->create();
+        $user = User::factory()->create();
         $this->giveUserPermissions($user, ['image-create-all']);
         $shelf = Bookshelf::first();
         $userRole = $user->roles()->first();
index 53ee6faf98b76302a942a330ce8c7819a9fbc393..2894fbb98f86476947c967bc899cb7caa54dd01a 100644 (file)
@@ -9,7 +9,7 @@ class BookTest extends TestCase
 {
     public function test_create()
     {
-        $book = factory(Book::class)->make([
+        $book = Book::factory()->make([
             'name' => 'My First Book',
         ]);
 
@@ -29,7 +29,7 @@ class BookTest extends TestCase
 
     public function test_create_uses_different_slugs_when_name_reused()
     {
-        $book = factory(Book::class)->make([
+        $book = Book::factory()->make([
             'name' => 'My First Book',
         ]);
 
index ea29ece5d2c51db2633e13f2236e9e3e8af043c9..9868dc030581faa9553bca0c841db3a6f49ee286 100644 (file)
@@ -13,7 +13,7 @@ class ChapterTest extends TestCase
         /** @var Book $book */
         $book = Book::query()->first();
 
-        $chapter = factory(Chapter::class)->make([
+        $chapter = Chapter::factory()->make([
             'name' => 'My First Chapter',
         ]);
 
index d8caa73585aebcd54dd085b87428878a3cd71d80..23607f5a70f423b182946a06db0d2f3b4fee3778 100644 (file)
@@ -9,7 +9,7 @@ class CommentSettingTest extends TestCase
 {
     protected $page;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->page = Page::query()->first();
index b613f80a1d31a968e75feb8ebcfe2cfef7476824..1e8ecbcac2cad0a1bda62c38303e2575df3ae775 100644 (file)
@@ -13,7 +13,7 @@ class CommentTest extends TestCase
         $this->asAdmin();
         $page = Page::first();
 
-        $comment = factory(Comment::class)->make(['parent_id' => 2]);
+        $comment = Comment::factory()->make(['parent_id' => 2]);
         $resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
 
         $resp->assertStatus(200);
@@ -36,7 +36,7 @@ class CommentTest extends TestCase
         $this->asAdmin();
         $page = Page::first();
 
-        $comment = factory(Comment::class)->make();
+        $comment = Comment::factory()->make();
         $this->postJson("/comment/$page->id", $comment->getAttributes());
 
         $comment = $page->comments()->first();
@@ -60,7 +60,7 @@ class CommentTest extends TestCase
         $this->asAdmin();
         $page = Page::first();
 
-        $comment = factory(Comment::class)->make();
+        $comment = Comment::factory()->make();
         $this->postJson("/comment/$page->id", $comment->getAttributes());
 
         $comment = $page->comments()->first();
index 4fb7d7ab6e5226d01910ef57ac4cda633057a00d..9e2ceff51a1e5cf0a0175cced31a2ac1c29b096b 100644 (file)
@@ -20,7 +20,7 @@ class PageDraftTest extends TestCase
      */
     protected $pageRepo;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->page = Page::query()->first();
index 9b0a8f188106d7d46d15d91ba535165cf6395ac8..652bc1336e5c98bccc20e156014f96d03ff93117 100644 (file)
@@ -11,7 +11,7 @@ class PageEditorTest extends TestCase
     /** @var Page */
     protected $page;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->page = Page::query()->first();
index 313fc77f060f51e7ddb0c15bf9eba8070a18a1ed..32459a84a691e2c2191ede504d5c65683df1d62f 100644 (file)
@@ -14,7 +14,7 @@ class PageTest extends TestCase
     {
         /** @var Chapter $chapter */
         $chapter = Chapter::query()->first();
-        $page = factory(Page::class)->make([
+        $page = Page::factory()->make([
             'name' => 'My First Page',
         ]);
 
index 5cfc5c3c5b935f9f2396fc38b4bf0521bfed1b6f..89279bfcf9059b6daef98b853bce0412bdd8a817 100644 (file)
@@ -12,7 +12,7 @@ class SortTest extends TestCase
 {
     protected $book;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->book = Book::first();
index 74da37f4a867cbea8f6ced182a33f06ad4f12a0b..9b3fb1532a05e322bbdb046b3bcbc53a80299ce5 100644 (file)
@@ -19,7 +19,7 @@ class TagTest extends TestCase
         $entity = $class::first();
 
         if (is_null($tags)) {
-            $tags = factory(Tag::class, $this->defaultTagCount)->make();
+            $tags = Tag::factory()->count($this->defaultTagCount)->make();
         }
 
         $entity->tags()->saveMany($tags);
@@ -31,63 +31,63 @@ class TagTest extends TestCase
     {
         // Create some tags with similar names to test with
         $attrs = collect();
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'city']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'city']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'county']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'planet']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'plans']));
         $page = $this->getEntityWithTags(Page::class, $attrs->all());
 
-        $this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->assertExactJson([]);
-        $this->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country', 'county']);
-        $this->get('/ajax/tags/suggest/names?search=cou')->assertExactJson(['country', 'county']);
-        $this->get('/ajax/tags/suggest/names?search=pla')->assertExactJson(['planet', 'plans']);
+        $this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->assertSimilarJson([]);
+        $this->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country', 'county']);
+        $this->get('/ajax/tags/suggest/names?search=cou')->assertSimilarJson(['country', 'county']);
+        $this->get('/ajax/tags/suggest/names?search=pla')->assertSimilarJson(['planet', 'plans']);
     }
 
     public function test_tag_value_suggestions()
     {
         // Create some tags with similar values to test with
         $attrs = collect();
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country', 'value' => 'cats']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color', 'value' => 'cattery']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'city', 'value' => 'castle']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county', 'value' => 'dog']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet', 'value' => 'catapult']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans', 'value' => 'dodgy']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country', 'value' => 'cats']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color', 'value' => 'cattery']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'city', 'value' => 'castle']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'county', 'value' => 'dog']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'planet', 'value' => 'catapult']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'plans', 'value' => 'dodgy']));
         $page = $this->getEntityWithTags(Page::class, $attrs->all());
 
-        $this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->assertExactJson([]);
-        $this->get('/ajax/tags/suggest/values?search=cat')->assertExactJson(['cats', 'cattery', 'catapult']);
-        $this->get('/ajax/tags/suggest/values?search=do')->assertExactJson(['dog', 'dodgy']);
-        $this->get('/ajax/tags/suggest/values?search=cas')->assertExactJson(['castle']);
+        $this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->assertSimilarJson([]);
+        $this->get('/ajax/tags/suggest/values?search=cat')->assertSimilarJson(['cats', 'cattery', 'catapult']);
+        $this->get('/ajax/tags/suggest/values?search=do')->assertSimilarJson(['dog', 'dodgy']);
+        $this->get('/ajax/tags/suggest/values?search=cas')->assertSimilarJson(['castle']);
     }
 
     public function test_entity_permissions_effect_tag_suggestions()
     {
         // Create some tags with similar names to test with and save to a page
         $attrs = collect();
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
-        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'country']));
+        $attrs = $attrs->merge(Tag::factory()->count(5)->make(['name' => 'color']));
         $page = $this->getEntityWithTags(Page::class, $attrs->all());
 
-        $this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
-        $this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
+        $this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
+        $this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
 
         // Set restricted permission the page
         $page->restricted = true;
         $page->save();
         $page->rebuildPermissions();
 
-        $this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
-        $this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson([]);
+        $this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson(['color', 'country']);
+        $this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertSimilarJson([]);
     }
 
     public function test_tags_shown_on_search_listing()
     {
         $tags = [
-            factory(Tag::class)->make(['name' => 'category', 'value' => 'buckets']),
-            factory(Tag::class)->make(['name' => 'color', 'value' => 'red']),
+            Tag::factory()->make(['name' => 'category', 'value' => 'buckets']),
+            Tag::factory()->make(['name' => 'color', 'value' => 'red']),
         ];
 
         $page = $this->getEntityWithTags(Page::class, $tags);
index e27b787745ff3db74ed5db183fb2fe7b9afbd30b..dc1b2277959fef2437218e9372c34c3c437b5706 100644 (file)
@@ -167,7 +167,7 @@ class HomepageTest extends TestCase
 
     public function test_new_users_dont_have_any_recently_viewed()
     {
-        $user = factory(User::class)->create();
+        $user = User::factory()->create();
         $viewRole = Role::getRole('Viewer');
         $user->attachRole($viewRole);
 
index a9070248e5f86ab4fc333d0110e72d6a42ecf2a4..ef44af0eebd05b2a0998ded181454932e9cf61f6 100644 (file)
@@ -9,7 +9,7 @@ class LanguageTest extends TestCase
     /**
      * LanguageTest constructor.
      */
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
index bb011cfc6f5df2d0d59d837be2437859b6635f43..96d4792b9c67c30d621d888d7218c44c6ea443de 100644 (file)
@@ -23,7 +23,7 @@ class EntityPermissionsTest extends TestCase
      */
     protected $viewer;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->user = $this->getEditor();
index 3178bd8ce7b306347c8549a63e523faf73cec52c..c880bdd008938e9ea5ae4660ccf762b9e0add4c8 100644 (file)
@@ -19,7 +19,7 @@ class RolesTest extends TestCase
 {
     protected $user;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->user = $this->getViewer();
@@ -769,7 +769,7 @@ class RolesTest extends TestCase
         $this->giveUserPermissions($this->user, ['image-update-all']);
         /** @var Page $page */
         $page = Page::query()->first();
-        $image = factory(Image::class)->create([
+        $image = Image::factory()->create([
             'uploaded_to' => $page->id,
             'created_by'  => $this->user->id,
             'updated_by'  => $this->user->id,
@@ -789,7 +789,7 @@ class RolesTest extends TestCase
         $admin = $this->getAdmin();
         /** @var Page $page */
         $page = Page::query()->first();
-        $image = factory(Image::class)->create(['uploaded_to' => $page->id, 'created_by' => $admin->id, 'updated_by' => $admin->id]);
+        $image = Image::factory()->create(['uploaded_to' => $page->id, 'created_by' => $admin->id, 'updated_by' => $admin->id]);
 
         $this->actingAs($this->user)->json('delete', '/images/' . $image->id)->assertStatus(403);
 
@@ -825,14 +825,14 @@ class RolesTest extends TestCase
     {
         $admin = $this->getAdmin();
         // Book links
-        $book = factory(Book::class)->create(['created_by' => $admin->id, 'updated_by' => $admin->id]);
+        $book = Book::factory()->create(['created_by' => $admin->id, 'updated_by' => $admin->id]);
         $this->regenEntityPermissions($book);
         $this->actingAs($this->getViewer())->get($book->getUrl())
             ->assertDontSee('Create a new page')
             ->assertDontSee('Add a chapter');
 
         // Chapter links
-        $chapter = factory(Chapter::class)->create(['created_by' => $admin->id, 'updated_by' => $admin->id, 'book_id' => $book->id]);
+        $chapter = Chapter::factory()->create(['created_by' => $admin->id, 'updated_by' => $admin->id, 'book_id' => $book->id]);
         $this->regenEntityPermissions($chapter);
         $this->actingAs($this->getViewer())->get($chapter->getUrl())
             ->assertDontSee('Create a new page')
@@ -926,14 +926,14 @@ class RolesTest extends TestCase
 
     private function addComment(Page $page): TestResponse
     {
-        $comment = factory(Comment::class)->make();
+        $comment = Comment::factory()->make();
 
         return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
     }
 
     private function updateComment(Comment $comment): TestResponse
     {
-        $commentData = factory(Comment::class)->make();
+        $commentData = Comment::factory()->make();
 
         return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
     }
index d96fcb7107360db6fba5a21b86463e2d7ac28692..cbf49bf71f424f747e97bc04b3e3ff55fa6bb50b 100644 (file)
@@ -210,7 +210,7 @@ trait SharedTestHelpers
     protected function createNewRole(array $permissions = []): Role
     {
         $permissionRepo = app(PermissionsRepo::class);
-        $roleData = factory(Role::class)->make()->toArray();
+        $roleData = Role::factory()->make()->toArray();
         $roleData['permissions'] = array_flip($permissions);
 
         return $permissionRepo->saveNewRole($roleData);
@@ -228,9 +228,9 @@ trait SharedTestHelpers
         }
 
         $userAttrs = ['created_by' => $creatorUser->id, 'owned_by' => $creatorUser->id, 'updated_by' => $updaterUser->id];
-        $book = factory(Book::class)->create($userAttrs);
-        $chapter = factory(Chapter::class)->create(array_merge(['book_id' => $book->id], $userAttrs));
-        $page = factory(Page::class)->create(array_merge(['book_id' => $book->id, 'chapter_id' => $chapter->id], $userAttrs));
+        $book = Book::factory()->create($userAttrs);
+        $chapter = Chapter::factory()->create(array_merge(['book_id' => $book->id], $userAttrs));
+        $page = Page::factory()->create(array_merge(['book_id' => $book->id, 'chapter_id' => $chapter->id], $userAttrs));
         $restrictionService = $this->app[PermissionService::class];
         $restrictionService->buildJointPermissionsForEntity($book);
 
index 2cab765ae4345c6958d2a2e54988dffb8cccab4b..9aa7873b07c93af103206bd7f8608cfdf3622c22 100644 (file)
@@ -150,7 +150,7 @@ class ThemeTest extends TestCase
         Theme::listen(ThemeEvents::AUTH_REGISTER, $callback);
         $this->setSettings(['registration-enabled' => 'true']);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $this->post('/register', ['email' => $user->email, 'name' => $user->name, 'password' => 'password']);
 
         $this->assertCount(2, $args);
index cf568d07cf6c909b7c46597b5a22d91bb25f94e2..d10b5cfc6cb79f50556df9892a94edc97c5c0d82 100644 (file)
@@ -42,7 +42,7 @@ class AvatarTest extends TestCase
         config()->set([
             'services.disable_services' => false,
         ]);
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $this->assertImageFetchFrom('https://www.gravatar.com/avatar/' . md5(strtolower($user->email)) . '?s=500&d=identicon');
 
         $user = $this->createUserRequest($user);
@@ -60,7 +60,7 @@ class AvatarTest extends TestCase
             'services.avatar_url'       => 'https://example.com/${email}/${hash}/${size}',
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $url = 'https://example.com/' . urlencode(strtolower($user->email)) . '/' . md5(strtolower($user->email)) . '/500';
         $this->assertImageFetchFrom($url);
 
@@ -74,7 +74,7 @@ class AvatarTest extends TestCase
             'services.disable_services' => true,
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         $http = $this->mock(HttpFetcher::class);
         $http->shouldNotReceive('fetch');
@@ -93,7 +93,7 @@ class AvatarTest extends TestCase
 
         $logger = $this->withTestLogger();
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $this->createUserRequest($user);
         $this->assertTrue($logger->hasError('Failed to save user avatar image'));
     }
index ed2fb5f04808c5ebddfce6cc8165c0b09a8ded5e..5a36b85df6f9d4f1fde0b8eb932eaf9afa0a7cf6 100644 (file)
@@ -15,7 +15,7 @@ class UserManagementTest extends TestCase
     public function test_user_creation()
     {
         /** @var User $user */
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $adminRole = Role::getRole('admin');
 
         $resp = $this->asAdmin()->get('/settings/users');
index 3942efa8e3d095a1d1084594d4c0d9959e91fde9..c3888f8c511768fcd2a89956218c23ba5fb2d5df 100644 (file)
@@ -14,7 +14,7 @@ class UserProfileTest extends TestCase
      */
     protected $user;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         parent::setUp();
         $this->user = User::all()->last();
@@ -42,7 +42,7 @@ class UserProfileTest extends TestCase
 
     public function test_profile_page_shows_created_content_counts()
     {
-        $newUser = factory(User::class)->create();
+        $newUser = User::factory()->create();
 
         $this->asAdmin()->get('/user/' . $newUser->slug)
             ->assertSee($newUser->name)
@@ -61,7 +61,7 @@ class UserProfileTest extends TestCase
 
     public function test_profile_page_shows_recent_activity()
     {
-        $newUser = factory(User::class)->create();
+        $newUser = User::factory()->create();
         $this->actingAs($newUser);
         $entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
         Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);
@@ -75,7 +75,7 @@ class UserProfileTest extends TestCase
 
     public function test_user_activity_has_link_leading_to_profile()
     {
-        $newUser = factory(User::class)->create();
+        $newUser = User::factory()->create();
         $this->actingAs($newUser);
         $entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
         Activity::addForEntity($entities['book'], ActivityType::BOOK_UPDATE);