repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2020_09_19_094251_add_activity_indexes.php
database/migrations/2020_09_19_094251_add_activity_indexes.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('activities', function (Blueprint $table) { $table->index('key'); $table->index('created_at'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('activities', function (Blueprint $table) { $table->dropIndex('activities_key_index'); $table->dropIndex('activities_created_at_index'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
database/migrations/2022_09_02_082910_fix_shelf_cover_image_types.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // This updates the 'type' field for images, uploaded as shelf cover images, // to be cover_bookshelf instead of cover_book. // This does not fix their paths, since fixing that requires a more complicated operation, // but their path does not affect functionality at time of this fix. $shelfImageIds = DB::table('bookshelves') ->whereNotNull('image_id') ->pluck('image_id') ->values()->all(); if (count($shelfImageIds) > 0) { DB::table('images') ->where('type', '=', 'cover_book') ->whereIn('id', $shelfImageIds) ->update(['type' => 'cover_bookshelf']); } } /** * Reverse the migrations. */ public function down(): void { DB::table('images') ->where('type', '=', 'cover_bookshelf') ->update(['type' => 'cover_book']); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_09_15_134751_update_entity_relation_columns.php
database/migrations/2025_09_15_134751_update_entity_relation_columns.php
<?php use BookStack\Permissions\JointPermissionBuilder; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Query\Builder; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * @var array<string, string|array<string>> $columnByTable */ protected static array $columnByTable = [ 'activities' => 'loggable_id', 'attachments' => 'uploaded_to', 'bookshelves_books' => ['bookshelf_id', 'book_id'], 'comments' => 'entity_id', 'deletions' => 'deletable_id', 'entity_permissions' => 'entity_id', 'favourites' => 'favouritable_id', 'images' => 'uploaded_to', 'joint_permissions' => 'entity_id', 'page_revisions' => 'page_id', 'references' => ['from_id', 'to_id'], 'search_terms' => 'entity_id', 'tags' => 'entity_id', 'views' => 'viewable_id', 'watches' => 'watchable_id', ]; protected static array $nullable = [ 'activities.loggable_id', 'images.uploaded_to', ]; /** * Run the migrations. */ public function up(): void { // Drop foreign key constraints Schema::table('bookshelves_books', function (Blueprint $table) { $table->dropForeign(['book_id']); $table->dropForeign(['bookshelf_id']); }); // Update column types to unsigned big integers foreach (static::$columnByTable as $table => $column) { $tableName = $table; Schema::table($table, function (Blueprint $table) use ($tableName, $column) { if (is_string($column)) { $column = [$column]; } foreach ($column as $col) { if (in_array($tableName . '.' . $col, static::$nullable)) { $table->unsignedBigInteger($col)->nullable()->change(); } else { $table->unsignedBigInteger($col)->change(); } } }); } // Convert image and activity zero values to null DB::table('images')->where('uploaded_to', '=', 0)->update(['uploaded_to' => null]); DB::table('activities')->where('loggable_id', '=', 0)->update(['loggable_id' => null]); // Clean up any orphaned gallery/drawio images to nullify their page relation DB::table('images') ->whereIn('type', ['gallery', 'drawio']) ->whereNotIn('uploaded_to', function (Builder $query) { $query->select('id') ->from('entities') ->where('type', '=', 'page'); })->update(['uploaded_to' => null]); // Rebuild joint permissions if needed // This was moved here from 2023_01_24_104625_refactor_joint_permissions_storage since the changes // made for this release would mean our current logic would not be compatible with // the database changes being made. This is based on a count since any joint permissions // would have been truncated in the previous migration. if (\Illuminate\Support\Facades\DB::table('joint_permissions')->count() === 0) { app(JointPermissionBuilder::class)->rebuildForAll(); } } /** * Reverse the migrations. */ public function down(): void { // Convert image null values back to zeros DB::table('images')->whereNull('uploaded_to')->update(['uploaded_to' => '0']); // Revert columns to standard integers foreach (static::$columnByTable as $table => $column) { $tableName = $table; Schema::table($table, function (Blueprint $table) use ($tableName, $column) { if (is_string($column)) { $column = [$column]; } foreach ($column as $col) { if ($tableName . '.' . $col === 'activities.loggable_id') { $table->unsignedInteger($col)->nullable()->change(); } else if ($tableName . '.' . $col === 'images.uploaded_to') { $table->unsignedInteger($col)->default(0)->change(); } else { $table->unsignedInteger($col)->change(); } } }); } // Re-add foreign key constraints Schema::table('bookshelves_books', function (Blueprint $table) { $table->foreign('bookshelf_id')->references('id')->on('bookshelves') ->onUpdate('cascade')->onDelete('cascade'); $table->foreign('book_id')->references('id')->on('books') ->onUpdate('cascade')->onDelete('cascade'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_05_06_185215_create_tags_table.php
database/migrations/2016_05_06_185215_create_tags_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('tags', function (Blueprint $table) { $table->increments('id'); $table->integer('entity_id'); $table->string('entity_type', 100); $table->string('name'); $table->string('value'); $table->integer('order'); $table->timestamps(); $table->index('name'); $table->index('value'); $table->index('order'); $table->index(['entity_id', 'entity_type']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::drop('tags'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_03_25_123157_add_markdown_support.php
database/migrations/2016_03_25_123157_add_markdown_support.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('pages', function (Blueprint $table) { $table->longText('markdown')->default(''); }); Schema::table('page_revisions', function (Blueprint $table) { $table->longText('markdown')->default(''); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('pages', function (Blueprint $table) { $table->dropColumn('markdown'); }); Schema::table('page_revisions', function (Blueprint $table) { $table->dropColumn('markdown'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_04_18_215145_add_content_refs_and_archived_to_comments.php
database/migrations/2025_04_18_215145_add_content_refs_and_archived_to_comments.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('comments', function (Blueprint $table) { $table->string('content_ref'); $table->boolean('archived')->index(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('comments', function (Blueprint $table) { $table->dropColumn('content_ref'); $table->dropColumn('archived'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2020_08_04_111754_drop_joint_permissions_id.php
database/migrations/2020_08_04_111754_drop_joint_permissions_id.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('joint_permissions', function (Blueprint $table) { $table->dropColumn('id'); $table->primary(['role_id', 'entity_type', 'entity_id', 'action'], 'joint_primary'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('joint_permissions', function (Blueprint $table) { $table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']); }); Schema::table('joint_permissions', function (Blueprint $table) { $table->increments('id')->unsigned(); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_12_07_111343_create_webhooks_table.php
database/migrations/2021_12_07_111343_create_webhooks_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('webhooks', function (Blueprint $table) { $table->increments('id'); $table->string('name', 150); $table->boolean('active'); $table->string('endpoint', 500); $table->timestamps(); $table->index('name'); $table->index('active'); }); Schema::create('webhook_tracked_events', function (Blueprint $table) { $table->increments('id'); $table->integer('webhook_id'); $table->string('event', 50); $table->timestamps(); $table->index('event'); $table->index('webhook_id'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('webhooks'); Schema::dropIfExists('webhook_tracked_events'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2023_01_28_141230_copy_color_settings_for_dark_mode.php
database/migrations/2023_01_28_141230_copy_color_settings_for_dark_mode.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { $colorSettings = [ 'app-color', 'app-color-light', 'bookshelf-color', 'book-color', 'chapter-color', 'page-color', 'page-draft-color', ]; $existing = DB::table('settings') ->whereIn('setting_key', $colorSettings) ->get()->toArray(); $newData = []; foreach ($existing as $setting) { $newSetting = (array) $setting; $newSetting['setting_key'] .= '-dark'; $newData[] = $newSetting; if ($newSetting['setting_key'] === 'app-color-dark') { $newSetting['setting_key'] = 'link-color'; $newData[] = $newSetting; $newSetting['setting_key'] = 'link-color-dark'; $newData[] = $newSetting; } } DB::table('settings')->insert($newData); } /** * Reverse the migrations. */ public function down(): void { $colorSettings = [ 'app-color-dark', 'link-color', 'link-color-dark', 'app-color-light-dark', 'bookshelf-color-dark', 'book-color-dark', 'chapter-color-dark', 'page-color-dark', 'page-draft-color-dark', ]; DB::table('settings') ->whereIn('setting_key', $colorSettings) ->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_09_02_111542_remove_unused_columns.php
database/migrations/2025_09_02_111542_remove_unused_columns.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('comments', function (Blueprint $table) { $table->dropColumn('text'); }); Schema::table('role_permissions', function (Blueprint $table) { $table->dropColumn('display_name'); $table->dropColumn('description'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('comments', function (Blueprint $table) { $table->longText('text')->nullable(); }); Schema::table('role_permissions', function (Blueprint $table) { $table->string('display_name')->nullable(); $table->string('description')->nullable(); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2015_12_09_195748_add_user_avatars.php
database/migrations/2015_12_09_195748_add_user_avatars.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('users', function (Blueprint $table) { $table->integer('image_id')->default(0); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('image_id'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_07_03_085038_add_mfa_enforced_to_roles_table.php
database/migrations/2021_07_03_085038_add_mfa_enforced_to_roles_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('roles', function (Blueprint $table) { $table->boolean('mfa_enforced'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('roles', function (Blueprint $table) { $table->dropColumn('mfa_enforced'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php
database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Add the new 'editor' column to the pages table Schema::table('pages', function (Blueprint $table) { $table->string('editor', 50)->default(''); }); // Populate the new 'editor' column // We set it to 'markdown' for pages currently with markdown content DB::table('pages')->where('markdown', '!=', '')->update(['editor' => 'markdown']); // We set it to 'wysiwyg' where we have HTML but no markdown DB::table('pages')->where('markdown', '=', '') ->where('html', '!=', '') ->update(['editor' => 'wysiwyg']); // Give the admin user permission to change the editor $adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id; $permissionId = DB::table('role_permissions')->insertGetId([ 'name' => 'editor-change', 'display_name' => 'Change page editor', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } /** * Reverse the migrations. */ public function down(): void { // Drop the new column from the pages table Schema::table('pages', function (Blueprint $table) { $table->dropColumn('editor'); }); // Remove traces of the role permission DB::table('role_permissions')->where('name', '=', 'editor-change')->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2019_07_07_112515_add_template_support.php
database/migrations/2019_07_07_112515_add_template_support.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('pages', function (Blueprint $table) { $table->boolean('template')->default(false); $table->index('template'); }); // Create new templates-manage permission and assign to admin role $adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id; $permissionId = DB::table('role_permissions')->insertGetId([ 'name' => 'templates-manage', 'display_name' => 'Manage Page Templates', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } /** * Reverse the migrations. */ public function down(): void { Schema::table('pages', function (Blueprint $table) { $table->dropColumn('template'); }); // Remove templates-manage permission $templatesManagePermission = DB::table('role_permissions') ->where('name', '=', 'templates-manage')->first(); DB::table('permission_role')->where('permission_id', '=', $templatesManagePermission->id)->delete(); DB::table('role_permissions')->where('name', '=', 'templates-manage')->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2022_08_17_092941_create_references_table.php
database/migrations/2022_08_17_092941_create_references_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('references', function (Blueprint $table) { $table->id(); $table->unsignedInteger('from_id')->index(); $table->string('from_type', 25)->index(); $table->unsignedInteger('to_id')->index(); $table->string('to_type', 25)->index(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('references'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2023_06_25_181952_remove_bookshelf_create_entity_permissions.php
database/migrations/2023_06_25_181952_remove_bookshelf_create_entity_permissions.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up() { // Note: v23.06.2 // Migration removed since change to remove bookshelf create permissions was reverted. // Create permissions were removed as incorrectly thought to be unused, but they did // have a use via shelf permission copy-down to books. } /** * Reverse the migrations. */ public function down() { // No structural changes to make, and we cannot know the permissions to re-assign. } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_05_15_173110_create_favourites_table.php
database/migrations/2021_05_15_173110_create_favourites_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('favourites', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->index(); $table->integer('favouritable_id'); $table->string('favouritable_type', 100); $table->timestamps(); $table->index(['favouritable_id', 'favouritable_type'], 'favouritable_index'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('favourites'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2024_11_27_171039_add_instance_id_setting.php
database/migrations/2024_11_27_171039_add_instance_id_setting.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { DB::table('settings')->insert([ 'setting_key' => 'instance-id', 'value' => Str::uuid(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'type' => 'string', ]); } /** * Reverse the migrations. */ public function down(): void { DB::table('settings')->where('setting_key', '=', 'instance-id')->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_12_13_152024_create_jobs_table.php
database/migrations/2021_12_13_152024_create_jobs_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('jobs', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('queue')->index(); $table->longText('payload'); $table->unsignedTinyInteger('attempts'); $table->unsignedInteger('reserved_at')->nullable(); $table->unsignedInteger('available_at'); $table->unsignedInteger('created_at'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('jobs'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_02_05_150842_add_sort_rule_id_to_books.php
database/migrations/2025_02_05_150842_add_sort_rule_id_to_books.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('books', function (Blueprint $table) { $table->unsignedInteger('sort_rule_id')->nullable()->default(null); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('books', function (Blueprint $table) { $table->dropColumn('sort_rule_id'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2020_11_07_232321_simplify_activities_table.php
database/migrations/2020_11_07_232321_simplify_activities_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('activities', function (Blueprint $table) { $table->renameColumn('key', 'type'); $table->renameColumn('extra', 'detail'); $table->dropColumn('book_id'); $table->integer('entity_id')->nullable()->change(); $table->string('entity_type', 191)->nullable()->change(); }); DB::table('activities') ->where('entity_id', '=', 0) ->update([ 'entity_id' => null, 'entity_type' => null, ]); } /** * Reverse the migrations. */ public function down(): void { DB::table('activities') ->whereNull('entity_id') ->update([ 'entity_id' => 0, 'entity_type' => '', ]); Schema::table('activities', function (Blueprint $table) { $table->renameColumn('type', 'key'); $table->renameColumn('detail', 'extra'); $table->integer('book_id'); $table->integer('entity_id')->change(); $table->string('entity_type', 191)->change(); $table->index('book_id'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_10_18_163331_clean_user_id_references.php
database/migrations/2025_10_18_163331_clean_user_id_references.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { protected static array $toNullify = [ 'attachments' => ['created_by', 'updated_by'], 'comments' => ['created_by', 'updated_by'], 'deletions' => ['deleted_by'], 'entities' => ['created_by', 'updated_by', 'owned_by'], 'images' => ['created_by', 'updated_by'], 'imports' => ['created_by'], 'joint_permissions' => ['owner_id'], 'page_revisions' => ['created_by'], ]; protected static array $toClean = [ 'api_tokens' => ['user_id'], 'email_confirmations' => ['user_id'], 'favourites' => ['user_id'], 'mfa_values' => ['user_id'], 'role_user' => ['user_id'], 'sessions' => ['user_id'], 'social_accounts' => ['user_id'], 'user_invites' => ['user_id'], 'views' => ['user_id'], 'watches' => ['user_id'], ]; /** * Run the migrations. */ public function up(): void { $idSelectQuery = DB::table('users')->select('id'); foreach (self::$toNullify as $tableName => $columns) { Schema::table($tableName, function (Blueprint $table) use ($columns) { foreach ($columns as $columnName) { $table->unsignedInteger($columnName)->nullable()->change(); } }); foreach ($columns as $columnName) { DB::table($tableName)->where($columnName, '=', 0)->update([$columnName => null]); DB::table($tableName)->whereNotIn($columnName, $idSelectQuery)->update([$columnName => null]); } } foreach (self::$toClean as $tableName => $columns) { foreach ($columns as $columnName) { DB::table($tableName)->whereNotIn($columnName, $idSelectQuery)->delete(); } } } /** * Reverse the migrations. */ public function down(): void { foreach (self::$toNullify as $tableName => $columns) { foreach ($columns as $columnName) { DB::table($tableName)->whereNull($columnName)->update([$columnName => 0]); } Schema::table($tableName, function (Blueprint $table) use ($columns) { foreach ($columns as $columnName) { $table->unsignedInteger($columnName)->nullable(false)->change(); } }); } } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2025_09_15_134701_migrate_entity_data.php
database/migrations/2025_09_15_134701_migrate_entity_data.php
<?php use Illuminate\Database\Migrations\Migration; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Start a transaction to avoid leaving a message DB on error DB::beginTransaction(); // Migrate book/shelf data to entities foreach (['books' => 'book', 'bookshelves' => 'bookshelf'] as $table => $type) { DB::table('entities')->insertUsing([ 'id', 'type', 'name', 'slug', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ], DB::table($table)->select([ 'id', DB::raw("'{$type}'"), 'name', 'slug', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ])); } // Migrate chapter data to entities DB::table('entities')->insertUsing([ 'id', 'type', 'name', 'slug', 'book_id', 'priority', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ], DB::table('chapters')->select([ 'id', DB::raw("'chapter'"), 'name', 'slug', 'book_id', 'priority', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ])); DB::table('entities')->insertUsing([ 'id', 'type', 'name', 'slug', 'book_id', 'chapter_id', 'priority', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ], DB::table('pages')->select([ 'id', DB::raw("'page'"), 'name', 'slug', 'book_id', 'chapter_id', 'priority', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'owned_by', ])); // Migrate shelf data to entity_container_data DB::table('entity_container_data')->insertUsing([ 'entity_id', 'entity_type', 'description', 'description_html', 'image_id', ], DB::table('bookshelves')->select([ 'id', DB::raw("'bookshelf'"), 'description', 'description_html', 'image_id', ])); // Migrate book data to entity_container_data DB::table('entity_container_data')->insertUsing([ 'entity_id', 'entity_type', 'description', 'description_html', 'default_template_id', 'image_id', 'sort_rule_id' ], DB::table('books')->select([ 'id', DB::raw("'book'"), 'description', 'description_html', 'default_template_id', 'image_id', 'sort_rule_id' ])); // Migrate chapter data to entity_container_data DB::table('entity_container_data')->insertUsing([ 'entity_id', 'entity_type', 'description', 'description_html', 'default_template_id', ], DB::table('chapters')->select([ 'id', DB::raw("'chapter'"), 'description', 'description_html', 'default_template_id', ])); // Migrate page data to entity_page_data DB::table('entity_page_data')->insertUsing([ 'page_id', 'draft', 'template', 'revision_count', 'editor', 'html', 'text', 'markdown', ], DB::table('pages')->select([ 'id', 'draft', 'template', 'revision_count', 'editor', 'html', 'text', 'markdown', ])); // Fix up data - Convert 0 id references to null DB::table('entities')->where('created_by', '=', 0)->update(['created_by' => null]); DB::table('entities')->where('updated_by', '=', 0)->update(['updated_by' => null]); DB::table('entities')->where('owned_by', '=', 0)->update(['owned_by' => null]); DB::table('entities')->where('chapter_id', '=', 0)->update(['chapter_id' => null]); // Fix up data - Convert any missing id-based references to null $userIdQuery = DB::table('users')->select('id'); DB::table('entities')->whereNotIn('created_by', $userIdQuery)->update(['created_by' => null]); DB::table('entities')->whereNotIn('updated_by', $userIdQuery)->update(['updated_by' => null]); DB::table('entities')->whereNotIn('owned_by', $userIdQuery)->update(['owned_by' => null]); DB::table('entities')->whereNotIn('chapter_id', DB::table('chapters')->select('id'))->update(['chapter_id' => null]); // Commit our changes within our transaction DB::commit(); } /** * Reverse the migrations. */ public function down(): void { // No action here since the actual data remains in the database for the old tables, // so data reversion actions are done in a later migration when the old tables are dropped. } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2017_04_20_185112_add_revision_counts.php
database/migrations/2017_04_20_185112_add_revision_counts.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('pages', function (Blueprint $table) { $table->integer('revision_count'); }); Schema::table('page_revisions', function (Blueprint $table) { $table->integer('revision_number'); $table->index('revision_number'); }); // Update revision count $pTable = DB::getTablePrefix() . 'pages'; $rTable = DB::getTablePrefix() . 'page_revisions'; DB::statement("UPDATE {$pTable} SET {$pTable}.revision_count=(SELECT count(*) FROM {$rTable} WHERE {$rTable}.page_id={$pTable}.id)"); } /** * Reverse the migrations. */ public function down(): void { Schema::table('pages', function (Blueprint $table) { $table->dropColumn('revision_count'); }); Schema::table('page_revisions', function (Blueprint $table) { $table->dropColumn('revision_number'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2015_07_12_190027_create_pages_table.php
database/migrations/2015_07_12_190027_create_pages_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('pages', function (Blueprint $table) { $table->increments('id'); $table->integer('book_id'); $table->integer('chapter_id'); $table->string('name'); $table->string('slug')->indexed(); $table->longText('html'); $table->longText('text'); $table->integer('priority'); $table->nullableTimestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::drop('pages'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2015_11_26_221857_add_entity_indexes.php
database/migrations/2015_11_26_221857_add_entity_indexes.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('books', function (Blueprint $table) { $table->index('slug'); $table->index('created_by'); $table->index('updated_by'); }); Schema::table('pages', function (Blueprint $table) { $table->index('slug'); $table->index('book_id'); $table->index('chapter_id'); $table->index('priority'); $table->index('created_by'); $table->index('updated_by'); }); Schema::table('page_revisions', function (Blueprint $table) { $table->index('page_id'); }); Schema::table('chapters', function (Blueprint $table) { $table->index('slug'); $table->index('book_id'); $table->index('priority'); $table->index('created_by'); $table->index('updated_by'); }); Schema::table('activities', function (Blueprint $table) { $table->index('book_id'); $table->index('user_id'); $table->index('entity_id'); }); Schema::table('views', function (Blueprint $table) { $table->index('user_id'); $table->index('viewable_id'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('books', function (Blueprint $table) { $table->dropIndex('books_slug_index'); $table->dropIndex('books_created_by_index'); $table->dropIndex('books_updated_by_index'); }); Schema::table('pages', function (Blueprint $table) { $table->dropIndex('pages_slug_index'); $table->dropIndex('pages_book_id_index'); $table->dropIndex('pages_chapter_id_index'); $table->dropIndex('pages_priority_index'); $table->dropIndex('pages_created_by_index'); $table->dropIndex('pages_updated_by_index'); }); Schema::table('page_revisions', function (Blueprint $table) { $table->dropIndex('page_revisions_page_id_index'); }); Schema::table('chapters', function (Blueprint $table) { $table->dropIndex('chapters_slug_index'); $table->dropIndex('chapters_book_id_index'); $table->dropIndex('chapters_priority_index'); $table->dropIndex('chapters_created_by_index'); $table->dropIndex('chapters_updated_by_index'); }); Schema::table('activities', function (Blueprint $table) { $table->dropIndex('activities_book_id_index'); $table->dropIndex('activities_user_id_index'); $table->dropIndex('activities_entity_id_index'); }); Schema::table('views', function (Blueprint $table) { $table->dropIndex('views_user_id_index'); $table->dropIndex('views_viewable_id_index'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_02_28_084200_add_entity_access_controls.php
database/migrations/2016_02_28_084200_add_entity_access_controls.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('images', function (Blueprint $table) { $table->integer('uploaded_to')->default(0); $table->index('uploaded_to'); }); Schema::table('books', function (Blueprint $table) { $table->boolean('restricted')->default(false); $table->index('restricted'); }); Schema::table('chapters', function (Blueprint $table) { $table->boolean('restricted')->default(false); $table->index('restricted'); }); Schema::table('pages', function (Blueprint $table) { $table->boolean('restricted')->default(false); $table->index('restricted'); }); Schema::create('restrictions', function (Blueprint $table) { $table->increments('id'); $table->integer('restrictable_id'); $table->string('restrictable_type'); $table->integer('role_id'); $table->string('action'); $table->index('role_id'); $table->index('action'); $table->index(['restrictable_id', 'restrictable_type']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('images', function (Blueprint $table) { $table->dropColumn('uploaded_to'); }); Schema::table('books', function (Blueprint $table) { $table->dropColumn('restricted'); }); Schema::table('chapters', function (Blueprint $table) { $table->dropColumn('restricted'); }); Schema::table('pages', function (Blueprint $table) { $table->dropColumn('restricted'); }); Schema::drop('restrictions'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2015_08_16_142133_create_activities_table.php
database/migrations/2015_08_16_142133_create_activities_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('activities', function (Blueprint $table) { $table->increments('id'); $table->string('key'); $table->text('extra'); $table->integer('book_id')->indexed(); $table->integer('user_id'); $table->integer('entity_id'); $table->string('entity_type'); $table->nullableTimestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::drop('activities'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2020_12_30_173528_add_owned_by_field_to_entities.php
database/migrations/2020_12_30_173528_add_owned_by_field_to_entities.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { $tables = ['pages', 'books', 'chapters', 'bookshelves']; foreach ($tables as $table) { Schema::table($table, function (Blueprint $table) { $table->integer('owned_by')->unsigned()->index(); }); DB::table($table)->update(['owned_by' => DB::raw('`created_by`')]); } Schema::table('joint_permissions', function (Blueprint $table) { $table->renameColumn('created_by', 'owned_by'); }); } /** * Reverse the migrations. */ public function down(): void { $tables = ['pages', 'books', 'chapters', 'bookshelves']; foreach ($tables as $table) { Schema::table($table, function (Blueprint $table) { $table->dropColumn('owned_by'); }); } Schema::table('joint_permissions', function (Blueprint $table) { $table->renameColumn('owned_by', 'created_by'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2015_12_05_145049_fulltext_weighting.php
database/migrations/2015_12_05_145049_fulltext_weighting.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up() { // This was removed for v0.24 since these indexes are removed anyway // and will cause issues for db engines that don't support such indexes. // $prefix = DB::getTablePrefix(); // DB::statement("ALTER TABLE {$prefix}pages ADD FULLTEXT name_search(name)"); // DB::statement("ALTER TABLE {$prefix}books ADD FULLTEXT name_search(name)"); // DB::statement("ALTER TABLE {$prefix}chapters ADD FULLTEXT name_search(name)"); } /** * Reverse the migrations. */ public function down(): void { if (Schema::hasIndex('pages', 'name_search')) { Schema::table('pages', function (Blueprint $table) { $table->dropIndex('name_search'); }); } if (Schema::hasIndex('books', 'name_search')) { Schema::table('books', function (Blueprint $table) { $table->dropIndex('name_search'); }); } if (Schema::hasIndex('chapters', 'name_search')) { Schema::table('chapters', function (Blueprint $table) { $table->dropIndex('name_search'); }); } } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2022_07_16_170051_drop_joint_permission_type.php
database/migrations/2022_07_16_170051_drop_joint_permission_type.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { DB::table('joint_permissions') ->where('action', '!=', 'view') ->delete(); Schema::table('joint_permissions', function (Blueprint $table) { $table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']); $table->dropColumn('action'); $table->primary(['role_id', 'entity_type', 'entity_id'], 'joint_primary'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('joint_permissions', function (Blueprint $table) { $table->string('action'); $table->dropPrimary(['role_id', 'entity_type', 'entity_id']); $table->primary(['role_id', 'entity_type', 'entity_id', 'action']); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2023_02_20_093655_increase_attachments_path_length.php
database/migrations/2023_02_20_093655_increase_attachments_path_length.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('attachments', function (Blueprint $table) { $table->text('path')->change(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('attachments', function (Blueprint $table) { $table->string('path')->change(); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_02_27_120329_update_permissions_and_roles.php
database/migrations/2016_02_27_120329_update_permissions_and_roles.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Get roles with permissions we need to change $adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id; $editorRole = DB::table('roles')->where('name', '=', 'editor')->first(); // Delete old permissions $permissions = DB::table('permissions')->delete(); // Create & attach new admin permissions $permissionsToCreate = [ 'settings-manage' => 'Manage Settings', 'users-manage' => 'Manage Users', 'user-roles-manage' => 'Manage Roles & Permissions', 'restrictions-manage-all' => 'Manage All Entity Permissions', 'restrictions-manage-own' => 'Manage Entity Permissions On Own Content', ]; foreach ($permissionsToCreate as $name => $displayName) { $permissionId = DB::table('permissions')->insertGetId([ 'name' => $name, 'display_name' => $displayName, 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } // Create & attach new entity permissions $entities = ['Book', 'Page', 'Chapter', 'Image']; $ops = ['Create All', 'Create Own', 'Update All', 'Update Own', 'Delete All', 'Delete Own']; foreach ($entities as $entity) { foreach ($ops as $op) { $permissionId = DB::table('permissions')->insertGetId([ 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'display_name' => $op . ' ' . $entity . 's', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); if ($editorRole !== null) { DB::table('permission_role')->insert([ 'role_id' => $editorRole->id, 'permission_id' => $permissionId, ]); } } } } /** * Reverse the migrations. */ public function down(): void { // Get roles with permissions we need to change $adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id; // Delete old permissions $permissions = DB::table('permissions')->delete(); // Create default CRUD permissions and allocate to admins and editors $entities = ['Book', 'Page', 'Chapter', 'Image']; $ops = ['Create', 'Update', 'Delete']; foreach ($entities as $entity) { foreach ($ops as $op) { $permissionId = DB::table('permissions')->insertGetId([ 'name' => strtolower($entity) . '-' . strtolower($op), 'display_name' => $op . ' ' . $entity . 's', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } } // Create admin permissions $entities = ['Settings', 'User']; $ops = ['Create', 'Update', 'Delete']; foreach ($entities as $entity) { foreach ($ops as $op) { $permissionId = DB::table('permissions')->insertGetId([ 'name' => strtolower($entity) . '-' . strtolower($op), 'display_name' => $op . ' ' . $entity, 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } } } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2024_05_04_154409_rename_activity_relation_columns.php
database/migrations/2024_05_04_154409_rename_activity_relation_columns.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('activities', function (Blueprint $table) { $table->renameColumn('entity_id', 'loggable_id'); $table->renameColumn('entity_type', 'loggable_type'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('activities', function (Blueprint $table) { $table->renameColumn('loggable_id', 'entity_id'); $table->renameColumn('loggable_type', 'entity_type'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2023_12_02_104541_add_default_template_to_books.php
database/migrations/2023_12_02_104541_add_default_template_to_books.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddDefaultTemplateToBooks extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('books', function (Blueprint $table) { $table->integer('default_template_id')->nullable()->default(null); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('books', function (Blueprint $table) { $table->dropColumn('default_template_id'); }); } }
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_11_26_070438_add_index_for_user_ip.php
database/migrations/2021_11_26_070438_add_index_for_user_ip.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('activities', function (Blueprint $table) { $table->index('ip', 'activities_ip_index'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('activities', function (Blueprint $table) { $table->dropIndex('activities_ip_index'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_02_25_184030_add_slug_to_revisions.php
database/migrations/2016_02_25_184030_add_slug_to_revisions.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('page_revisions', function (Blueprint $table) { $table->string('slug'); $table->index('slug'); $table->string('book_slug'); $table->index('book_slug'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('page_revisions', function (Blueprint $table) { $table->dropColumn('slug'); $table->dropColumn('book_slug'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_10_09_142037_create_attachments_table.php
database/migrations/2016_10_09_142037_create_attachments_table.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('attachments', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('path'); $table->string('extension', 20); $table->integer('uploaded_to'); $table->boolean('external'); $table->integer('order'); $table->integer('created_by'); $table->integer('updated_by'); $table->index('uploaded_to'); $table->timestamps(); }); // Get roles with permissions we need to change $adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id; // Create & attach new entity permissions $ops = ['Create All', 'Create Own', 'Update All', 'Update Own', 'Delete All', 'Delete Own']; $entity = 'Attachment'; foreach ($ops as $op) { $permissionId = DB::table('role_permissions')->insertGetId([ 'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'display_name' => $op . ' ' . $entity . 's', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); DB::table('permission_role')->insert([ 'role_id' => $adminRoleId, 'permission_id' => $permissionId, ]); } } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('attachments'); // Create & attach new entity permissions $ops = ['Create All', 'Create Own', 'Update All', 'Update Own', 'Delete All', 'Delete Own']; $entity = 'Attachment'; foreach ($ops as $op) { $permName = strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)); DB::table('role_permissions')->where('name', '=', $permName)->delete(); } } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2016_09_29_101449_remove_hidden_roles.php
database/migrations/2016_09_29_101449_remove_hidden_roles.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Remove the hidden property from roles Schema::table('roles', function (Blueprint $table) { $table->dropColumn('hidden'); }); // Add column to mark system users Schema::table('users', function (Blueprint $table) { $table->string('system_name')->nullable()->index(); }); // Insert our new public system user. $publicUserId = DB::table('users')->insertGetId([ 'email' => 'guest@example.com', 'name' => 'Guest', 'system_name' => 'public', 'email_confirmed' => true, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); // Get the public role $publicRole = DB::table('roles')->where('system_name', '=', 'public')->first(); // Connect the new public user to the public role DB::table('role_user')->insert([ 'user_id' => $publicUserId, 'role_id' => $publicRole->id, ]); } /** * Reverse the migrations. */ public function down(): void { Schema::table('roles', function (Blueprint $table) { $table->boolean('hidden')->default(false); $table->index('hidden'); }); DB::table('users')->where('system_name', '=', 'public')->delete(); Schema::table('users', function (Blueprint $table) { $table->dropColumn('system_name'); }); DB::table('roles')->where('system_name', '=', 'public')->update(['hidden' => true]); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2019_08_17_140214_add_user_invites_table.php
database/migrations/2019_08_17_140214_add_user_invites_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('user_invites', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->index(); $table->string('token')->index(); $table->nullableTimestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('user_invites'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2017_03_19_091553_create_search_index_table.php
database/migrations/2017_03_19_091553_create_search_index_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('search_terms', function (Blueprint $table) { $table->increments('id'); $table->string('term', 180); $table->string('entity_type', 100); $table->integer('entity_id'); $table->integer('score'); $table->index('term'); $table->index('entity_type'); $table->index(['entity_type', 'entity_id']); $table->index('score'); }); if (Schema::hasIndex('pages', 'search')) { Schema::table('pages', function (Blueprint $table) { $table->dropIndex('search'); $table->dropIndex('name_search'); }); } if (Schema::hasIndex('books', 'search')) { Schema::table('books', function (Blueprint $table) { $table->dropIndex('search'); $table->dropIndex('name_search'); }); } if (Schema::hasIndex('chapters', 'search')) { Schema::table('chapters', function (Blueprint $table) { $table->dropIndex('search'); $table->dropIndex('name_search'); }); } } /** * Reverse the migrations. */ public function down(): void { // This was removed for v0.24 since these indexes are removed anyway // and will cause issues for db engines that don't support such indexes. // $prefix = DB::getTablePrefix(); // DB::statement("ALTER TABLE {$prefix}pages ADD FULLTEXT search(name, text)"); // DB::statement("ALTER TABLE {$prefix}books ADD FULLTEXT search(name, description)"); // DB::statement("ALTER TABLE {$prefix}chapters ADD FULLTEXT search(name, description)"); // DB::statement("ALTER TABLE {$prefix}pages ADD FULLTEXT name_search(name)"); // DB::statement("ALTER TABLE {$prefix}books ADD FULLTEXT name_search(name)"); // DB::statement("ALTER TABLE {$prefix}chapters ADD FULLTEXT name_search(name)"); Schema::dropIfExists('search_terms'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2023_06_10_071823_remove_guest_user_secondary_roles.php
database/migrations/2023_06_10_071823_remove_guest_user_secondary_roles.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { $guestUserId = DB::table('users') ->where('system_name', '=', 'public') ->first(['id'])->id; $publicRoleId = DB::table('roles') ->where('system_name', '=', 'public') ->first(['id'])->id; // This migration deletes secondary "Guest" user role assignments // as a safety precaution upon upgrade since the logic is changing // within the release this is introduced in, which could result in wider // permissions being provided upon upgrade without this intervention. // Previously, added roles would only partially apply their permissions // since some permission checks would only consider the originally assigned // public role, and not added roles. Within this release, additional roles // will fully apply. DB::table('role_user') ->where('user_id', '=', $guestUserId) ->where('role_id', '!=', $publicRoleId) ->delete(); } /** * Reverse the migrations. */ public function down() { // No structural changes to make, and we cannot know the role ids to re-assign. } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2024_10_29_114420_add_import_role_permission.php
database/migrations/2024_10_29_114420_add_import_role_permission.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Create new content-import permission $permissionId = DB::table('role_permissions')->insertGetId([ 'name' => 'content-import', 'display_name' => 'Import Content', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); // Get existing admin-level role ids $settingManagePermission = DB::table('role_permissions') ->where('name', '=', 'settings-manage')->first(); if (!$settingManagePermission) { return; } $adminRoleIds = DB::table('permission_role') ->where('permission_id', '=', $settingManagePermission->id) ->pluck('role_id')->all(); // Assign the new permission to all existing admins $newPermissionRoles = array_values(array_map(function ($roleId) use ($permissionId) { return [ 'role_id' => $roleId, 'permission_id' => $permissionId, ]; }, $adminRoleIds)); DB::table('permission_role')->insert($newPermissionRoles); } /** * Reverse the migrations. */ public function down(): void { // Remove content-import permission $importPermission = DB::table('role_permissions') ->where('name', '=', 'content-import')->first(); if (!$importPermission) { return; } DB::table('permission_role')->where('permission_id', '=', $importPermission->id)->delete(); DB::table('role_permissions')->where('id', '=', $importPermission->id)->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_08_28_161743_add_export_role_permission.php
database/migrations/2021_08_28_161743_add_export_role_permission.php
<?php use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Create new content-export permission $permissionId = DB::table('role_permissions')->insertGetId([ 'name' => 'content-export', 'display_name' => 'Export Content', 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), ]); $roles = DB::table('roles')->get('id'); $permissionRoles = $roles->map(function ($role) use ($permissionId) { return [ 'role_id' => $role->id, 'permission_id' => $permissionId, ]; })->values()->toArray(); // Assign to all existing roles in the system DB::table('permission_role')->insert($permissionRoles); } /** * Reverse the migrations. */ public function down(): void { // Remove content-export permission $contentExportPermission = DB::table('role_permissions') ->where('name', '=', 'content-export')->first(); DB::table('permission_role')->where('permission_id', '=', $contentExportPermission->id)->delete(); DB::table('role_permissions')->where('id', '=', $contentExportPermission->id)->delete(); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_12_13_152120_create_failed_jobs_table.php
database/migrations/2021_12_13_152120_create_failed_jobs_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); $table->string('uuid')->unique(); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->longText('exception'); $table->timestamp('failed_at')->useCurrent(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('failed_jobs'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2017_01_21_163602_create_sessions_table.php
database/migrations/2017_01_21_163602_create_sessions_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('sessions', function (Blueprint $table) { $table->string('id')->unique(); $table->integer('user_id')->nullable(); $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); $table->text('payload'); $table->integer('last_activity'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('sessions'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2024_11_02_160700_create_imports_table.php
database/migrations/2024_11_02_160700_create_imports_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('imports', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('path'); $table->integer('size'); $table->string('type'); $table->longText('metadata'); $table->integer('created_by')->index(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('imports'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2021_06_30_173111_create_mfa_values_table.php
database/migrations/2021_06_30_173111_create_mfa_values_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('mfa_values', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->index(); $table->string('method', 20)->index(); $table->text('value'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('mfa_values'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2022_10_07_091406_flatten_entity_permissions_table.php
database/migrations/2022_10_07_091406_flatten_entity_permissions_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Query\Builder; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { // Remove entries for non-existing roles (Caused by previous lack of deletion handling) $roleIds = DB::table('roles')->pluck('id'); DB::table('entity_permissions')->whereNotIn('role_id', $roleIds)->delete(); // Create new table structure for entity_permissions Schema::create('new_entity_permissions', function (Blueprint $table) { $table->id(); $table->unsignedInteger('entity_id'); $table->string('entity_type', 25); $table->unsignedInteger('role_id')->index(); $table->boolean('view')->default(0); $table->boolean('create')->default(0); $table->boolean('update')->default(0); $table->boolean('delete')->default(0); $table->index(['entity_id', 'entity_type']); }); // Migrate existing entity_permission data into new table structure $subSelect = function (Builder $query, string $action, string $subAlias) { $sub = $query->newQuery()->select('action')->from('entity_permissions', $subAlias) ->whereColumn('a.restrictable_id', '=', $subAlias . '.restrictable_id') ->whereColumn('a.restrictable_type', '=', $subAlias . '.restrictable_type') ->whereColumn('a.role_id', '=', $subAlias . '.role_id') ->where($subAlias . '.action', '=', $action); return $query->selectRaw("EXISTS({$sub->toSql()})", $sub->getBindings()); }; $query = DB::table('entity_permissions', 'a')->select([ 'restrictable_id as entity_id', 'restrictable_type as entity_type', 'role_id', 'view' => fn(Builder $query) => $subSelect($query, 'view', 'b'), 'create' => fn(Builder $query) => $subSelect($query, 'create', 'c'), 'update' => fn(Builder $query) => $subSelect($query, 'update', 'd'), 'delete' => fn(Builder $query) => $subSelect($query, 'delete', 'e'), ])->groupBy('restrictable_id', 'restrictable_type', 'role_id'); DB::table('new_entity_permissions')->insertUsing(['entity_id', 'entity_type', 'role_id', 'view', 'create', 'update', 'delete'], $query); // Drop old entity_permissions table and replace with new structure Schema::dropIfExists('entity_permissions'); Schema::rename('new_entity_permissions', 'entity_permissions'); } /** * Reverse the migrations. */ public function down(): void { // Create old table structure for entity_permissions Schema::create('old_entity_permissions', function (Blueprint $table) { $table->increments('id'); $table->integer('restrictable_id'); $table->string('restrictable_type', 191); $table->integer('role_id')->index(); $table->string('action', 191)->index(); $table->index(['restrictable_id', 'restrictable_type']); }); // Convert newer data format to old data format, and insert into old database $actionQuery = function (Builder $query, string $action) { return $query->select([ 'entity_id as restrictable_id', 'entity_type as restrictable_type', 'role_id', ])->selectRaw("? as action", [$action]) ->from('entity_permissions') ->where($action, '=', true); }; $query = $actionQuery(DB::query(), 'view') ->union(fn(Builder $query) => $actionQuery($query, 'create')) ->union(fn(Builder $query) => $actionQuery($query, 'update')) ->union(fn(Builder $query) => $actionQuery($query, 'delete')); DB::table('old_entity_permissions')->insertUsing(['restrictable_id', 'restrictable_type', 'role_id', 'action'], $query); // Drop new entity_permissions table and replace with old structure Schema::dropIfExists('entity_permissions'); Schema::rename('old_entity_permissions', 'entity_permissions'); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/migrations/2018_07_15_173514_add_role_external_auth_id.php
database/migrations/2018_07_15_173514_add_role_external_auth_id.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::table('roles', function (Blueprint $table) { $table->string('external_auth_id', 180)->default(''); $table->index('external_auth_id'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('roles', function (Blueprint $table) { $table->dropColumn('external_auth_id'); }); } };
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/seeders/LargeContentSeeder.php
database/seeders/LargeContentSeeder.php
<?php namespace Database\Seeders; use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Page; use BookStack\Permissions\JointPermissionBuilder; use BookStack\Search\SearchIndex; use BookStack\Users\Models\Role; use BookStack\Users\Models\User; use Illuminate\Database\Seeder; use Illuminate\Support\Str; class LargeContentSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // Create an editor user $editorUser = User::factory()->create(); $editorRole = Role::getRole('editor'); $editorUser->attachRole($editorRole); /** @var Book $largeBook */ $largeBook = Book::factory()->create(['name' => 'Large book' . Str::random(10), 'created_by' => $editorUser->id, 'updated_by' => $editorUser->id]); $chapters = Chapter::factory()->count(50)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id]); $largeBook->chapters()->saveMany($chapters); $allPages = []; foreach ($chapters as $chapter) { $pages = Page::factory()->count(100)->make(['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'chapter_id' => $chapter->id]); $largeBook->pages()->saveMany($pages); array_push($allPages, ...$pages->all()); } $all = array_merge([$largeBook], $allPages, array_values($chapters->all())); app()->make(JointPermissionBuilder::class)->rebuildForEntity($largeBook); app()->make(SearchIndex::class)->indexEntities($all); } }
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/seeders/DatabaseSeeder.php
database/seeders/DatabaseSeeder.php
<?php namespace Database\Seeders; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run() { Model::unguard(); // $this->call(UserTableSeeder::class); Model::reguard(); } }
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/database/seeders/DummyContentSeeder.php
database/seeders/DummyContentSeeder.php
<?php namespace Database\Seeders; use BookStack\Api\ApiToken; use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Bookshelf; use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Page; use BookStack\Permissions\JointPermissionBuilder; use BookStack\Permissions\Models\RolePermission; use BookStack\Search\SearchIndex; use BookStack\Users\Models\Role; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Seeder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; class DummyContentSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { // Create an editor user $editorUser = User::factory()->create(); $editorRole = Role::getRole('editor'); $additionalEditorPerms = ['receive-notifications', 'comment-create-all']; $editorRole->permissions()->syncWithoutDetaching(RolePermission::whereIn('name', $additionalEditorPerms)->pluck('id')); $editorUser->attachRole($editorRole); // Create a viewer user $viewerUser = User::factory()->create(); $role = Role::getRole('viewer'); $viewerUser->attachRole($role); $byData = ['created_by' => $editorUser->id, 'updated_by' => $editorUser->id, 'owned_by' => $editorUser->id]; Book::factory()->count(5)->make($byData) ->each(function ($book) use ($byData) { $book->save(); $chapters = Chapter::factory()->count(3)->create($byData) ->each(function ($chapter) use ($book, $byData) { $pages = Page::factory()->count(3)->make(array_merge($byData, ['book_id' => $book->id])); $this->saveManyOnRelation($pages, $chapter->pages()); }); $pages = Page::factory()->count(3)->make($byData); $this->saveManyOnRelation($chapters, $book->chapters()); $this->saveManyOnRelation($pages, $book->pages()); }); $largeBook = Book::factory()->make(array_merge($byData, ['name' => 'Large book' . Str::random(10)])); $largeBook->save(); $pages = Page::factory()->count(200)->make($byData); $chapters = Chapter::factory()->count(50)->make($byData); $this->saveManyOnRelation($pages, $largeBook->pages()); $this->saveManyOnRelation($chapters, $largeBook->chapters()); $shelves = Bookshelf::factory()->count(10)->make($byData); foreach ($shelves as $shelf) { $shelf->save(); } $largeBook->shelves()->attach($shelves->pluck('id')); // Assign API permission to editor role and create an API key $apiPermission = RolePermission::getByName('access-api'); $editorRole->attachPermission($apiPermission); $token = (new ApiToken())->forceFill([ 'user_id' => $editorUser->id, 'name' => 'Testing API key', 'expires_at' => ApiToken::defaultExpiry(), 'secret' => Hash::make('password'), 'token_id' => 'apitoken', ]); $token->save(); app(JointPermissionBuilder::class)->rebuildForAll(); app(SearchIndex::class)->indexAllEntities(); } /** * Inefficient workaround for saving many on a relation since we can't directly insert * entities since we split them across tables. */ protected function saveManyOnRelation(Collection $entities, HasMany $relation): void { foreach ($entities as $entity) { $relation->save($entity); } } }
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/backup-codes-generate.blade.php
resources/views/mfa/backup-codes-generate.blade.php
@extends('layouts.simple') @section('body') <div class="container very-small py-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.mfa_gen_backup_codes_title') }}</h1> <p>{{ trans('auth.mfa_gen_backup_codes_desc') }}</p> <div class="text-center mb-xs"> <div class="text-bigger code-base p-m" style="column-count: 2"> @foreach($codes as $code) {{ $code }} <br> @endforeach </div> </div> <p class="text-right"> <a href="{{ $downloadUrl }}" download="backup-codes.txt" class="button outline small">{{ trans('auth.mfa_gen_backup_codes_download') }}</a> </p> <p class="callout warning"> {{ trans('auth.mfa_gen_backup_codes_usage_warning') }} </p> <form action="{{ url('/mfa/backup_codes/confirm') }}" method="POST"> {{ csrf_field() }} <div class="mt-s text-right"> <a href="{{ url('/mfa/setup') }}" class="button outline">{{ trans('common.cancel') }}</a> <button class="button">{{ trans('auth.mfa_gen_confirm_and_enable') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/verify.blade.php
resources/views/mfa/verify.blade.php
@extends('layouts.simple') @section('body') <div class="container very-small py-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.mfa_verify_access') }}</h1> <p class="mb-none">{{ trans('auth.mfa_verify_access_desc') }}</p> @if(!$method) <hr class="my-l"> <h5>{{ trans('auth.mfa_verify_no_methods') }}</h5> <p class="small">{{ trans('auth.mfa_verify_no_methods_desc') }}</p> <div> <a href="{{ url('/mfa/setup') }}" class="button outline">{{ trans('common.configure') }}</a> </div> @endif @if($method) <hr class="my-l"> @include('mfa.parts.verify-' . $method) @endif @if(count($otherMethods) > 0) <hr class="my-l"> @foreach($otherMethods as $otherMethod) <div class="text-center"> <a href="{{ url("/mfa/verify?method={$otherMethod}") }}">{{ trans('auth.mfa_verify_use_' . $otherMethod) }}</a> </div> @endforeach @endif </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/totp-generate.blade.php
resources/views/mfa/totp-generate.blade.php
@extends('layouts.simple') @section('body') <div class="container very-small py-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.mfa_gen_totp_title') }}</h1> <p>{{ trans('auth.mfa_gen_totp_desc') }}</p> <p>{{ trans('auth.mfa_gen_totp_scan') }}</p> <div class="text-center"> <div class="block inline"> {!! $svg !!} </div> <div class="code-base small text-muted px-s py-xs my-xs" style="overflow-x: scroll; white-space: nowrap;"> {{ $url }} </div> </div> <h2 class="list-heading">{{ trans('auth.mfa_gen_totp_verify_setup') }}</h2> <p id="totp-verify-input-details" class="mb-s">{{ trans('auth.mfa_gen_totp_verify_setup_desc') }}</p> <form action="{{ url('/mfa/totp/confirm') }}" method="POST"> {{ csrf_field() }} <input type="text" name="code" aria-labelledby="totp-verify-input-details" placeholder="{{ trans('auth.mfa_gen_totp_provide_code_here') }}" class="input-fill-width {{ $errors->has('code') ? 'neg' : '' }}"> @if($errors->has('code')) <div class="text-neg text-small px-xs">{{ $errors->first('code') }}</div> @endif <div class="mt-s text-right"> <a href="{{ url('/mfa/setup') }}" class="button outline">{{ trans('common.cancel') }}</a> <button class="button">{{ trans('auth.mfa_gen_confirm_and_enable') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/setup.blade.php
resources/views/mfa/setup.blade.php
@extends('layouts.simple') @section('body') <div class="container small py-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.mfa_setup') }}</h1> <p class="mb-none"> {{ trans('auth.mfa_setup_desc') }}</p> <div class="setting-list"> @foreach(['totp', 'backup_codes'] as $method) @include('mfa.parts.setup-method-row', ['method' => $method]) @endforeach </div> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/parts/verify-totp.blade.php
resources/views/mfa/parts/verify-totp.blade.php
<div class="setting-list-label">{{ trans('auth.mfa_option_totp_title') }}</div> <p class="small mb-m">{{ trans('auth.mfa_verify_totp_desc') }}</p> <form action="{{ url('/mfa/totp/verify') }}" method="post" autocomplete="off"> {{ csrf_field() }} <input type="text" name="code" autocomplete="one-time-code" autofocus placeholder="{{ trans('auth.mfa_gen_totp_provide_code_here') }}" class="input-fill-width {{ $errors->has('code') ? 'neg' : '' }}"> @if($errors->has('code')) <div class="text-neg text-small px-xs">{{ $errors->first('code') }}</div> @endif <div class="mt-s text-right"> <button class="button">{{ trans('common.confirm') }}</button> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/parts/verify-backup_codes.blade.php
resources/views/mfa/parts/verify-backup_codes.blade.php
<div class="setting-list-label">{{ trans('auth.mfa_verify_backup_code') }}</div> <p class="small mb-m">{{ trans('auth.mfa_verify_backup_code_desc') }}</p> <form action="{{ url('/mfa/backup_codes/verify') }}" method="post" autocomplete="off"> {{ csrf_field() }} <input type="text" name="code" autocomplete="one-time-code" placeholder="{{ trans('auth.mfa_verify_backup_code_enter_here') }}" class="input-fill-width {{ $errors->has('code') ? 'neg' : '' }}"> @if($errors->has('code')) <div class="text-neg text-small px-xs">{{ $errors->first('code') }}</div> @endif <div class="mt-s text-right"> <button class="button">{{ trans('common.confirm') }}</button> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/mfa/parts/setup-method-row.blade.php
resources/views/mfa/parts/setup-method-row.blade.php
<div class="grid half gap-xl"> <div> <div class="setting-list-label">{{ trans('auth.mfa_option_' . $method . '_title') }}</div> <p class="small"> {{ trans('auth.mfa_option_' . $method . '_desc') }} </p> </div> <div class="pt-m"> @if($userMethods->has($method)) <div class="text-pos"> @icon('check-circle') {{ trans('auth.mfa_setup_configured') }} </div> <a href="{{ url('/mfa/' . $method . '/generate') }}" class="button outline small">{{ trans('auth.mfa_setup_reconfigure') }}</a> <div component="dropdown" class="inline relative"> <button type="button" refs="dropdown@toggle" class="button outline small">{{ trans('common.remove') }}</button> <div refs="dropdown@menu" class="dropdown-menu"> <p class="text-neg small px-m mb-xs">{{ trans('auth.mfa_setup_remove_confirmation') }}</p> <form action="{{ url('/mfa/' . $method . '/remove') }}" method="post"> {{ csrf_field() }} {{ method_field('delete') }} <button class="text-link small text-item">{{ trans('common.confirm') }}</button> </form> </div> </div> @else <a href="{{ url('/mfa/' . $method . '/generate') }}" class="button outline">{{ trans('auth.mfa_setup_action') }}</a> @endif </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/misc/opensearch.blade.php
resources/views/misc/opensearch.blade.php
@php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; @endphp <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>{{ mb_strimwidth(setting('app-name'), 0, 16) }}</ShortName> <Description>{{ trans('common.opensearch_description', ['appName' => setting('app-name')]) }}</Description> <Image width="256" height="256" type="image/png">{{ setting('app-icon') ?: url('/icon.png') }}</Image> <Image width="180" height="180" type="image/png">{{ setting('app-icon-180') ?: url('/icon-180.png') }}</Image> <Image width="128" height="128" type="image/png">{{ setting('app-icon-128') ?: url('/icon-128.png') }}</Image> <Image width="64" height="64" type="image/png">{{ setting('app-icon-64') ?: url('/icon-64.png') }}</Image> <Image width="32" height="32" type="image/png">{{ setting('app-icon-32') ?: url('/icon-32.png') }}</Image> <Url type="text/html" rel="results" template="{{ url('/search') }}?term={searchTerms}"/> <Url type="application/opensearchdescription+xml" rel="self" template="{{ url('/opensearch.xml') }}"/> </OpenSearchDescription>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/misc/robots.blade.php
resources/views/misc/robots.blade.php
User-agent: * @if($allowRobots) Disallow: @else Disallow: / @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/login.blade.php
resources/views/auth/login.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small"> <div class="my-l">&nbsp;</div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ Str::title(trans('auth.log_in')) }}</h1> @include('auth.parts.login-message') @include('auth.parts.login-form-' . $authMethod) @if(count($socialDrivers) > 0) <hr class="my-l"> @foreach($socialDrivers as $driver => $name) <div> <a id="social-login-{{$driver}}" class="button outline svg" href="{{ url("/login/service/" . $driver) }}"> @icon('auth/' . $driver) <span>{{ trans('auth.log_in_with', ['socialDriver' => $name]) }}</span> </a> </div> @endforeach @endif @if(setting('registration-enabled') && config('auth.method') === 'standard') <div class="text-center pb-s"> <hr class="my-l"> <a href="{{ url('/register') }}">{{ trans('auth.dont_have_account') }}</a> </div> @endif </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/register.blade.php
resources/views/auth/register.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small"> <div class="my-l">&nbsp;</div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ Str::title(trans('auth.sign_up')) }}</h1> @include('auth.parts.register-message') <form action="{{ url("/register") }}" method="POST" class="mt-l stretch-inputs"> {!! csrf_field() !!} {{-- Simple honeypot field --}} <div class="form-group ambrosia-container" aria-hidden="true"> <label for="username">{{ trans('auth.name') }}</label> @include('form.text', ['name' => 'username']) </div> <div class="form-group"> <label for="name">{{ trans('auth.name') }}</label> @include('form.text', ['name' => 'name']) </div> <div class="form-group"> <label for="email">{{ trans('auth.email') }}</label> @include('form.text', ['name' => 'email']) </div> <div class="form-group"> <label for="password">{{ trans('auth.password') }}</label> @include('form.password', ['name' => 'password', 'placeholder' => trans('auth.password_hint')]) </div> <div class="grid half collapse-xs gap-xl v-center mt-m"> <div class="text-small"> <a href="{{ url('/login') }}">{{ trans('auth.already_have_account') }}</a> </div> <div class="from-group text-right"> <button class="button">{{ trans('auth.create_account') }}</button> </div> </div> </form> @if(count($socialDrivers) > 0) <hr class="my-l"> @foreach($socialDrivers as $driver => $name) <div> <a id="social-register-{{$driver}}" class="button outline svg" href="{{ url("/register/service/" . $driver) }}"> @icon('auth/' . $driver) <span>{{ trans('auth.sign_up_with', ['socialDriver' => $name]) }}</span> </a> </div> @endforeach @endif </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/login-initiate.blade.php
resources/views/auth/login-initiate.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small"> <div class="my-l">&nbsp;</div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.auto_init_starting') }}</h1> <div style="display:none"> @include('auth.parts.login-form-' . $authMethod) </div> <div class="grid half left-focus"> <div> <p class="text-small">{{ trans('auth.auto_init_starting_desc') }}</p> <p> <button type="submit" form="login-form" class="p-none text-button hover-underline"> {{ trans('auth.auto_init_start_link') }} </button> </p> </div> <div class="text-center"> @include('common.loading-icon') </div> </div> <script nonce="{{ $cspNonce }}"> window.addEventListener('load', () => document.forms['login-form'].submit()); </script> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/register-confirm.blade.php
resources/views/auth/register-confirm.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.register_thanks') }}</h1> <p>{{ trans('auth.register_confirm', ['appName' => setting('app-name')]) }}</p> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/register-confirm-awaiting.blade.php
resources/views/auth/register-confirm-awaiting.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.email_not_confirmed') }}</h1> <p>{{ trans('auth.email_not_confirmed_text') }}<br> {{ trans('auth.email_not_confirmed_click_link') }} </p> <p> {{ trans('auth.email_not_confirmed_resend') }} </p> <form action="{{ url("/register/confirm/resend") }}" method="POST" class="stretch-inputs"> {{ csrf_field() }} <div class="form-group text-right mt-m"> <button type="submit" class="button">{{ trans('auth.email_not_confirmed_resend_button') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/invite-set-password.blade.php
resources/views/auth/invite-set-password.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.user_invite_page_welcome', ['appName' => setting('app-name')]) }}</h1> <p>{{ trans('auth.user_invite_page_text', ['appName' => setting('app-name')]) }}</p> <form action="{{ url('/register/invite/' . $token) }}" method="POST" class="stretch-inputs"> {!! csrf_field() !!} <div class="form-group"> <label for="password">{{ trans('auth.password') }}</label> @include('form.password', ['name' => 'password', 'placeholder' => trans('auth.password_hint')]) </div> <div class="text-right"> <button class="button">{{ trans('auth.user_invite_page_confirm_button') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/register-confirm-accept.blade.php
resources/views/auth/register-confirm-accept.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.email_confirm_thanks') }}</h1> <p class="mb-none">{{ trans('auth.email_confirm_thanks_desc') }}</p> <div class="flex-container-row items-center wrap"> <div class="flex min-width-s"> @include('common.loading-icon') </div> <div class="flex min-width-s text-s-right"> <form component="auto-submit" action="{{ url('/register/confirm/accept') }}" method="post"> {{ csrf_field() }} <input type="hidden" name="token" value="{{ $token }}"> <button class="text-button">{{ trans('common.continue') }}</button> </form> </div> </div> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/passwords/email.blade.php
resources/views/auth/passwords/email.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.reset_password') }}</h1> <p class="text-muted small">{{ trans('auth.reset_password_send_instructions') }}</p> <form action="{{ url("/password/email") }}" method="POST" class="stretch-inputs"> {!! csrf_field() !!} <div class="form-group"> <label for="email">{{ trans('auth.email') }}</label> @include('form.text', ['name' => 'email']) </div> <div class="from-group text-right mt-m"> <button class="button">{{ trans('auth.reset_password_send_button') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/passwords/reset.blade.php
resources/views/auth/passwords/reset.blade.php
@extends('layouts.simple') @section('content') <div class="container very-small mt-xl"> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('auth.reset_password') }}</h1> <form action="{{ url("/password/reset") }}" method="POST" class="stretch-inputs"> {!! csrf_field() !!} <input type="hidden" name="token" value="{{ $token }}"> <div class="form-group"> <label for="email">{{ trans('auth.email') }}</label> @include('form.text', ['name' => 'email']) </div> <div class="form-group"> <label for="password">{{ trans('auth.password') }}</label> @include('form.password', ['name' => 'password']) </div> <div class="form-group"> <label for="password_confirmation">{{ trans('auth.password_confirm') }}</label> @include('form.password', ['name' => 'password_confirmation']) </div> <div class="from-group text-right mt-m"> <button class="button">{{ trans('auth.reset_password') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/login-message.blade.php
resources/views/auth/parts/login-message.blade.php
{{-- This is a placeholder template file provided as a --}} {{-- convenience to users of the visual theme system. --}}
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/login-form-ldap.blade.php
resources/views/auth/parts/login-form-ldap.blade.php
<form action="{{ url('/login') }}" method="POST" id="login-form" class="mt-l"> {!! csrf_field() !!} <div class="stretch-inputs"> <div class="form-group"> <label for="username">{{ trans('auth.username') }}</label> @include('form.text', ['name' => 'username', 'autofocus' => true]) </div> @if(session('request-email', false) === true) <div class="form-group"> <label for="email">{{ trans('auth.email') }}</label> @include('form.text', ['name' => 'email']) <span class="text-neg">{{ trans('auth.ldap_email_hint') }}</span> </div> @endif <div class="form-group"> <label for="password">{{ trans('auth.password') }}</label> @include('form.password', ['name' => 'password']) </div> <div class="form-group text-right pt-s"> <button class="button">{{ Str::title(trans('auth.log_in')) }}</button> </div> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/login-form-oidc.blade.php
resources/views/auth/parts/login-form-oidc.blade.php
<form action="{{ url('/oidc/login') }}" method="POST" id="login-form" class="mt-l"> {!! csrf_field() !!} <div> <button id="oidc-login" class="button outline svg"> @icon('oidc') <span>{{ trans('auth.log_in_with', ['socialDriver' => config('oidc.name')]) }}</span> </button> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/login-form-saml2.blade.php
resources/views/auth/parts/login-form-saml2.blade.php
<form action="{{ url('/saml2/login') }}" method="POST" id="login-form" class="mt-l"> {!! csrf_field() !!} <div> <button id="saml-login" class="button outline svg"> @icon('saml2') <span>{{ trans('auth.log_in_with', ['socialDriver' => config('saml2.name')]) }}</span> </button> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/register-message.blade.php
resources/views/auth/parts/register-message.blade.php
{{-- This is a placeholder template file provided as a --}} {{-- convenience to users of the visual theme system. --}}
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/auth/parts/login-form-standard.blade.php
resources/views/auth/parts/login-form-standard.blade.php
<form action="{{ url('/login') }}" method="POST" id="login-form" class="mt-l"> {!! csrf_field() !!} <div class="stretch-inputs"> <div class="form-group"> <label for="email">{{ trans('auth.email') }}</label> @include('form.text', ['name' => 'email', 'autofocus' => true]) </div> <div class="form-group"> <label for="password">{{ trans('auth.password') }}</label> @include('form.password', ['name' => 'password']) <div class="small mt-s"> <a href="{{ url('/password/email') }}">{{ trans('auth.forgot_password') }}</a> </div> </div> </div> <div class="grid half collapse-xs gap-xl v-center"> <div class="text-left ml-xxs"> @include('form.custom-checkbox', [ 'name' => 'remember', 'checked' => false, 'value' => 'on', 'label' => trans('auth.remember_me'), ]) </div> <div class="text-right"> <button class="button">{{ Str::title(trans('auth.log_in')) }}</button> </div> </div> </form>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/book.blade.php
resources/views/exports/book.blade.php
@extends('layouts.export') @section('title', $book->name) @section('content') <h1 style="font-size: 4.8em">{{$book->name}}</h1> <div>{!! $book->descriptionInfo()->getHtml() !!}</div> @include('exports.parts.book-contents-menu', ['children' => $bookChildren]) @foreach($bookChildren as $bookChild) @if($bookChild->isA('chapter')) @include('exports.parts.chapter-item', ['chapter' => $bookChild]) @else @include('exports.parts.page-item', ['page' => $bookChild, 'chapter' => null]) @endif @endforeach @endsection
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/import-show.blade.php
resources/views/exports/import-show.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <main class="card content-wrap auto-height mt-xxl"> <h1 class="list-heading">{{ trans('entities.import_continue') }}</h1> <p class="text-muted">{{ trans('entities.import_continue_desc') }}</p> @if(session()->has('import_errors')) <div class="mb-m"> <label class="setting-list-label mb-xs text-neg">@icon('warning') {{ trans('entities.import_errors') }}</label> <p class="mb-xs small">{{ trans('entities.import_errors_desc') }}</p> @foreach(session()->get('import_errors') ?? [] as $error) <p class="mb-none text-neg">{{ $error }}</p> @endforeach <hr class="mt-m"> </div> @endif <div class="mb-m"> <label class="setting-list-label mb-m">{{ trans('entities.import_details') }}</label> <div class="flex-container-row justify-space-between wrap"> <div> @include('exports.parts.import-item', ['type' => $import->type, 'model' => $data]) </div> <div class="text-right text-muted"> <div>{{ trans('entities.import_size', ['size' => $import->getSizeString()]) }}</div> <div><span title="{{ $dates->absolute($import->created_at) }}">{{ trans('entities.import_uploaded_at', ['relativeTime' => $dates->relative($import->created_at)]) }}</span></div> @if($import->createdBy) <div> {{ trans('entities.import_uploaded_by') }} <a href="{{ $import->createdBy->getProfileUrl() }}">{{ $import->createdBy->name }}</a> </div> @endif </div> </div> </div> <form id="import-run-form" action="{{ $import->getUrl() }}" method="POST"> {{ csrf_field() }} @if($import->type === 'page' || $import->type === 'chapter') <hr> <label class="setting-list-label">{{ trans('entities.import_location') }}</label> <p class="small mb-s">{{ trans('entities.import_location_desc') }}</p> @if($errors->has('parent')) <div class="mb-s"> @include('form.errors', ['name' => 'parent']) </div> @endif @include('entities.selector', [ 'name' => 'parent', 'entityTypes' => $import->type === 'page' ? 'chapter,book' : 'book', 'entityPermission' => "{$import->type}-create", 'selectorSize' => 'compact small', ]) @endif <div class="flex-container-row items-center justify-flex-end"> <a href="{{ url('/import') }}" class="button outline">{{ trans('common.cancel') }}</a> <div component="dropdown" class="inline block mx-s"> <button refs="dropdown@toggle" type="button" title="{{ trans('common.delete') }}" class="button outline">{{ trans('common.delete') }}</button> <div refs="dropdown@menu" class="dropdown-menu"> <p class="text-neg bold small px-m mb-xs">{{ trans('entities.import_delete_confirm') }}</p> <p class="small px-m mb-xs">{{ trans('entities.import_delete_desc') }}</p> <button type="submit" form="import-delete-form" class="text-link small text-item">{{ trans('common.confirm') }}</button> </div> </div> <button component="loading-button" type="submit" class="button">{{ trans('entities.import_run') }}</button> </div> </form> </main> </div> <form id="import-delete-form" action="{{ $import->getUrl() }}" method="post"> {{ method_field('DELETE') }} {{ csrf_field() }} </form> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/chapter.blade.php
resources/views/exports/chapter.blade.php
@extends('layouts.export') @section('title', $chapter->name) @section('content') <h1 style="font-size: 4.8em">{{$chapter->name}}</h1> <div>{!! $chapter->descriptionInfo()->getHtml() !!}</div> @include('exports.parts.chapter-contents-menu', ['pages' => $pages]) @foreach($pages as $page) @include('exports.parts.page-item', ['page' => $page, 'chapter' => null]) @endforeach @endsection
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/page.blade.php
resources/views/exports/page.blade.php
@extends('layouts.export') @section('title', $page->name) @section('content') @include('pages.parts.page-display') <hr> <div class="text-muted text-small"> @include('exports.parts.meta', ['entity' => $page]) </div> @endsection
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/import.blade.php
resources/views/exports/import.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <main class="card content-wrap auto-height mt-xxl"> <h1 class="list-heading">{{ trans('entities.import') }}</h1> <form action="{{ url('/import') }}" enctype="multipart/form-data" method="POST"> {{ csrf_field() }} <div class="flex-container-row justify-space-between wrap gap-x-xl gap-y-s"> <p class="flex min-width-l text-muted mb-s">{{ trans('entities.import_desc') }}</p> <div class="flex-none min-width-l flex-container-row justify-flex-end"> <div class="mb-m"> <label for="file">{{ trans('entities.import_zip_select') }}</label> <input type="file" accept=".zip,application/zip,application/x-zip-compressed" name="file" id="file" class="custom-simple-file-input"> @include('form.errors', ['name' => 'file']) </div> </div> </div> @if(count($zipErrors) > 0) <p class="mb-xs"><strong class="text-neg">{{ trans('entities.import_zip_validation_errors') }}</strong></p> <ul class="mb-m"> @foreach($zipErrors as $key => $error) <li><strong class="text-neg">[{{ $key }}]</strong>: {{ $error }}</li> @endforeach </ul> @endif <div class="text-right"> <a href="{{ url('/books') }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.import_validate') }}</button> </div> </form> </main> <main class="card content-wrap auto-height mt-xxl"> <h2 class="list-heading">{{ trans('entities.import_pending') }}</h2> @if(count($imports) === 0) <p>{{ trans('entities.import_pending_none') }}</p> @else <div class="item-list my-m"> @foreach($imports as $import) @include('exports.parts.import', ['import' => $import]) @endforeach </div> @endif </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/book-contents-menu.blade.php
resources/views/exports/parts/book-contents-menu.blade.php
@if(count($children) > 0) <ul class="contents"> @foreach($children as $bookChild) <li><a href="#{{$bookChild->getType()}}-{{$bookChild->id}}">{{ $bookChild->name }}</a></li> @if($bookChild->isA('chapter') && count($bookChild->visible_pages) > 0) @include('exports.parts.chapter-contents-menu', ['pages' => $bookChild->visible_pages]) @endif @endforeach </ul> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/chapter-item.blade.php
resources/views/exports/parts/chapter-item.blade.php
<div class="page-break"></div> <h1 id="chapter-{{$chapter->id}}">{{ $chapter->name }}</h1> <div>{!! $chapter->descriptionInfo()->getHtml() !!}</div> @if(count($chapter->visible_pages) > 0) @foreach($chapter->visible_pages as $page) @include('exports.parts.page-item', ['page' => $page, 'chapter' => $chapter]) @endforeach @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/page-item.blade.php
resources/views/exports/parts/page-item.blade.php
<div class="page-break"></div> @if (isset($chapter)) <div class="chapter-hint">{{$chapter->name}}</div> @endif <h1 id="page-{{$page->id}}">{{ $page->name }}</h1> {!! $page->html !!}
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/import-item.blade.php
resources/views/exports/parts/import-item.blade.php
{{-- $type - string $model - object --}} <div class="import-item text-{{ $type }} mb-xs"> <p class="mb-none">@icon($type){{ $model->name }}</p> <div class="ml-s"> <div class="text-muted"> @if($model->attachments ?? []) <span>@icon('attach'){{ count($model->attachments) }}</span> @endif @if($model->images ?? []) <span>@icon('image'){{ count($model->images) }}</span> @endif @if($model->tags ?? []) <span>@icon('tag'){{ count($model->tags) }}</span> @endif </div> @if(method_exists($model, 'children')) @foreach($model->children() as $child) @include('exports.parts.import-item', [ 'type' => ($child instanceof \BookStack\Exports\ZipExports\Models\ZipExportPage) ? 'page' : 'chapter', 'model' => $child ]) @endforeach @endif </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/meta.blade.php
resources/views/exports/parts/meta.blade.php
<div class="entity-meta"> @if ($entity->isA('page')) @icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }} <br> @endif @icon('star'){!! trans('entities.meta_created' . ($entity->createdBy ? '_name' : ''), [ 'timeLength' => $dates->absolute($entity->created_at), 'user' => e($entity->createdBy->name ?? ''), ]) !!} <br> @icon('edit'){!! trans('entities.meta_updated' . ($entity->updatedBy ? '_name' : ''), [ 'timeLength' => $dates->absolute($entity->updated_at), 'user' => e($entity->updatedBy->name ?? '') ]) !!} </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/styles.blade.php
resources/views/exports/parts/styles.blade.php
{{-- Fetch in our standard export styles --}} <style> @if (!app()->runningUnitTests()) {!! file_get_contents(public_path('/dist/export-styles.css')) !!} @endif </style> {{-- Apply any additional styles that can't be applied via our standard SCSS export styles --}} @if ($format === 'pdf') <style> /* Patches for CSS variable colors within PDF exports */ a { color: {{ setting('app-link') }}; } blockquote { border-left-color: {{ setting('app-color') }}; } </style> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/import.blade.php
resources/views/exports/parts/import.blade.php
<div class="item-list-row flex-container-row items-center justify-space-between wrap"> <div class="px-m py-s"> <a href="{{ $import->getUrl() }}" class="text-{{ $import->type }}">@icon($import->type) {{ $import->name }}</a> </div> <div class="px-m py-s flex-container-row gap-m items-center"> <div class="bold opacity-80 text-muted">{{ $import->getSizeString() }}</div> <div class="bold opacity-80 text-muted min-width-xs text-right" title="{{ $dates->absolute($import->created_at) }}">@icon('time'){{ $dates->relative($import->created_at) }}</div> </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/custom-head.blade.php
resources/views/exports/parts/custom-head.blade.php
@inject('headContent', 'BookStack\Theming\CustomHtmlHeadContentProvider') @if(setting('app-custom-head')) <!-- Custom user content --> {!! $headContent->forExport() !!} <!-- End custom user content --> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/exports/parts/chapter-contents-menu.blade.php
resources/views/exports/parts/chapter-contents-menu.blade.php
@if (count($pages) > 0) <ul class="contents"> @foreach($pages as $page) <li><a href="#page-{{$page->id}}">{{ $page->name }}</a></li> @endforeach </ul> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/vendor/pagination/default.blade.php
resources/views/vendor/pagination/default.blade.php
@if ($paginator->hasPages()) <ul class="pagination"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) <li class="disabled"><span>&laquo;</span></li> @else <li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a></li> @endif {{-- Pagination Elements --}} @foreach ($elements as $element) {{-- "Three Dots" Separator --}} @if (is_string($element)) <li class="disabled"><span>{{ $element }}</span></li> @endif {{-- Array Of Links --}} @if (is_array($element)) @foreach ($element as $page => $url) @if ($page == $paginator->currentPage()) <li class="active primary-background"><span>{{ $page }}</span></li> @else <li><a href="{{ $url }}">{{ $page }}</a></li> @endif @endforeach @endif @endforeach {{-- Next Page Link --}} @if ($paginator->hasMorePages()) <li><a href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a></li> @else <li class="disabled"><span>&raquo;</span></li> @endif </ul> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/vendor/notifications/email.blade.php
resources/views/vendor/notifications/email.blade.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="{{ $locale->htmlLang() }}"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css" rel="stylesheet" media="all"> /* Media Queries */ @media only screen and (max-width: 500px) { .button { width: 100% !important; } } @media only screen and (max-width: 600px) { .button { width: 100% !important; } .mobile { max-width: 100%; display: block; width: 100%; } } </style> </head> <?php $style = [ /* Layout ------------------------------ */ 'body' => 'margin: 0; padding: 0; width: 100%; background-color: #F2F4F6;color:#444444;', 'email-wrapper' => 'width: 100%; margin: 0; padding: 0; background-color: #F2F4F6;', /* Masthead ----------------------- */ 'email-masthead' => 'padding: 25px 0; text-align: center;', 'email-masthead_name' => 'font-size: 24px; font-weight: 400; color: #2F3133; text-decoration: none; text-shadow: 0 1px 0 white;', 'email-body' => 'width: 100%; margin: 0; padding: 0; border-top: 4px solid '.setting('app-color').'; border-bottom: 1px solid #EDEFF2; background-color: #FFF;', 'email-body_inner' => 'width: auto; max-width: 100%; margin: 0 auto; padding: 0;', 'email-body_cell' => 'padding: 35px;', 'email-footer' => 'width: auto; max-width: 570px; margin: 0 auto; padding: 0; text-align: center;', 'email-footer_cell' => 'color: #AEAEAE; padding: 35px; text-align: center;', /* Body ------------------------------ */ 'body_action' => 'width: 100%; margin: 30px auto; padding: 0; text-align: center;', 'body_sub' => 'margin-top: 25px; padding-top: 25px; border-top: 1px solid #EDEFF2;', /* Type ------------------------------ */ 'anchor' => 'color: '.setting('app-color').';overflow-wrap: break-word;word-wrap: break-word;word-break: break-all;word-break:break-word;', 'header-1' => 'margin-top: 0; color: #2F3133; font-size: 19px; font-weight: bold; text-align: left;', 'paragraph' => 'margin-top: 0; color: #444444; font-size: 16px; line-height: 1.5em;', 'paragraph-sub' => 'margin-top: 0; color: #444444; font-size: 12px; line-height: 1.5em;', 'paragraph-center' => 'text-align: center;', /* Buttons ------------------------------ */ 'button' => 'display: block; display: inline-block; width: 200px; min-height: 20px; padding: 10px; background-color: #3869D4; border-radius: 3px; color: #ffffff; font-size: 15px; line-height: 25px; text-align: center; text-decoration: none; -webkit-text-size-adjust: none;', 'button--green' => 'background-color: #22BC66;', 'button--red' => 'background-color: #dc4d2f;', 'button--blue' => 'background-color: '.setting('app-color').';', ]; ?> <?php $fontFamily = 'font-family: Arial, \'Helvetica Neue\', Helvetica, sans-serif;'; ?> <body style="{{ $style['body'] }}"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td align="center" class="mobile"> <table width="600" style="max-width: 100%; padding: 12px;text-align: left;" cellpadding="0" cellspacing="0" class="mobile"> <tr> <td style="{{ $style['email-wrapper'] }}" align="center"> <table width="100%" cellpadding="0" cellspacing="0"> <!-- Logo --> <tr> <td style="{{ $style['email-masthead'] }}"> <a style="{{ $fontFamily }} {{ $style['email-masthead_name'] }}" href="{{ url('/') }}" target="_blank"> {{ setting('app-name') }} </a> </td> </tr> <!-- Email Body --> <tr> <td style="{{ $style['email-body'] }}" width="100%"> <table style="{{ $style['email-body_inner'] }}" align="center" width="100%" cellpadding="0" cellspacing="0"> <tr> <td style="{{ $fontFamily }} {{ $style['email-body_cell'] }}"> <!-- Greeting --> @if (!empty($greeting) || $level == 'error') <h1 style="{{ $style['header-1'] }}"> @if (! empty($greeting)) {{ $greeting }} @else @if ($level == 'error') Whoops! @endif @endif </h1> @endif <!-- Intro --> @foreach ($introLines as $line) <p style="{{ $style['paragraph'] }}"> {{ $line }} </p> @endforeach <!-- Action Button --> @if (isset($actionText)) <table style="{{ $style['body_action'] }}" align="center" width="100%" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <?php switch ($level) { case 'success': $actionColor = 'button--green'; break; case 'error': $actionColor = 'button--red'; break; default: $actionColor = 'button--blue'; } ?> <a href="{{ $actionUrl }}" style="{{ $fontFamily }} {{ $style['button'] }} {{ $style[$actionColor] }}" class="button" target="_blank"> {{ $actionText }} </a> </td> </tr> </table> @endif <!-- Outro --> @foreach ($outroLines as $line) <p style="{{ $style['paragraph-sub'] }}"> {{ $line }} </p> @endforeach <!-- Sub Copy --> @if (isset($actionText)) <table style="{{ $style['body_sub'] }}"> <tr> <td style="{{ $fontFamily }}"> <p style="{{ $style['paragraph-sub'] }}"> {{ $locale->trans('common.email_action_help', ['actionText' => $actionText]) }} </p> <p style="{{ $style['paragraph-sub'] }}"> <a style="{{ $style['anchor'] }}" href="{{ $actionUrl }}" target="_blank"> {{ $actionUrl }} </a> </p> </td> </tr> </table> @endif </td> </tr> </table> </td> </tr> <!-- Footer --> <tr> <td> <table style="{{ $style['email-footer'] }}" align="center" width="100%" cellpadding="0" cellspacing="0"> <tr> <td style="{{ $fontFamily }} {{ $style['email-footer_cell'] }}"> <p style="{{ $style['paragraph-sub'] }}"> &copy; {{ date('Y') }} <a style="{{ $style['anchor'] }}" href="{{ url('/') }}" target="_blank">{{ setting('app-name') }}</a>. {{ $locale->trans('common.email_rights') }} </p> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/vendor/notifications/email-plain.blade.php
resources/views/vendor/notifications/email-plain.blade.php
<?php if (! empty($greeting)) { echo $greeting, "\n\n"; } if (! empty($introLines)) { echo implode("\n", $introLines), "\n\n"; } if (isset($actionText)) { echo "{$actionText}: {$actionUrl}", "\n\n"; } if (! empty($outroLines)) { echo implode("\n", $outroLines), "\n\n"; } echo "\n"; echo setting('app-name'), "\n";
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/help/tinymce.blade.php
resources/views/help/tinymce.blade.php
@extends('layouts.plain') @section('document-class', 'bg-white ' . (setting()->getForCurrentUser('dark-mode-enabled') ? 'dark-mode ' : '')) @section('content') <div class="p-m"> <h4 class="mt-s">{{ trans('editor.editor_license') }}</h4> <p> {!! trans('editor.editor_tiny_license', ['tinyLink' => '<a href="https://www.tiny.cloud/" target="_blank" rel="noopener noreferrer">TinyMCE</a>']) !!} <br> <a href="{{ url('/libs/tinymce/license.txt') }}" target="_blank">{{ trans('editor.editor_tiny_license_link') }}</a> </p> <h4>{{ trans('editor.shortcuts') }}</h4> <p>{{ trans('editor.shortcuts_intro') }}</p> <table> <thead> <tr> <th>{{ trans('editor.shortcut') }} {{ trans('editor.windows_linux') }}</th> <th>{{ trans('editor.shortcut') }} {{ trans('editor.mac') }}</th> <th>{{ trans('editor.description') }}</th> </tr> </thead> <tbody> <tr> <td><code>Ctrl</code>+<code>S</code></td> <td><code>Cmd</code>+<code>S</code></td> <td>{{ trans('entities.pages_edit_save_draft') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>Enter</code></td> <td><code>Cmd</code>+<code>Enter</code></td> <td>{{ trans('editor.save_continue') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>B</code></td> <td><code>Cmd</code>+<code>B</code></td> <td>{{ trans('editor.bold') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>I</code></td> <td><code>Cmd</code>+<code>I</code></td> <td>{{ trans('editor.italic') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>1</code><br> <code>Ctrl</code>+<code>2</code><br> <code>Ctrl</code>+<code>3</code><br> <code>Ctrl</code>+<code>4</code> </td> <td> <code>Cmd</code>+<code>1</code><br> <code>Cmd</code>+<code>2</code><br> <code>Cmd</code>+<code>3</code><br> <code>Cmd</code>+<code>4</code> </td> <td> {{ trans('editor.header_large') }} <br> {{ trans('editor.header_medium') }} <br> {{ trans('editor.header_small') }} <br> {{ trans('editor.header_tiny') }} </td> </tr> <tr> <td> <code>Ctrl</code>+<code>5</code><br> <code>Ctrl</code>+<code>D</code> </td> <td> <code>Cmd</code>+<code>5</code><br> <code>Cmd</code>+<code>D</code> </td> <td>{{ trans('editor.paragraph') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>6</code><br> <code>Ctrl</code>+<code>Q</code> </td> <td> <code>Cmd</code>+<code>6</code><br> <code>Cmd</code>+<code>Q</code> </td> <td>{{ trans('editor.blockquote') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>7</code><br> <code>Ctrl</code>+<code>E</code> </td> <td> <code>Cmd</code>+<code>7</code><br> <code>Cmd</code>+<code>E</code> </td> <td>{{ trans('editor.insert_code_block') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>8</code><br> <code>Ctrl</code>+<code>Shift</code>+<code>E</code> </td> <td> <code>Cmd</code>+<code>8</code><br> <code>Cmd</code>+<code>Shift</code>+<code>E</code> </td> <td>{{ trans('editor.inline_code') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>9</code></td> <td><code>Cmd</code>+<code>9</code></td> <td> {{ trans('editor.callouts') }} <br> <small>{{ trans('editor.callouts_cycle') }}</small> </td> </tr> <tr> <td> <code>Ctrl</code>+<code>O</code> <br> <code>Ctrl</code>+<code>P</code> </td> <td> <code>Cmd</code>+<code>O</code> <br> <code>Cmd</code>+<code>P</code> </td> <td> {{ trans('editor.list_numbered') }} <br> {{ trans('editor.list_bullet') }} </td> </tr> <tr> <td> <code>Ctrl</code>+<code>Shift</code>+<code>K</code> </td> <td> <code>Cmd</code>+<code>Shift</code>+<code>K</code> </td> <td>{{ trans('editor.link_selector') }}</td> </tr> </tbody> </table> </div> @endsection
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/help/licenses.blade.php
resources/views/help/licenses.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-l">&nbsp;</div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('settings.licenses') }}</h1> <p>{{ trans('settings.licenses_desc') }}</p> <ul> <li><a href="#bookstack-license">{{ trans('settings.licenses_bookstack') }}</a></li> <li><a href="#php-lib-licenses">{{ trans('settings.licenses_php') }}</a></li> <li><a href="#js-lib-licenses">{{ trans('settings.licenses_js') }}</a></li> <li><a href="#other-licenses">{{ trans('settings.licenses_other') }}</a></li> </ul> </div> <div id="bookstack-license" class="card content-wrap auto-height"> <h3 class="list-heading">{{ trans('settings.licenses_bookstack') }}</h3> <div style="white-space: pre-wrap;" class="mb-m">{{ $license }}</div> <p>BookStack® is a UK registered trade mark of Daniel Brown. </p> </div> <div id="php-lib-licenses" class="card content-wrap auto-height"> <h3 class="list-heading">{{ trans('settings.licenses_php') }}</h3> <div style="white-space: pre-wrap;">{{ $phpLibData }}</div> </div> <div id="js-lib-licenses" class="card content-wrap auto-height"> <h3 class="list-heading">{{ trans('settings.licenses_js') }}</h3> <div style="white-space: pre-wrap;">{{ $jsLibData }}</div> </div> <div id="other-licenses" class="card content-wrap auto-height"> <h3 class="list-heading">{{ trans('settings.licenses_other') }}</h3> <div style="white-space: pre-line;">BookStack makes heavy use of PHP: License: PHP License, version 3.01 License File: https://www.php.net/license/3_01.txt Copyright: Copyright (c) 1999 - 2019 The PHP Group. All rights reserved. Link: https://www.php.net/ ----------- BookStack uses Icons from Google Material Icons: License: Apache License Version 2.0 License File: https://github.com/google/material-design-icons/blob/master/LICENSE Copyright: Copyright 2020 Google LLC Link: https://github.com/google/material-design-icons ----------- BookStack is distributed with TinyMCE: License: MIT License File: https://github.com/tinymce/tinymce/blob/release/6.7/LICENSE.TXT Copyright: Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc. Link: https://github.com/tinymce/tinymce ----------- BookStack's newer WYSIWYG editor is based upon lexical code: License: MIT License File: https://github.com/facebook/lexical/blob/v0.17.1/LICENSE Copyright: Copyright (c) Meta Platforms, Inc. and affiliates. Link: https://github.com/facebook/lexical </div> </div> </div> @endsection
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/help/wysiwyg.blade.php
resources/views/help/wysiwyg.blade.php
<h4>{{ trans('editor.shortcuts') }}</h4> <p>{{ trans('editor.shortcuts_intro') }}</p> <table> <thead> <tr> <th>{{ trans('editor.shortcut') }} {{ trans('editor.windows_linux') }}</th> <th>{{ trans('editor.shortcut') }} {{ trans('editor.mac') }}</th> <th>{{ trans('editor.description') }}</th> </tr> </thead> <tbody> <tr> <td><code>Ctrl</code>+<code>S</code></td> <td><code>Cmd</code>+<code>S</code></td> <td>{{ trans('entities.pages_edit_save_draft') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>Enter</code></td> <td><code>Cmd</code>+<code>Enter</code></td> <td>{{ trans('editor.save_continue') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>B</code></td> <td><code>Cmd</code>+<code>B</code></td> <td>{{ trans('editor.bold') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>I</code></td> <td><code>Cmd</code>+<code>I</code></td> <td>{{ trans('editor.italic') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>1</code><br> <code>Ctrl</code>+<code>2</code><br> <code>Ctrl</code>+<code>3</code><br> <code>Ctrl</code>+<code>4</code> </td> <td> <code>Cmd</code>+<code>1</code><br> <code>Cmd</code>+<code>2</code><br> <code>Cmd</code>+<code>3</code><br> <code>Cmd</code>+<code>4</code> </td> <td> {{ trans('editor.header_large') }} <br> {{ trans('editor.header_medium') }} <br> {{ trans('editor.header_small') }} <br> {{ trans('editor.header_tiny') }} </td> </tr> <tr> <td> <code>Ctrl</code>+<code>5</code><br> <code>Ctrl</code>+<code>D</code> </td> <td> <code>Cmd</code>+<code>5</code><br> <code>Cmd</code>+<code>D</code> </td> <td>{{ trans('editor.paragraph') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>6</code><br> <code>Ctrl</code>+<code>Q</code> </td> <td> <code>Cmd</code>+<code>6</code><br> <code>Cmd</code>+<code>Q</code> </td> <td>{{ trans('editor.blockquote') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>7</code><br> <code>Ctrl</code>+<code>E</code> </td> <td> <code>Cmd</code>+<code>7</code><br> <code>Cmd</code>+<code>E</code> </td> <td>{{ trans('editor.insert_code_block') }}</td> </tr> <tr> <td> <code>Ctrl</code>+<code>8</code><br> <code>Ctrl</code>+<code>Shift</code>+<code>E</code> </td> <td> <code>Cmd</code>+<code>8</code><br> <code>Cmd</code>+<code>Shift</code>+<code>E</code> </td> <td>{{ trans('editor.inline_code') }}</td> </tr> <tr> <td><code>Ctrl</code>+<code>9</code></td> <td><code>Cmd</code>+<code>9</code></td> <td> {{ trans('editor.callouts') }} <br> <small>{{ trans('editor.callouts_cycle') }}</small> </td> </tr> <tr> <td> <code>Ctrl</code>+<code>O</code> <br> <code>Ctrl</code>+<code>P</code> </td> <td> <code>Cmd</code>+<code>O</code> <br> <code>Cmd</code>+<code>P</code> </td> <td> {{ trans('editor.list_numbered') }} <br> {{ trans('editor.list_bullet') }} </td> </tr> <tr> <td> <code>Ctrl</code>+<code>Shift</code>+<code>K</code> </td> <td> <code>Cmd</code>+<code>Shift</code>+<code>K</code> </td> <td>{{ trans('editor.link_selector') }}</td> </tr> </tbody> </table> <h4 class="mt-s">{{ trans('editor.editor_license') }}</h4> <p> {!! trans('editor.editor_lexical_license', ['lexicalLink' => '<a href="https://lexical.dev/" target="_blank" rel="noopener noreferrer">Lexical</a>']) !!} <br> <em class="text-muted">Copyright (c) Meta Platforms, Inc. and affiliates.</em> <br> <a href="{{ url('/licenses') }}" target="_blank">{{ trans('editor.editor_lexical_license_link') }}</a> </p>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/api-docs/index.blade.php
resources/views/api-docs/index.blade.php
@extends('layouts.simple') @section('body') <div component="api-nav" class="container"> <div class="grid right-focus reverse-collapse"> <div> <div refs="api-nav@sidebar" class="sticky-sidebar"> <div class="sticky-sidebar-header py-xl"> <select refs="api-nav@select" name="navigation" id="navigation"> <option value="getting-started" selected>Jump To Section</option> <option value="getting-started">Getting Started</option> @foreach($docs as $model => $endpoints) <option value="{{ str_replace(' ', '-', $model) }}">{{ ucfirst($model) }}</option> @if($model === 'docs' || $model === 'shelves') <hr> @endif @endforeach </select> </div> <div class="mb-xl"> <p id="sidebar-header-getting-started" class="text-uppercase text-muted mb-xm"><strong>Getting Started</strong></p> <div class="text-mono"> <div class="mb-xs"><a href="#authentication">Authentication</a></div> <div class="mb-xs"><a href="#request-format">Request Format</a></div> <div class="mb-xs"><a href="#listing-endpoints">Listing Endpoints</a></div> <div class="mb-xs"><a href="#error-handling">Error Handling</a></div> <div class="mb-xs"><a href="#rate-limits">Rate Limits</a></div> <div class="mb-xs"><a href="#content-security">Content Security</a></div> </div> </div> @foreach($docs as $model => $endpoints) <div class="mb-xl"> <p id="sidebar-header-{{ str_replace(' ', '-', $model) }}" class="text-uppercase text-muted mb-xm"><strong>{{ $model }}</strong></p> @foreach($endpoints as $endpoint) <div class="mb-xs"> <a href="#{{ $endpoint['name'] }}" class="text-mono inline block mr-s"> <span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span> </a> <a href="#{{ $endpoint['name'] }}" class="text-mono"> {{ $endpoint['controller_method_kebab'] }} </a> </div> @endforeach </div> @endforeach </div> </div> <div class="pt-xl" style="overflow: auto;"> <section id="section-getting-started" component="code-highlighter" class="card content-wrap auto-height"> @include('api-docs.parts.getting-started') </section> @foreach($docs as $model => $endpoints) <section id="section-{{ str_replace(' ', '-', $model) }}" class="card content-wrap auto-height"> <h1 class="list-heading text-capitals">{{ $model }}</h1> @if($endpoints[0]['model_description']) <p>{{ $endpoints[0]['model_description'] }}</p> @endif @foreach($endpoints as $endpoint) @include('api-docs.parts.endpoint', ['endpoint' => $endpoint, 'loop' => $loop]) @endforeach </section> @endforeach </div> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/api-docs/parts/getting-started.blade.php
resources/views/api-docs/parts/getting-started.blade.php
<h1 class="list-heading text-capitals mb-l">Getting Started</h1> <p class="mb-none"> This documentation covers use of the REST API. <br> Examples of API usage, in a variety of programming languages, can be found in the <a href="https://codeberg.org/bookstack/api-scripts" target="_blank" rel="noopener noreferrer">BookStack api-scripts repo on GitHub</a>. <br> <br> Some alternative options for extension and customization can be found below: </p> <ul> <li> <a href="{{ url('/settings/webhooks') }}" target="_blank" rel="noopener noreferrer">Webhooks</a> - HTTP POST calls upon events occurring in BookStack. </li> <li> <a href="https://github.com/BookStackApp/BookStack/blob/development/dev/docs/visual-theme-system.md" target="_blank" rel="noopener noreferrer">Visual Theme System</a> - Methods to override views, translations and icons within BookStack. </li> <li> <a href="https://github.com/BookStackApp/BookStack/blob/development/dev/docs/logical-theme-system.md" target="_blank" rel="noopener noreferrer">Logical Theme System</a> - Methods to extend back-end functionality within BookStack. </li> </ul> <hr> <h5 id="authentication" class="text-mono mb-m">Authentication</h5> <p> To access the API a user has to have the <em>"Access System API"</em> permission enabled on one of their assigned roles. Permissions to content accessed via the API is limited by the roles & permissions assigned to the user that's used to access the API. </p> <p>Authentication to use the API is primarily done using API Tokens. Once the <em>"Access System API"</em> permission has been assigned to a user, a "API Tokens" section should be visible when editing their user profile. Choose "Create Token" and enter an appropriate name and expiry date, relevant for your API usage then press "Save". A "Token ID" and "Token Secret" will be immediately displayed. These values should be used as a header in API HTTP requests in the following format:</p> <pre><code class="language-css">Authorization: Token &lt;token_id&gt;:&lt;token_secret&gt;</code></pre> <p>Here's an example of an authorized cURL request to list books in the system:</p> <pre><code class="language-shell">curl --request GET \ --url https://example.com/api/books \ --header 'Authorization: Token C6mdvEQTGnebsmVn3sFNeeuelGEBjyQp:NOvD3VlzuSVuBPNaf1xWHmy7nIRlaj22'</code></pre> <p>If already logged into the system within the browser, via a user account with permission to access the API, the system will also accept an existing session meaning you can browse API endpoints directly in the browser or use the browser devtools to play with the API.</p> <hr> <h5 id="request-format" class="text-mono mb-m">Request Format</h5> <p> For endpoints in this documentation that accept data a "Body Parameters" table will be available to show the parameters that are accepted in the request. Any rules for the values of such parameters, such as the data-type or if they're required, will be shown alongside the parameter name. </p> <p> The API can accept request data in the following <code>Content-Type</code> formats: </p> <ul> <li>application/json</li> <li>application/x-www-form-urlencoded*</li> <li>multipart/form-data*</li> </ul> <p> <em> * Form requests currently only work for POST requests due to how PHP handles request data. If you need to use these formats for PUT or DELETE requests you can work around this limitation by using a POST request and providing a "_method" parameter with the value equal to <code>PUT</code> or <code>DELETE</code>. </em> </p> <p> <em> * Form requests can accept boolean (<code>true</code>/<code>false</code>) values via a <code>1</code> or <code>0</code>. </em> </p> <p> Regardless of format chosen, ensure you set a <code>Content-Type</code> header on requests so that the system can correctly parse your request data. The API is primarily designed to be interfaced using JSON, since responses are always in JSON format, hence examples in this documentation will be shown as JSON. Some endpoints, such as those that receive file data, may require the use of <code>multipart/form-data</code>. This will be mentioned within the description for such endpoints. </p> <p> Some data may be expected in a more complex nested structure such as a nested object or array. These can be sent in non-JSON request formats using square brackets to denote index keys or property names. Below is an example of a JSON request body data and it's equivalent x-www-form-urlencoded representation. </p> <p><strong>JSON</strong></p> <pre><code class="language-json">{ "name": "My new item", "locked": true, "books": [105, 263], "tags": [{"name": "Tag Name", "value": "Tag Value"}], }</code></pre> <p><strong>x-www-form-urlencoded</strong></p> <pre><code class="language-text">name=My%20new%20item&locked=1&books%5B0%5D=105&books%5B1%5D=263&tags%5B0%5D%5Bname%5D=Tag%20Name&tags%5B0%5D%5Bvalue%5D=Tag%20Value</code></pre> <p><strong>x-www-form-urlencoded (Decoded for readability)</strong></p> <pre><code class="language-text">name=My new item locked=1 books[0]=105 books[1]=263 tags[0][name]=Tag Name tags[0][value]=Tag Value</code></pre> <hr> <h5 id="listing-endpoints" class="text-mono mb-m">Listing Endpoints</h5> <p>Some endpoints will return a list of data models. These endpoints will return an array of the model data under a <code>data</code> property along with a numeric <code>total</code> property to indicate the total number of records found for the query within the system. Here's an example of a listing response:</p> <pre><code class="language-json">{ "data": [ { "id": 1, "name": "BookStack User Guide", "slug": "bookstack-user-guide", "description": "This is a general guide on using BookStack on a day-to-day basis.", "created_at": "2019-05-05 21:48:46", "updated_at": "2019-12-11 20:57:31", "created_by": 1, "updated_by": 1, "image_id": 3 } ], "total": 16 }</code></pre> <p> There are a number of standard URL parameters that can be supplied to manipulate and page through the results returned from a listing endpoint: </p> <table class="table"> <tr> <th width="110">Parameter</th> <th>Details</th> <th width="30%">Examples</th> </tr> <tr> <td>count</td> <td> Specify how many records will be returned in the response. <br> (Default: {{ config('api.default_item_count') }}, Max: {{ config('api.max_item_count') }}) </td> <td>Limit the count to 50<br><code>?count=50</code></td> </tr> <tr> <td>offset</td> <td> Specify how many records to skip over in the response. <br> (Default: 0) </td> <td>Skip over the first 100 records<br><code>?offset=100</code></td> </tr> <tr> <td>sort</td> <td> Specify what field is used to sort the data and the direction of the sort (Ascending or Descending).<br> Value is the name of a field, A <code>+</code> or <code>-</code> prefix dictates ordering. <br> Direction defaults to ascending. <br> Can use most fields shown in the response. </td> <td> Sort by name ascending<br><code>?sort=+name</code> <br> <br> Sort by "Created At" date descending<br><code>?sort=-created_at</code> </td> </tr> <tr> <td>filter[&lt;field&gt;]</td> <td> Specify a filter to be applied to the query. Can use most fields shown in the response. <br> By default a filter will apply a "where equals" query but the below operations are available using the format filter[&lt;field&gt;:&lt;operation&gt;] <br> <table> <tr> <td>eq</td> <td>Where <code>&lt;field&gt;</code> equals the filter value.</td> </tr> <tr> <td>ne</td> <td>Where <code>&lt;field&gt;</code> does not equal the filter value.</td> </tr> <tr> <td>gt</td> <td>Where <code>&lt;field&gt;</code> is greater than the filter value.</td> </tr> <tr> <td>lt</td> <td>Where <code>&lt;field&gt;</code> is less than the filter value.</td> </tr> <tr> <td>gte</td> <td>Where <code>&lt;field&gt;</code> is greater than or equal to the filter value.</td> </tr> <tr> <td>lte</td> <td>Where <code>&lt;field&gt;</code> is less than or equal to the filter value.</td> </tr> <tr> <td>like</td> <td> Where <code>&lt;field&gt;</code> is "like" the filter value. <br> <code>%</code> symbols can be used as wildcards. </td> </tr> </table> </td> <td> Filter where id is 5: <br><code>?filter[id]=5</code><br><br> Filter where id is not 5: <br><code>?filter[id:ne]=5</code><br><br> Filter where name contains "cat": <br><code>?filter[name:like]=%cat%</code><br><br> Filter where created after 2020-01-01: <br><code>?filter[created_at:gt]=2020-01-01</code> </td> </tr> </table> <hr> <h5 id="error-handling" class="text-mono mb-m">Error Handling</h5> <p> Successful responses will return a 200 or 204 HTTP response code. Errors will return a 4xx or a 5xx HTTP response code depending on the type of error. Errors follow a standard format as shown below. The message provided may be translated depending on the configured language of the system in addition to the API users' language preference. The code provided in the JSON response will match the HTTP response code. </p> <pre><code class="language-json">{ "error": { "code": 401, "message": "No authorization token found on the request" } } </code></pre> <hr> <h5 id="rate-limits" class="text-mono mb-m">Rate Limits</h5> <p> The API has built-in per-user rate-limiting to prevent potential abuse using the API. By default, this is set to 180 requests per minute but this can be changed by an administrator by setting an "API_REQUESTS_PER_MIN" .env option like so: </p> <pre><code class="language-bash"># The number of API requests that can be made per minute by a single user. API_REQUESTS_PER_MIN=180</code></pre> <p> When the limit is reached you will receive a 429 "Too Many Attempts." error response. It's generally good practice to limit requests made from your API client, where possible, to avoid affecting normal use of the system caused by over-consuming system resources. Keep in mind there may be other rate-limiting factors such as web-server & firewall controls. </p> <hr> <h5 id="content-security" class="text-mono mb-m">Content Security</h5> <p> Many of the available endpoints will return content that has been provided by user input. Some of this content may be provided in a certain data-format (Such as HTML or Markdown for page content). Such content is not guaranteed to be safe so keep security in mind when dealing with such user-input. In some cases, the system will apply some filtering to content in an attempt to prevent certain vulnerabilities, but this is not assured to be a bullet-proof defence. </p> <p> Within its own interfaces, unless disabled, the system makes use of Content Security Policy (CSP) rules to heavily negate cross-site scripting vulnerabilities from user content. If displaying user content externally, it's advised you also use defences such as CSP or the disabling of JavaScript completely. </p>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/api-docs/parts/endpoint.blade.php
resources/views/api-docs/parts/endpoint.blade.php
<div class="flex-container-row items-center gap-m"> <span class="api-method text-mono" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span> <h5 id="{{ $endpoint['name'] }}" class="text-mono pb-xs"> @if($endpoint['controller_method_kebab'] === 'list') <a style="color: inherit;" target="_blank" rel="noopener" href="{{ url($endpoint['uri']) }}">{{ url($endpoint['uri']) }}</a> @else <span>{{ url($endpoint['uri']) }}</span> @endif </h5> <h6 class="text-uppercase text-muted text-mono ml-auto">{{ $endpoint['controller_method_kebab'] }}</h6> </div> <div class="mb-m"> @foreach(explode("\n", $endpoint['description'] ?? '') as $descriptionBlock) <p class="mb-xxs">{{ $descriptionBlock }}</p> @endforeach </div> @if($endpoint['body_params'] ?? false) <details class="mb-m"> <summary class="text-muted">{{ $endpoint['method'] === 'GET' ? 'Query' : 'Body' }} Parameters</summary> <table class="table"> <tr> <th>Param Name</th> <th>Value Rules</th> </tr> @foreach($endpoint['body_params'] as $paramName => $rules) <tr> <td>{{ $paramName }}</td> <td> @foreach($rules as $rule) <code class="mr-xs">{{ $rule }}</code> @endforeach </td> </tr> @endforeach </table> </details> @endif @if($endpoint['example_request'] ?? false) <details component="details-highlighter" class="mb-m"> <summary class="text-muted">Example Request</summary> <pre><code class="language-json">{{ $endpoint['example_request'] }}</code></pre> </details> @endif @if($endpoint['example_response'] ?? false) <details component="details-highlighter" class="mb-m"> <summary class="text-muted">Example Response</summary> <pre><code class="language-json">{{ $endpoint['example_response'] }}</code></pre> </details> @endif @if(!$loop->last) <hr> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false