text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<?php namespace BookStack\Theming; use BookStack\Facades\Theme; use BookStack\Http\Controller; use BookStack\Util\FilePathNormalizer; use Symfony\Component\HttpFoundation\StreamedResponse; class ThemeController extends Controller { /** * Serve a public file from the configured theme. */ public func...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Theming; /** * The ThemeEvents used within BookStack. * * This file details the events that BookStack may fire via the custom * theme system, including event names, parameters and expected return types. * * This system is regarded as semi-stable. * We'll look to fix issu...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Theming; readonly class ThemeModule { public function __construct( public string $name, public string $description, public string $version, public string $folderName, ) { } /** * Create a ThemeModule instance from JSON data....
fim
BookStackApp/BookStack
php
<?php namespace BookStack\Theming; class ThemeModuleException extends \Exception { } <|endoftext|>
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Theming; u<|fim_suffix|>ion deleteModuleFolder(string $moduleFolderName): void { $modules = $this->load(); $module = $modules[$moduleFolderName] ?? null; if (!$module) { return; } $moduleFolderPath = $module->path(''); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Theming; use BookStack\Util\FilePathNormalizer; use ZipArchive; readonly class ThemeModuleZip { public function __construct( protected string $path ) { } public function extractTo(string $destinationPath): void { $zip = new ZipArchive(); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Theming; use BookStack\Access\SocialDriverManager; use BookStack\Exceptions\ThemeException; use Illuminate\Console\Application; use Illuminate\Console\Application as Artisan; use Illuminate\View\FileViewFinder; use Symfony\Component\Console\Command\Command; class ThemeService ...
fim
BookStackApp/BookStack
php
<?php namespace BookStack\Theming; use BookStack\Exceptions\ThemeException; use Illuminate\View\FileViewFinder; class ThemeViews { /** * @var array<string, array<string, int>> */ protected array $beforeViews = []; /** * @var array<string, array<string, int>> */ protected array $a...
fim
BookStackApp/BookStack
php
<|fim_suffix|> */ public function load($locale, $group, $namespace = null): array { if ($group === '*' && $namespace === '*') { return $this->loadJsonPaths($locale); } if (is_null($namespace) || $namespace === '*') { $themePath = theme_path('lang'); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Translation; class LocaleDefinition { public function __construct( protected string $appName, protected string $isoName, protected bool $isRtl ) { } /** * Provide the BookStack-specific locale name. <|fim_suffix|>ocale(): string ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>aleForUser(User $user): string { $default = config('app.default_locale'); if ($user->isGuest() && config('app.auto_detect_locale')) { return $this->autoDetectLocale(request(), $default); } return setting()->getUser($user, 'language', $default); } ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ent::getPluralIndex($locale, $number); } } <|fim_prefix|><?php namespace BookStack\Translation; use Illuminate\Translation\Mess<|fim_middle|>ageSelector as BaseClass; /** * This is a customization of the default Laravel MessageSelector class to tweak pluralization, * so that is uses just the firs...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ment. */ public function markdownLink(): string { return '[' . $this->name . '](' . $this->getUrl() . ')'; } /** * Scope the query to those attachments that are visible based upon related page permissions. */ public function scopeVisible(): Builder { ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>on = $uploadedFile->getClientOriginalExtension(); $attachment->save(); return $attachment; } /** * Save a new File attachment from a given link and name. */ public function saveNewFromLink(string $name, string $link, int $page_id): Attachment { $largestE...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads\Controllers; use BookStack\Entities\EntityExistsRule; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\FileUploadException; use BookStack\Http\ApiController; use BookStack\Permissions\Permission; use BookStack\Uploads\Attachment; use BookStack\Upload...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads\Controllers; use BookStack\Entities\EntityExistsRule; use BookStack\Entities\Queries\PageQueries; use BookStack\Entities\Repos\PageRepo; use BookStack\Exceptions\FileUploadException; use BookStack\Exceptions\NotFoundException; use BookStack\Http\Controller; use BookStac...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads\Controllers; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\ImageUploadException; use BookStack\Http\Controller; use BookStack\Permissions\Permission; use BookStack\Uploads\ImageRepo; use BookStack\Uploads\ImageResizer; use BookStack\Util\OutOfMemo...
fim
BookStackApp/BookStack
php
<?php namespace BookStack\Uploads\Controllers; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\ImageUploadException; use BookStack\Http\Controller; use BookStack\Permissions\Permission; use BookStack\Uploads\ImageRepo; use BookStack\Uploads\ImageResizer; use BookStack\Util\OutOfMemoryHandler; use...
fim
BookStackApp/BookStack
php
<|fim_suffix|>orImage($image, false); return view('pages.parts.image-manager-form', $viewData); } /** * Deletes an image and all thumbnail/image files. * * @throws Exception */ public function destroy(string $id) { $image = $this->imageRepo->getById($id); $t...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads\Controllers; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\NotFoundException; use BookStack\Http\ApiController; use BookStack\Permissions\Permission; use BookStack\Uploads\Image; use BookStack\Uploads\ImageRepo; use BookStack\Uploads\ImageResizer;...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ion // via intervention from png typically provides this as 24. $entry .= pack('v', 0x00); // Size of the image data in bytes $entry .= pack('V', strlen($pngData)); // Offset of the bmp data from file start $entry .= pack('V', strlen($header) + strlen($entry...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ure' || $storageType === 'local_secure_restricted') { $storageType = 'local_secure_attachments'; } return $storageType; } /** * Change the originally provided path to fit any disk-specific requirements. * This also ensures the path is kept to the expected ro...
fim
BookStackApp/BookStack
php
<|fim_suffix|>y; /** * @property int $id * @property string $name * @property string $url * @property string $path * @property string $type * @property int|null $uploaded_to * @property int $created_by * @property int $updated_by */ class Image extends Model implements OwnableInterface ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\ImageUploadException; use BookStack\Permissions\PermissionApplicator; use Exception; use Illuminate\Database\Eloquent\Builder; use Symfony\Component\HttpFoundation\File\UploadedFile; class ImageRepo ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads; use BookStack\Exceptions\ImageUploadException; use Exception; use GuzzleHttp\Psr7\Utils; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Log; use Intervention\Image\Decoders\BinaryImageDecoder; use Intervention\Image\Drivers\Gd\Decoders\NativeObjec...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Uploads; use BookStack\Entities\Queries\EntityQueries; use BookStack\Exceptions\ImageUploadException; use Exception; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\File\UploadedFile; use Sy...
fim
BookStackApp/BookStack
php
<?php namespace BookStack\Uploads; use Illuminate\Filesystem\FilesystemManager; use Illuminate\Support\Str; class ImageStorage { public function __construct( protected FilesystemManager $fileSystem, ) { } /** * Get the storage disk for the given image type. */ public function g...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ads/images/', '', $path); $normalized = FilePathNormalizer::normalize($trimmed); if ($this->usingSecureImages()) { return $normalized; } return 'uploads/images/' . $normalized; } /** * Check if a file at the given path exists. */ public ...
fim
BookStackApp/BookStack
php
<|fim_suffix|> ->where('uploaded_to', '=', $user->id) ->get(); foreach ($profileImages as $image) { $this->imageService->destroy($image); } } /** * Save an avatar image from an external service. * * @throws HttpFetchException */ protected ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Users\Controllers; use BookStack\Http\ApiController; use BookStack\Permissions\Permission; use BookStack\Permissions\PermissionsRepo; use BookStack\Users\Models\Role; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class RoleApiController extends ApiController ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>/settings/roles'); } /** * Show the view to delete a role. * Offers the chance to migrate users. */ public function showDelete(string $id) { $this->checkPermission(Permission::UserRolesManage); $role = $this->permissionsRepo->getRoleById($id); $roles...
fim
BookStackApp/BookStack
php
<|fim_suffix|>validated = $this->validate($request, [ 'password' => ['required_with:password_confirm', Password::default()], 'password-confirm' => ['same:password', 'required_with:password'], ]); $this->userRepo->update(user(), $validated, false); $this->showSuc...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Users\Controllers; use BookStack\Entities\EntityExistsRule; use BookStack\Exceptions\UserUpdateException; use BookStack\Http\ApiController; use BookStack\Permissions\Permission; use BookStack\Users\Models\User; use BookStack\Users\UserRepo; use Illuminate\Http\Request; use Illu...
fim
BookStackApp/BookStack
php
<|fim_suffix|> $this->checkPermission(Permission::UsersManage); $user = $this->userRepo->getById($id); $user->load(['apiTokens', 'mfaValues']); $authMethod = ($user->system_name) ? 'system' : config('auth.method'); $activeSocialDrivers = $socialDriverManager->getActive(); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Users\Controllers; use BookStack\Http\Controller; use BookStack\Users\UserRepo; use Illuminate\Http\Request; class UserPreferencesController extends Controller { public function __construct( protected UserRepo $userRepo ) { } /** * Update the pref...
fim
BookStackApp/BookStack
php
<|fim_suffix|>lyCreatedContent ) { } /** * Show the user profile page. */ public function show(string $slug) { $user = $this->userRepo->getBySlug($slug); $userActivity = $this->activityQueries->userActivity($user); $recentlyCreated = $this->recentlyCreatedContent...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Users\Controllers; use BookStack\Http\Controller; use BookStack\Permissions\Permission; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Collection; use Illuminate\Http\Request; class UserSearchController extends Controller { /** * Search users in the...
fim
BookStackApp/BookStack
php
<|fim_suffix|>(User::class, 'updated_by'); } public function getOwnerFieldName(): string { return 'created_by'; } } <|fim_prefix|><?php namespace BookStack\Users\Models; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $created_by * @property int $updated_by * @pr...
fim
BookStackApp/BookStack
php
<|fim_suffix|>Interface { public function getOwnerFieldName(): string; } <|fim_prefix|><?php namespace BookStack\Users\Models; <|fim_middle|>interface Ownable<|endoftext|>
fim
BookStackApp/BookStack
php
<|fim_suffix|> /** * Add a permission to this role. */ public function attachPermission(RolePermission $permission) { $this->permissions()->attach($permission->id); } /** * Detach a single permission from this role. */ public function detachPermission(RolePermission ...
fim
BookStackApp/BookStack
php
<|fim_suffix|> '=', $socialDriver)->exists(); } /** * Returns a URL to the user's avatar. */ public function getAvatar(int $size = 50): string { $default = url('/user_avatar.png'); if ($this->image_id === 0) { return $default; } if (!empty($this->a...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Users\Queries; use BookStack\User<|fim_suffix|>) use ($term) { $query->where('display_name', 'like', $term) ->orWhere('description', 'like', $term); }); } return $query->paginate($count); } } <|fim_middle|>s\M...
fim
BookStackApp/BookStack
php
<|fim_suffix|> 'chapters' => $this->queries->chapters->visibleForList()->where($createdBy)->count(), 'books' => $this->queries->books->visibleForList()->where($createdBy)->count(), 'shelves' => $this->queries->shelves->visibleForList()->where($createdBy)->count(), ]; } } <|fim_p...
fim
BookStackApp/BookStack
php
<|fim_suffix|>rn [ 'pages' => $query($this->queries->pages->visibleForList()->where('draft', '=', false)), 'chapters' => $query($this->queries->chapters->visibleForList()), 'books' => $query($this->queries->books->visibleForList()), 'shelves' => $query($this->queri...
fim
BookStackApp/BookStack
php
<|fim_suffix|> ->orWhere('email', 'like', $term); }); } return $query->paginate($count); } } <|fim_prefix|><?php namespace BookStack\Users\Queries; use BookStack\Users\Models\User; use BookStack\Util\SimpleListOptions; use Illuminate\Pagination\LengthAwarePaginator; /** * Get all th...
fim
BookStackApp/BookStack
php
<|fim_suffix|>se; } } <|fim_prefix|><?php namespace BookStack\Users; use BookStack\Access\UserInviteException; use BookStack\Access\UserInviteService; use BookStack\Activity\ActivityType; use BookStack\Entities\Tools\SlugGenerator; use BookStack\Exceptions\NotifyException; use BookStack\Exceptions\UserUpdateExcep...
fim
BookStackApp/BookStack
php
<|fim_suffix|>restrict the types of dynamic content * that can be embedded on the page. */ protected function getObjectSrc(): string { if ($this->scriptFilteringDisabled()) { return ''; } return "object-src 'self'"; } /** * Creates CSP 'style-src' rul...
fim
BookStackApp/BookStack
php
<|fim_suffix|>k */ public function __construct( protected Closure $callback ) { } /** * @return TReturn */ public function run(): mixed { DB::statement('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED'); return DB::transaction($this->callback); ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>tion relative(Carbon $date, bool $includeSuffix = true): string { return $date->diffForHumans(null, $includeSuffix ? null : CarbonInterface::DIFF_ABSOLUTE); } } <|fim_prefix|><?php namespace BookStack\Util; use Carbon\Carbon; use Carbon\CarbonInterface; class DateFormatter { public ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use League\Flysystem\WhitespacePathNormalizer; /** * Utility to normalize (potentially) user provided file paths * to avoid things like directory <|fim_suffix|>Normalizer { public static function normalize(string $path): string { return (new WhitespaceP...
fim
BookStackApp/BookStack
php
<|fim_suffix|> } protected function filterOutBadHtmlElementsFromDocument(HtmlDocument $doc): void { // Remove meta tag to prevent external redirects $metaTags = $doc->queryXPath('//meta[' . static::xpathContains('@content', 'url') . ']'); static::removeNodes($metaTags); } prot...
fim
BookStackApp/BookStack
php
<|fim_suffix|>tr_contains($config, 'a'), ); } } <|fim_prefix|><?php namespace BookStack\Util; readonly class HtmlContentFilterConfig { public function __construct( public bool $filterOutJavaScript = true, public bool $filterOutBadHtmlElements = true, public bool $filterOutFormE...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use DOMAttr; use DOMElement; use DOMNode; /** * Filter to ensure <|fim_suffix|> } else { $child->parentNode->removeChild($child); } } return $doc->getBodyInnerHtml(); } protected static function filterElemen...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ce within the document. */ public function createElement(string $localName, string $value = ''): DOMElement { $element = $this->document->createElement($localName, $value); if ($element === false) { throw new \InvalidArgumentException("Failed to create element of ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use DOMElement; use DOMNodeList; class<|fim_suffix|>cripts $scriptElems = $doc->queryXPath('//script'); static::addNonceAttributes($scriptElems, static::$placeholder); // Apply to styles $styleElems = $doc->queryXPath('//style'); ...
fim
BookStackApp/BookStack
php
<?php namespace BookStack\Util\HtmlPurifier; use BookStack\App\AppVersion; use BookStack\Util\HtmlPurifier\Filters\UriLimitFileProtocolToAnchors; use HTMLPurifier; use HTMLPurifier_Config; use HTMLPurifier_DefinitionCache_Serializer; use HTMLPurifier_HTML5Config; use HTMLPurifier_HTMLDefinition; use HTMLPurifier_URID...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util\HtmlPurifier\Filters; use HTMLPurifier_Config; use HTMLPurifier_Context; use HTMLPurifier_URI; use HTMLPurifier_URIFilter; /** * Limits file:// URIs to only be used on anchor tags href attributes. * This prevents use on iframes/emb<|fim_suffix|> { // Ensure we...
fim
BookStackApp/BookStack
php
<|fim_suffix|> = trim($text); return $text; } protected function nodeToText(\DOMNode $node): string { if ($node->nodeType === XML_TEXT_NODE) { return $node->textContent; } $text = ''; if (!in_array($node->nodeName, $this->inlineTags)) { $tex...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use BookStack\Exceptions\Handler; use Illuminate\Contracts\Debug\ExceptionHandler; /** * Create a handler which runs the provided actions upon an * out-of-memory event. This allows reserving of memory to allow * the desired action to run as needed. * * Essentially p...
fim
BookStackApp/BookStack
php
<|fim_suffix|>(): string { return strtolower($this->order) === 'desc' ? 'desc' : 'asc'; } /** * Get the current sort option. */ public function getSort(): string { $default = array_key_first($this->sortOptions) ?? 'name'; $sort = $this->sort ?: $default; i...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use BookStack\Exceptions\HttpFetchException; /** * Validate the host we're connecting to when making a server-side-request. * Will use the given hosts config if given during construction otherwise * will look to the app configured config. * * The config format is a ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace BookStack\Util; use BookStack\Facades\Theme; class SvgIcon { public function __construct( protected string $name, protected array $attrs = [] ) { } public function toHtml(): string <|fim_suffix|> return str_replace('<svg', '<svg' . $attrString, $fileCo...
fim
BookStackApp/BookStack
php
<|fim_suffix|> 'image/webp', 'image/avif', 'image/heic', 'text/css', 'text/csv', 'text/javascript', 'text/json', 'text/plain', 'video/x-msvideo', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/v...
fim
BookStackApp/BookStack
php
<|fim_suffix|>Illuminate\Contracts\Debug\ExceptionHandler::class, BookStack\Exceptions\Handler::class ); /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the ap...
fim
BookStackApp/BookStack
php
<|fim_suffix|>([ 'filesystems.default' => 'local', ]); <|fim_prefix|><?php // Overwrite<|fim_middle|> configuration that can interfere with the phpstan/larastan scanning. config()->set<|endoftext|>
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Access\Mfa; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Access\Mfa\MfaValue> */ class MfaValueFactory extends Factory { protec<|fim_suffix|>s defau...
fim
BookStackApp/BookStack
php
<|fim_suffix|>> '', ]; } } <|fim_prefix|><?php namespace Database\Factories\Access; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\<|fim_middle|>Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Access\SocialAccount> */ class SocialAccountFa...
fim
BookStackApp/BookStack
php
<?php namespace Database\Factories\Activity\Models; use BookStack\Activity\ActivityType; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Activity\Models\Activity> */ class ActivityFactory extends Factory ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Activity\Models; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; class CommentFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = \BookSta...
fim
BookStackApp/BookStack
php
<|fim_suffix|> } <|fim_prefix|><?php namespace Database\Factories\Activity\Models; use BookStack\Entities\Models\Book; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Activity\Models\Favourite> */ class F...
fim
BookStackApp/BookStack
php
<?php namespace Database\Factories\Activity\Models; use Illuminate\Database\Eloquent\Factories\Factory; class TagFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = \BookStack\Activity\Models\Tag::class; /** * Defi...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Activity\Models; use BookStack\Activity\WatchLevels; use BookStack\Entities\Models\Book; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factorie<|fim_suffix|> 'user_id' => User::factory(), 'watchable_id' => $book->id, 'watchab...
fim
BookStackApp/BookStack
php
<|fim_suffix|> } } <|fim_prefix|><?php namespace Database\Factories\Activity\Models; use BookStack\Activity\Models\Webhook; use Illuminate\Database\Eloquent\Factories\Factory; class WebhookFactory extends Factory { protected $model = Webhook::class; /** * Define the model's default state. * *...
fim
BookStackApp/BookStack
php
<|fim_suffix|>()[array_rand(ActivityType::all())], ]; } } <|fim_prefix|><?php namespace Database\Factories\Activity\Models; use BookStack\Activity\ActivityType; use BookStack\Activity\M<|fim_middle|>odels\Webhook; use Illuminate\Database\Eloquent\Factories\Factory; class WebhookTrackedEventFactory extend...
fim
BookStackApp/BookStack
php
<|fim_suffix|>ret' => Str::random(12), 'name' => $this->faker->name(), 'expires_at' => Carbon::now()->addYear(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'user_id' => User::factory(), ]; } } <|fim_prefix|><?php namespace Datab...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Entities\Models; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; class BookFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = \BookStack\Entit...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Entities\Models; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; class BookshelfFactory extends Factory { /** * The name of the factory's correspondi<|fim_suffix|> /** * Define the model's default state. * * ...
fim
BookStackApp/BookStack
php
<|fim_suffix|>tion = $this->faker->paragraph(); return [ 'name' => $this->faker->sentence(), 'slug' => Str::random(10), 'description' => $description, 'description_html' => '<p>' . e($description) . '</p>', 'priority' => 5, ]; ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Entities\Models; use BookStack\Entities\Models\Page; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Entities\Models\Deletion> */ class DeletionFactory ext...
fim
BookStackApp/BookStack
php
<|fim_suffix|>public function definition(): array { $html = '<p>' . implode('</p>', $this->faker->paragraphs(5)) . '</p>'; return [ 'name' => $this->faker->sentence(), 'slug' => Str::random(10), 'html' => $html, 'text' ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Entities\Models; use BookStack\Entities\Models\Page; u<|fim_suffix|>e' => 'version', 'markdown' => strip_tags($html), 'summary' => $this->faker->sentence(), 'revision_number' => rand(1, 4000), ]; } ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Entities\Models; use BookStack\Entities\Models\Book; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Entities\Models\SlugHistory> */ class SlugHistoryFactory extends Factory { protecte...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Exports; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; class ImportFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protecte...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Sorting; use BookStack\Sorting\SortRule; use BookStack\Sorting\SortRuleOperation; use Illuminate\Database\Eloquent\Factories\Factory; class SortRuleFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string *...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Uploads; use BookStack\Entities\Models\Page; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Uploads\Attachment> */ class AttachmentFactory extends Factory...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Uploads; use Illuminate\Database\Eloquent\Factories\Factory; class ImageFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = <|fim_suffix|>function definition() { r...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Users\Models; use Illuminate\Database\Eloquent\Factories\Factory; class RoleFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = \BookStack\Users\Models\Role::class; /** ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php namespace Database\Factories\Users\Models; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; class UserFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ prote...
fim
BookStackApp/BookStack
php
<|fim_suffix|>*/ public function up(): void { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password', 60); $table->rememberToken(); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\B<|fim_suffix|> $table->string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at'); }); } /** * Reverse the migrations. */ ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?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('books', function (Blueprin<|fi...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facade<|fim_suffix|>'); $table->nullableTimestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::d...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Suppo<|fim_suffix|> * Reverse the migrations. */ public function down(): void { Schema::drop('images'); } }; <|fim_middle|>rt\Facades\Schema; return new class extends...
fim
BookStackApp/BookStack
php
<|fim_suffix|> Schema::drop('chapters'); } }; <|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the mig<|fim_middle|>rations. */ public function...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migr<|fim_suffix|>nteger('created_by'); $table->integer('updated_by'); }); Schema::...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?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('page_revisions', function (Blu...
fim
BookStackApp/BookStack
php
<|fim_suffix|> Schema::drop('activities'); } }; <|fim_prefix|><?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 ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php /** * Much of this code has been taken from entrust, * a role & permission management solution for Laravel. * * Full attribution of the database Schema shown below goes to the entrust project. * * @license MIT * @url https://github.com/Zizaco/entrust */ use Carbon\Carbon; use Illumina<|fim...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /<|fim_suffix|>e) { $table->string('setting_key')->primary()->indexed(); $table->text('value'); ...
fim
BookStackApp/BookStack
php
<|fim_prefix|><?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 remov...
fim
BookStackApp/BookStack
php