NOW MANAGED ON CODEBERG
Laravel 8 shift squash & merge (#3029)
Dan Brownf139cded7899
diff --git a/app/Actions/Comment.php b/app/Actions/Comment.phpindex 34fd84709..885ba6ed1 100644--- a/app/Actions/Comment.php+++ b/app/Actions/Comment.php@@ -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'];diff --git a/app/Actions/Tag.php b/app/Actions/Tag.phpindex ce0954f00..db9328b7d 100644--- a/app/Actions/Tag.php+++ b/app/Actions/Tag.php@@ -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'];diff --git a/app/Auth/Role.php b/app/Auth/Role.phpindex fc2e39aa9..71da88e19 100644--- a/app/Auth/Role.php+++ b/app/Auth/Role.php@@ -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'];/**diff --git a/app/Auth/User.php b/app/Auth/User.phpindex aa8b44e9f..68e2ad625 100644--- a/app/Auth/User.php+++ b/app/Auth/User.php@@ -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;diff --git a/app/Config/app.php b/app/Config/app.phpold mode 100755new mode 100644index f90a7dd76..44e382cdc--- a/app/Config/app.php+++ b/app/Config/app.php@@ -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 Partydiff --git a/app/Config/auth.php b/app/Config/auth.phpindex 88c22e70a..1e1a9d350 100644--- a/app/Config/auth.php+++ b/app/Config/auth.php@@ -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,+];diff --git a/app/Config/broadcasting.php b/app/Config/broadcasting.phpindex 5e929d373..be0d7376c 100644--- a/app/Config/broadcasting.php+++ b/app/Config/broadcasting.php@@ -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'),+];diff --git a/app/Config/cache.php b/app/Config/cache.phpindex f9b7ed1d2..6fd4807da 100644--- a/app/Config/cache.php+++ b/app/Config/cache.php@@ -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'),];diff --git a/app/Config/filesystems.php b/app/Config/filesystems.phpindex a6b05c8c4..4d59ba919 100644--- a/app/Config/filesystems.php+++ b/app/Config/filesystems.php@@ -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'),+ ],+];diff --git a/app/Config/logging.php b/app/Config/logging.phpindex 220aa0607..2b80147c8 100644--- a/app/Config/logging.php+++ b/app/Config/logging.php@@ -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 Messagediff --git a/app/Config/queue.php b/app/Config/queue.phpindex 0c79fcdd2..0f5ee3ce5 100644--- a/app/Config/queue.php+++ b/app/Config/queue.php@@ -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',],];diff --git a/app/Entities/Models/Book.php b/app/Entities/Models/Book.phpindex 1e4591bd7..982df5c90 100644--- a/app/Entities/Models/Book.php+++ b/app/Entities/Models/Book.php@@ -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'];diff --git a/app/Entities/Models/Bookshelf.php b/app/Entities/Models/Bookshelf.phpindex f427baf49..8fe9dbe41 100644--- a/app/Entities/Models/Bookshelf.php+++ b/app/Entities/Models/Bookshelf.php@@ -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;diff --git a/app/Entities/Models/Chapter.php b/app/Entities/Models/Chapter.phpindex f6f8427a3..abf496b44 100644--- a/app/Entities/Models/Chapter.php+++ b/app/Entities/Models/Chapter.php@@ -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'];diff --git a/app/Entities/Models/Page.php b/app/Entities/Models/Page.phpindex 452965667..fbe0db41b 100644--- a/app/Entities/Models/Page.php+++ b/app/Entities/Models/Page.php@@ -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'];diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 63b5cfc5a..3b4ad4a4d 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -28,6 +28,7 @@ class Handler extends ExceptionHandler* @var array*/protected $dontFlash = [+ 'current_password','password','password_confirmation',];diff --git a/app/Http/Kernel.php b/app/Http/Kernel.phpindex 7a09493af..91dbdd963 100644--- a/app/Http/Kernel.php+++ b/app/Http/Kernel.php@@ -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,diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.phpsimilarity index 58%rename from app/Http/Middleware/CheckForMaintenanceMode.phprename to app/Http/Middleware/PreventRequestsDuringMaintenance.phpindex 0c7683836..dfb9592e1 100644--- a/app/Http/Middleware/CheckForMaintenanceMode.php+++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php@@ -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.diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.phpindex 6853809ea..76e64a3b9 100644--- a/app/Http/Middleware/RedirectIfAuthenticated.php+++ b/app/Http/Middleware/RedirectIfAuthenticated.php@@ -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 filediff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.phpindex b0550cfc7..7bd89ee51 100644--- a/app/Http/Middleware/TrustHosts.php+++ b/app/Http/Middleware/TrustHosts.php@@ -1,6 +1,6 @@<?php-namespace App\Http\Middleware;+namespace BookStack\Http\Middleware;use Illuminate\Http\Middleware\TrustHosts as Middleware;diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.phpindex 3f8b32eb2..0fe0247b8 100644--- a/app/Http/Middleware/TrustProxies.php+++ b/app/Http/Middleware/TrustProxies.php@@ -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.diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex 34a3a290f..fc712632e 100644--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -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 ComposersView::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class);++ // Set paginator to use bootstrap-style pagination+ Paginator::useBootstrap();}/**diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.phpindex a826185d8..659843ce3 100644--- a/app/Providers/EventServiceProvider.php+++ b/app/Providers/EventServiceProvider.php@@ -30,6 +30,5 @@ class EventServiceProvider extends ServiceProvider*/public function boot(){- parent::boot();}}diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.phpindex b60443a45..ac3307f2d 100644--- a/app/Providers/RouteServiceProvider.php+++ b/app/Providers/RouteServiceProvider.php@@ -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 ServiceProviderrequire 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());+ });+ }}diff --git a/app/Uploads/Image.php b/app/Uploads/Image.phpindex 4e0abc85b..bdf10f080 100644--- a/app/Uploads/Image.php+++ b/app/Uploads/Image.php@@ -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'];diff --git a/composer.json b/composer.jsonindex b50cee762..c1d5c1e4b 100644--- a/composer.json+++ b/composer.json@@ -20,11 +20,13 @@"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",@@ -32,33 +34,28 @@"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"@@ -70,6 +67,10 @@}},"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');\""],@@ -83,10 +84,6 @@"@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"diff --git a/composer.lock b/composer.lockindex f07d61062..17e57df71 100644--- a/composer.lock+++ b/composer.lock@@ -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",@@ -58,16 +58,16 @@},{"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": {@@ -143,9 +143,9 @@"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",@@ -1101,30 +1101,32 @@},{"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/"@@ -1135,11 +1137,6 @@"MIT"],"authors": [- {- "name": "Michael Dowling",- "email": "[email protected]",- "homepage": "https://github.com/mtdowling"- },{"name": "Chris Tankersley","email": "[email protected]",@@ -1153,7 +1150,7 @@],"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": [{@@ -1161,7 +1158,7 @@"type": "github"}],- "time": "2020-10-13T00:52:37+00:00"+ "time": "2020-11-24T19:55:57+00:00"},{"name": "egulias/email-validator",@@ -1231,64 +1228,6 @@],"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",@@ -1360,6 +1299,67 @@],"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",@@ -1843,60 +1843,63 @@},{"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",@@ -1909,6 +1912,7 @@"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",@@ -1924,22 +1928,23 @@"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.",@@ -1947,38 +1952,43 @@"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/",@@ -2001,7 +2011,66 @@"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",@@ -2142,26 +2211,30 @@},{"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"@@ -2190,10 +2263,9 @@"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",@@ -3436,16 +3508,16 @@},{"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": {@@ -3527,7 +3599,7 @@],"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": [{@@ -3543,7 +3615,7 @@"type": "tidelift"}],- "time": "2021-08-16T04:24:45+00:00"+ "time": "2021-10-27T03:01:46+00:00"},{"name": "pragmarx/google2fa",@@ -4851,16 +4923,16 @@},{"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": {@@ -4930,7 +5002,7 @@"terminal"],"support": {- "source": "https://github.com/symfony/console/tree/v5.3.7"+ "source": "https://github.com/symfony/console/tree/v5.3.10"},"funding": [{@@ -4946,7 +5018,7 @@"type": "tidelift"}],- "time": "2021-08-25T20:02:16+00:00"+ "time": "2021-10-26T09:30:15+00:00"},{"name": "symfony/css-selector",@@ -5455,16 +5527,16 @@},{"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": {@@ -5508,7 +5580,7 @@"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": [{@@ -5524,20 +5596,20 @@"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": {@@ -5620,7 +5692,7 @@"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": [{@@ -5636,7 +5708,7 @@"type": "tidelift"}],- "time": "2021-09-28T10:25:11+00:00"+ "time": "2021-10-29T08:36:48+00:00"},{"name": "symfony/mime",@@ -6762,16 +6834,16 @@},{"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": {@@ -6825,7 +6897,7 @@"utf8"],"support": {- "source": "https://github.com/symfony/string/tree/v5.3.7"+ "source": "https://github.com/symfony/string/tree/v5.3.10"},"funding": [{@@ -6841,20 +6913,20 @@"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": {@@ -6920,7 +6992,7 @@"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": [{@@ -6936,7 +7008,7 @@"type": "tidelift"}],- "time": "2021-08-26T08:22:53+00:00"+ "time": "2021-10-10T06:43:24+00:00"},{"name": "symfony/translation-contracts",@@ -7018,16 +7090,16 @@},{"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": {@@ -7086,7 +7158,7 @@"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": [{@@ -7102,7 +7174,7 @@"type": "tidelift"}],- "time": "2021-09-24T15:59:58+00:00"+ "time": "2021-10-26T09:30:15+00:00"},{"name": "tijsverkoyen/css-to-inline-styles",@@ -7159,37 +7231,39 @@},{"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": {@@ -7219,7 +7293,7 @@],"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": [{@@ -7231,7 +7305,7 @@"type": "tidelift"}],- "time": "2021-10-02T19:17:08+00:00"+ "time": "2021-10-02T19:24:42+00:00"},{"name": "voku/portable-ascii",@@ -7306,6 +7380,64 @@}],"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": [@@ -7829,35 +7961,34 @@},{"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": {@@ -7913,7 +8044,7 @@"type": "patreon"}],- "time": "2020-10-29T15:12:23+00:00"+ "time": "2021-09-20T15:06:32+00:00"},{"name": "phar-io/manifest",@@ -8255,23 +8386,23 @@},{"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",@@ -8320,7 +8451,7 @@],"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": [{@@ -8328,7 +8459,7 @@"type": "github"}],- "time": "2021-09-17T05:39:03+00:00"+ "time": "2021-10-30T08:01:38+00:00"},{"name": "phpunit/php-file-iterator",@@ -9830,64 +9961,6 @@}],"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.phpnew file mode 100644index 000000000..e81f3fe2c--- /dev/null+++ b/database/factories/Actions/CommentFactory.php@@ -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.phpnew file mode 100644index 000000000..8d5c77e09--- /dev/null+++ b/database/factories/Actions/TagFactory.php@@ -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.phpnew file mode 100644index 000000000..a952e0487--- /dev/null+++ b/database/factories/Auth/RoleFactory.php@@ -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.phpnew file mode 100644index 000000000..77d63ac68--- /dev/null+++ b/database/factories/Auth/UserFactory.php@@ -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.phpnew file mode 100644index 000000000..0613800a1--- /dev/null+++ b/database/factories/Entities/Models/BookFactory.php@@ -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.phpnew file mode 100644index 000000000..66dd1c111--- /dev/null+++ b/database/factories/Entities/Models/BookshelfFactory.php@@ -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.phpnew file mode 100644index 000000000..4fcd69c39--- /dev/null+++ b/database/factories/Entities/Models/ChapterFactory.php@@ -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.phpnew file mode 100644index 000000000..c83e0f828--- /dev/null+++ b/database/factories/Entities/Models/PageFactory.php@@ -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.phpdeleted file mode 100644index dc0645540..000000000--- a/database/factories/ModelFactory.php+++ /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.phpnew file mode 100644index 000000000..c6d0e0801--- /dev/null+++ b/database/factories/Uploads/ImageFactory.php@@ -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,+ ];+ }+}diff --git a/database/seeds/.gitkeep b/database/seeders/.gitkeepsimilarity index 100%rename from database/seeds/.gitkeeprename to database/seeders/.gitkeepdiff --git a/database/seeds/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.phpsimilarity index 92%rename from database/seeds/DatabaseSeeder.phprename to database/seeders/DatabaseSeeder.phpindex 069765eb4..21eaefb19 100644--- a/database/seeds/DatabaseSeeder.php+++ b/database/seeders/DatabaseSeeder.php@@ -1,5 +1,7 @@<?php+namespace Database\Seeders;+use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Seeder;diff --git a/database/seeds/DummyContentSeeder.php b/database/seeders/DummyContentSeeder.phpsimilarity index 71%rename from database/seeds/DummyContentSeeder.phprename to database/seeders/DummyContentSeeder.phpindex 7463a3b37..d54732b26 100644--- a/database/seeds/DummyContentSeeder.php+++ b/database/seeders/DummyContentSeeder.php@@ -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 Seederpublic 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 keydiff --git a/database/seeds/LargeContentSeeder.php b/database/seeders/LargeContentSeeder.phpsimilarity index 60%rename from database/seeds/LargeContentSeeder.phprename to database/seeders/LargeContentSeeder.phpindex 535626b8f..2fbf4a5c9 100644--- a/database/seeds/LargeContentSeeder.php+++ b/database/seeders/LargeContentSeeder.php@@ -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 Seederpublic 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();diff --git a/public/index.php b/public/index.phpindex 7e4ef97c7..c2f34d4bf 100644--- a/public/index.php+++ b/public/index.php@@ -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 filediff --git a/routes/api.php b/routes/api.phpindex 49521bb89..4ba499462 100644--- a/routes/api.php+++ b/routes/api.php@@ -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.phpnew file mode 100644index 000000000..e05f4c9a1--- /dev/null+++ b/routes/console.php@@ -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');diff --git a/routes/web.php b/routes/web.phpindex a5f35fb8a..419a1e7f5 100644--- a/routes/web.php+++ b/routes/web.php@@ -1,287 +1,318 @@<?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');diff --git a/storage/framework/.gitignore b/storage/framework/.gitignoreindex 953edb7a9..05c4471f2 100755--- a/storage/framework/.gitignore+++ b/storage/framework/.gitignore@@ -1,7 +1,9 @@-config.php-routes.phpcompiled.php-services.json+config.php+downevents.scanned.php+maintenance.php+routes.phproutes.scanned.php-down+schedule-*+services.jsondiff --git a/tests/AuditLogTest.php b/tests/AuditLogTest.phpindex 8d13670ca..f909cd79a 100644--- a/tests/AuditLogTest.php+++ b/tests/AuditLogTest.php@@ -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);diff --git a/tests/Auth/AuthTest.php b/tests/Auth/AuthTest.phpindex 79f00bed0..66ab09d3c 100644--- a/tests/Auth/AuthTest.php+++ b/tests/Auth/AuthTest.php@@ -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 TestCasepublic 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 TestCasepublic 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'))diff --git a/tests/Auth/LdapTest.php b/tests/Auth/LdapTest.phpindex 9e0729a8e..d00e8cf15 100644--- a/tests/Auth/LdapTest.php+++ b/tests/Auth/LdapTest.php@@ -20,7 +20,7 @@ class LdapTest extends TestCaseprotected $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 TestCasepublic 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 TestCasepublic 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 TestCasepublic 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 TestCasepublic 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 TestCasepublic 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([diff --git a/tests/Auth/OidcTest.php b/tests/Auth/OidcTest.phpindex 6c806aa8e..e7665a679 100644--- a/tests/Auth/OidcTest.php+++ b/tests/Auth/OidcTest.php@@ -16,7 +16,7 @@ class OidcTest extends TestCaseprotected $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)) {diff --git a/tests/Auth/Saml2Test.php b/tests/Auth/Saml2Test.phpindex c534b2d78..aac2710a8 100644--- a/tests/Auth/Saml2Test.php+++ b/tests/Auth/Saml2Test.php@@ -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]);diff --git a/tests/Auth/SocialAuthTest.php b/tests/Auth/SocialAuthTest.phpindex f70263dd2..90d7e37aa 100644--- a/tests/Auth/SocialAuthTest.php+++ b/tests/Auth/SocialAuthTest.php@@ -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 TestCasepublic 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']);diff --git a/tests/Entity/BookShelfTest.php b/tests/Entity/BookShelfTest.phpindex afd6a1a06..fcbc17ea9 100644--- a/tests/Entity/BookShelfTest.php+++ b/tests/Entity/BookShelfTest.php@@ -37,7 +37,7 @@ class BookShelfTest extends TestCasepublic 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();diff --git a/tests/Entity/BookTest.php b/tests/Entity/BookTest.phpindex 53ee6faf9..2894fbb98 100644--- a/tests/Entity/BookTest.php+++ b/tests/Entity/BookTest.php@@ -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 TestCasepublic function test_create_uses_different_slugs_when_name_reused(){- $book = factory(Book::class)->make([+ $book = Book::factory()->make(['name' => 'My First Book',]);diff --git a/tests/Entity/ChapterTest.php b/tests/Entity/ChapterTest.phpindex ea29ece5d..9868dc030 100644--- a/tests/Entity/ChapterTest.php+++ b/tests/Entity/ChapterTest.php@@ -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',]);diff --git a/tests/Entity/CommentSettingTest.php b/tests/Entity/CommentSettingTest.phpindex d8caa7358..23607f5a7 100644--- a/tests/Entity/CommentSettingTest.php+++ b/tests/Entity/CommentSettingTest.php@@ -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();diff --git a/tests/Entity/CommentTest.php b/tests/Entity/CommentTest.phpindex b613f80a1..1e8ecbcac 100644--- a/tests/Entity/CommentTest.php+++ b/tests/Entity/CommentTest.php@@ -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();diff --git a/tests/Entity/PageDraftTest.php b/tests/Entity/PageDraftTest.phpindex 4fb7d7ab6..9e2ceff51 100644--- a/tests/Entity/PageDraftTest.php+++ b/tests/Entity/PageDraftTest.php@@ -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();diff --git a/tests/Entity/PageEditorTest.php b/tests/Entity/PageEditorTest.phpindex 9b0a8f188..652bc1336 100644--- a/tests/Entity/PageEditorTest.php+++ b/tests/Entity/PageEditorTest.php@@ -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();diff --git a/tests/Entity/PageTest.php b/tests/Entity/PageTest.phpindex 313fc77f0..32459a84a 100644--- a/tests/Entity/PageTest.php+++ b/tests/Entity/PageTest.php@@ -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',]);diff --git a/tests/Entity/SortTest.php b/tests/Entity/SortTest.phpindex 5cfc5c3c5..89279bfcf 100644--- a/tests/Entity/SortTest.php+++ b/tests/Entity/SortTest.php@@ -12,7 +12,7 @@ class SortTest extends TestCase{protected $book;- public function setUp(): void+ protected function setUp(): void{parent::setUp();$this->book = Book::first();diff --git a/tests/Entity/TagTest.php b/tests/Entity/TagTest.phpindex 74da37f4a..9b3fb1532 100644--- a/tests/Entity/TagTest.php+++ b/tests/Entity/TagTest.php@@ -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);diff --git a/tests/HomepageTest.php b/tests/HomepageTest.phpindex e27b78774..dc1b22779 100644--- a/tests/HomepageTest.php+++ b/tests/HomepageTest.php@@ -167,7 +167,7 @@ class HomepageTest extends TestCasepublic 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);diff --git a/tests/LanguageTest.php b/tests/LanguageTest.phpindex a9070248e..ef44af0ee 100644--- a/tests/LanguageTest.php+++ b/tests/LanguageTest.php@@ -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')), ['..', '.']);diff --git a/tests/Permissions/EntityPermissionsTest.php b/tests/Permissions/EntityPermissionsTest.phpindex bb011cfc6..96d4792b9 100644--- a/tests/Permissions/EntityPermissionsTest.php+++ b/tests/Permissions/EntityPermissionsTest.php@@ -23,7 +23,7 @@ class EntityPermissionsTest extends TestCase*/protected $viewer;- public function setUp(): void+ protected function setUp(): void{parent::setUp();$this->user = $this->getEditor();diff --git a/tests/Permissions/RolesTest.php b/tests/Permissions/RolesTest.phpindex 3178bd8ce..c880bdd00 100644--- a/tests/Permissions/RolesTest.php+++ b/tests/Permissions/RolesTest.php@@ -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 TestCaseprivate 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'));}diff --git a/tests/SharedTestHelpers.php b/tests/SharedTestHelpers.phpindex d96fcb710..cbf49bf71 100644--- a/tests/SharedTestHelpers.php+++ b/tests/SharedTestHelpers.php@@ -210,7 +210,7 @@ trait SharedTestHelpersprotected 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);diff --git a/tests/ThemeTest.php b/tests/ThemeTest.phpindex 2cab765ae..9aa7873b0 100644--- a/tests/ThemeTest.php+++ b/tests/ThemeTest.php@@ -150,7 +150,7 @@ class ThemeTest extends TestCaseTheme::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);diff --git a/tests/Uploads/AvatarTest.php b/tests/Uploads/AvatarTest.phpindex cf568d07c..d10b5cfc6 100644--- a/tests/Uploads/AvatarTest.php+++ b/tests/Uploads/AvatarTest.php@@ -42,7 +42,7 @@ class AvatarTest extends TestCaseconfig()->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'));}diff --git a/tests/User/UserManagementTest.php b/tests/User/UserManagementTest.phpindex ed2fb5f04..5a36b85df 100644--- a/tests/User/UserManagementTest.php+++ b/tests/User/UserManagementTest.php@@ -15,7 +15,7 @@ class UserManagementTest extends TestCasepublic 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');diff --git a/tests/User/UserProfileTest.php b/tests/User/UserProfileTest.phpindex 3942efa8e..c3888f8c5 100644--- a/tests/User/UserProfileTest.php+++ b/tests/User/UserProfileTest.php@@ -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 TestCasepublic 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 TestCasepublic 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 TestCasepublic 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);