text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|><|fim_suffix|>turn response()->json($docs);
}
/**
* Redirect to the API docs page.
* Required as a controller method, instead of the Route::redirect helper,
* to ensure the URL is generated correctly.
*/
public function redirect()
{
return redirect('/api/docs... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Api;
use BookStack\App\AppVersion;
use BookStack\Http\ApiController;
use Exception;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Route;
use Illuminate\Suppo... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Api;
use BookStack\Entities\Models\BookChild;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\Page;
class ApiEntityListFormatter
{
/**
* The list to be formatted.
* @var Entity[]
*/
protected array $list = [];
/**
* The fields to show in ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Api;
use BookStack\Activity\Models\Loggable;
use BookStack\Users\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
/**
* Class ApiTok... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ken_id', '=', $credentials['id'])
->with(['user'])->first();
if ($token === null) {
return false;
}
return Hash::check($credentials['secret'], $token->secret);
}
/**
* "Log out" the currently authenticated user.
*/
public function lo... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>uilder $query): Builder
{
$query = clone $query;
$defaultSortName = $this->fields[0];
$direction = 'asc';
$sort = $this->request->input('sort', '');
if (str_starts_with($sort, '-')) {
$direction = 'desc';
}
$sortName = ltrim($sort, ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Api;
use BookStack\Activity\ActivityType;
use BookStack\Http\Controller;
use BookStack\Permissions\Permission;
use BookStack\Users\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class UserApiTokenController extends Co... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\App;
class AppVersion
{
protected static string $version = '';
<|fim_suffix|>the application's version number from its top-level `version` text file.
*/
public static function get(): string
{
if (!empty(static::$version)) {
return static... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>onfig'
. ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
}
<|fim_prefix|><?php
namespace BookStack\App;
class Application extends \Illuminate\Foundation\Appl<|fim_middle|>ication
{
/**
* Get the path to the application configuration files.
*
* @param string $path Opti... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>this->queries->shelves->visibleForListWithCover()
->orderBy($commonData['listOptions']->getSort(), $commonData['listOptions']->getOrder())
->paginate(setting()->getInteger('lists-page-count-shelves', 18, 1, 1000));
$data = array_merge($commonData, ['shelves' => ... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\App;
use BookStack\Translation\LocaleDefinition;
use BookStack\Users\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
abstract class MailNotification extends N... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\App;
use BookStack\Http\Controller;
use BookStack\Uploads\FaviconHandler;
class MetaController extends Controller
{
/**
* Show the view for /robots.txt.
*/
public function robots()
{
$sitePublic = setting('app-public', false);
$allowRobots... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>l
{
/**
* Provides public access to get the raw attribute value from the model.
* Used in areas where no mutations are required, but performance is critical.
*
* @return mixed
*/
public function getRawAttribute(string $key)
{
return parent::getAttributeFromArra... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ppUrl, PHP_URL_HOST) ?: null;
config()->set('mail.mailers.smtp.local_domain', $hostName);
}
// Allow longer string lengths after upgrade to utf8mb4
Schema::defaultStringLength(191);
// Set morph-map for our relations to friendlier aliases
Relation::enf... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>" fetching the user at an app-instance level.
$this->app->singleton('users.default', function () {
return User::query()->where('system_name', '=', 'public')->first();
});
}
}
<|fim_prefix|><?php
namespace BookStack\App\Providers;
use BookStack\Access\ExternalBaseUserProvi... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>@handle',
GitLabExtendSocialite::class . '@handle',
TwitchExtendSocialite::class . '@handle',
DiscordExtendSocialite::class . '@handle',
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>
/**
* Configure the rate limiters for the application.
*/
protected function configureRateLimiting(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
RateL... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ion register(): void
{
// Register the ThemeService as a singleton
$this->app->singleton(ThemeService::class, fn ($app) => new ThemeService());
}
/**
* Bootstrap services.
*/
public function boot(): void
{
// Boot up the theme system
$themeSer... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> // locale as well as the fallback locale. So, we'll grab the application
// configuration so we can easily get both of these values from there.
$locale = $app['config']['app.locale'];
$trans = new Translator($loader, $locale);
$trans->setFallback($app['... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>leanLinkName = strtolower(trim($value));
$isJs = str_starts_with($cleanLinkName, 'javascript:');
$isData = str_starts_with($cleanLinkName, 'data:');
return !$isJs && !$isData;
});
}
}
<|fim_prefix|><?php
namespace BookStack\App\Providers;
use BookStack\Up... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\App\Providers;
use BookStack\Entities\BreadcrumbsViewComposer;
use BookStack\Util\<|fim_suffix|> new DateFormatter(
$app['config']->get('app.display_timezone'),
);
});
}
/**
* Bootstrap services.
*/
public function boot... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> "src" => setting('app-icon-180') ?: url('/icon-180.png'),
"sizes" => "180x180",
"type" => "image/png"
],
[
"src" => setting('app-icon') ?: url('/icon.png'),
"sizes" => "256x256",
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\App;
/**
* Assigned to models that can have slugs.
* Must have the below<|fim_suffix|>Interface
{
}
<|fim_middle|> properties.
*
* @property string $slug
*/
interface Sluggable<|endoftext|> | fim | BookStackApp/BookStack | php |
<|fim_suffix|>p logo for example.
*/
public function read(): JsonResponse
{
$logoSetting = setting('app-logo', '');
if ($logoSetting === 'none') {
$logo = null;
} else {
$logo = $logoSetting ? url($logoSetting) : url('/logo.png');
}
return re... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
use BookStack\App\A<|fim_suffix|>);
}
/**
* Get a path to a theme resource.
* Returns null if a theme is not configured, and therefore a full path is not available for use.
*/
function theme_path(string $path = ''): ?string
{
$theme = Theme::getTheme();
if (!$theme) {
return nul... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>> env('API_MAX_ITEM_COUNT', 500),
// The number of API requests that can be made per minute by a single user.
'requests_per_minute' => env('API_REQUESTS_PER_MIN', 180),
];
<|fim_prefix|><?php
/**
* API configuration options.
*
* Changes to these config files are not supported by BookStack an... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>potential breakage.
'style_sources' => env('ALLOWED_STYLE_SOURCES', null),
// A list of sources/hostnames that can be loaded as image content within BookStack.
// Space separated if multiple. BookStack host domain is auto-inferred, in addition to
// data and blob images, due to their use ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* Authentication configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
use Illuminate\Support\Str;
/**
* Caching configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
return [
/*
|------------------------------------------------------------------------------------------------------------------
| Enable Clockwork
|------------------------------------------------------------------------------------------------------------------
|
| Clockwo... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* Database configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.
*/
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* Debugbar Configuration Options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.
*/
... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ow always on in dompdf 2.x
*
* @var bool
*/
'enable_html5_parser' => true,
],
];
<|fim_prefix|><?php
/**
* Export configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altere... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> 'throw' => true,
],
'local_secure_images' => [
'driver' => 'local',
'root' => storage_path('uploads/images/'),
'serve' => false,
'throw' => true,
],
's3' => [
'driver' ... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>orithm is used.
// Supported: "bcrypt", "argon", "argon2id"
'driver' => 'bcrypt',
// Bcrypt Options
// Here you may specify the configuration options that should be used when
// passwords are hashed using the Bcrypt algorithm. This will allow you
// to control the amount of time i... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Processor\PsrLogMessageProcessor;
/**
* Logging configuration options.
*
* Changes to these config files are not supported by BookStack and m... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* Mail configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.
*/
// C... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>n syncing groups, remove any groups that no longer match. Otherwise, sync only adds new groups.
'remove_from_groups' => env('OIDC_REMOVE_FROM_GROUPS', false),
];
<|fim_prefix|><?php
return [
// Display name, shown to users, for OpenId option
'name' => env('OIDC_NAME', 'SSO'),
// Dump us... | fim | BookStackApp/BookStack | php |
<?php
/**
* Queue configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.
*/
return [
// ... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ice' => [
// URL Location where the <Response> from the IdP will be returned
'url' => '',
// SAML protocol binding to be used when returning the <Response>
// message. Onelogin Toolkit supports for this endpoint the
// HTTP-P... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* Third party service configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes your... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
use Illuminate\Support\Str;
/**
* Session configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> => false,
'registration-enabled' => false,
// User-level default settings
'user' => [
'ui-shortcuts' => '{}',
'ui-shortcuts-enabled' => false,
'dark-mode-enabled' => env('APP_DEFAULT_DARK_MODE', false),
'bookshelves_view_type' => env('APP_VIEWS_... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
/**
* View configuration options.
*
* Changes to these config files are not supported by BookStack and may break upon updates.
* Configuration should be altered via the `.env` file or environment variables.
* Do not edit this file unless you're happy to maintain any changes yourself.
*/
retu... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Console\Commands;
use BookStack\Entities\Models\Book;
use BookStack\Sorting\BookSorter;
use BookStack\Sorting\SortRule;
use Illuminate\Console\Command;
class AssignSortRuleCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Uploads\ImageService;
use Illuminate\Cons<|fim_suffix|>ount} image(s) deleted");
return 0;
}
protected function showDeletedImages($paths): void
{
if ($this->getOutput()->getVerbosity() <= OutputInterface::VERBOSITY_N... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> protected $description = 'Clear user (audit-log) activity from the system';
/**
* Execute the console command.
*/
public function handle(): int
{
Activity::query()->truncate();
$this->comment('System activity cleared');
return 0;
}
}
<|fim_prefix|><?ph... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Console\Commands;
use BookStack\Entities\Models\PageRevision;
use Illuminate\Console\Command;
class ClearRevisionsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bookstack:clear-revisions
... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Console\Commands;
use BookStack\Activity\Models\View;
use Illuminate\Console\Command;
class ClearViewsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bookstack:clear-views';
/**
*... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Entities\Queries\BookshelfQueries;
use BookStack\Entities\Tools\PermissionsUpdater;
use Illuminate\Console\Command;
class CopyShelfPermissionsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Users\Models\Role;
use BookStack\Users\UserRepo;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\Password;
class CreateAdminCommand extends Command
{
/**
... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Console\Commands;
use BookStack\Users\Models\User;
use BookStack\Users\UserRepo;
use Illuminate\Console\Command;
class DeleteUsersCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bookstack:d... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Users\Models\User;
use Exception;
use Illuminate\Console\Command;
/**
* @mixin Command
*/
trait HandlesSingleUser
{
/**
* Fetch a user provided to this command.
* Expects the command to accept 'id' and 'email' options.
* @th... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> (ThemeModuleException $exception) {
$this->error("ERROR: Failed to read module metadata with error: {$exception->getMessage()}");
return null;
}
return $themeModule;
}
protected function downloadModuleFile(string $location): string|null
{
$htt... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Users\Models\User;
use Exception;
use Illuminate\Console\Command;
use BookStack\Uploads\UserAvatars;
class RefreshAvatarCommand extends Command
{
use HandlesSingleUser;
/**
* The name and signature of the console command.
*
... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> *
* @var string
*/
protected $signature = 'bookstack:regenerate-permissions
{--database= : The database connection to use}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Regenerate all syste... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> $references->updateForAll();
DB::setDefaultConnection($connection);
$this->comment('References have been regenerated');
return 0;
}
}
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\References\ReferenceStore;
use Illuminate\Console\Command;
use Il... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console\Commands;
use BookStack\Entities\Models\Entity;
use BookStack\Search\SearchIndex;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\D<|fim_suffix|> console command.
*/
public function handle(SearchIndex $searchIndex): int
{
$connection ... | fim | BookStackApp/BookStack | php |
<|fim_suffix|> $user = $this->fetchProvidedUser();
} catch (Exception $exception) {
$this->error($exception->getMessage());
return 1;
}
$this->info("This will delete any configure multi-factor authentication methods for user: \n- ID: {$user->id}\n- Name: {$user->name... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>d.
*/
protected function replaceValueInTable(
Connection $db,
string $table,
string $column,
string $oldUrl,
string $newUrl
): int {
$oldQuoted = $db->getPdo()->quote($oldUrl);
$newQuoted = $db->getPdo()->quote($newUrl);
return ... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>on('database'));
}
$database = DB::getDatabaseName();
$tables = DB::select('SHOW TABLES');
$this->line('ALTER DATABASE `' . $database . '` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
$this->line('USE `' . $database . '`;');
$key = 'Tables_in_' . $d... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Console;
use Illumina<|fim_suffix|>rnel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected func... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Tools\ShelfContext;
use Illuminate\View\View;
class BreadcrumbsViewComposer
{
public function __construct(
protected ShelfContext $shelfContext
) {
}
/**
* Modify data when the v... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>($book);
return response('', 204);
}
protected function forJsonDisplay(Book $book): Book
{
$book = clone $book;
$book->unsetRelations()->refresh();
$book->load(['tags']);
$book->makeVisible(['cover', 'description_html'])
->setAttribute('de... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Controllers;
use BookStack\Activity\ActivityQueries;
use BookStack\Activity\ActivityType;
use BookStack\Activity\Models\View;
use BookStack\Activity\Tools\UserEntityWatchOptions;
use BookStack\Entities\Queries\BookQueries;
use BookStack\Entities\Queries\BookshelfQuerie... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Controllers;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Queries\BookshelfQueries;
use BookStack\Entities\Repos\BookshelfRepo;
use BookStack\Http\ApiController;
use BookStack\Permissions\Permission;
use Exception;
use Illuminate\Database\Eloquent\Re... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>on;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
class BookshelfController extends Controller
{
public function __construct(
protected BookshelfRepo $shelfRepo,
protected BookshelfQueries $queries,
protected EntityQueries $entityQueries,
... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ing a 'book_id' property will essentially move the chapter
* into that parent element if you have permissions to do so.
*/
public function update(Request $request, string $id)
{
$requestData = $this->validate($request, $this->rules()['update']);
$chapter = $this->queries-... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Controllers;
use BookStack\Activity\Models\View;
use BookStack\Activity\Tools\UserEntityWatchOptions;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Queries\ChapterQueries;
use BookStack\Entities\Queries\EntityQueries;
use BookStack\Entities\Repos\ChapterRe... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>bleByIdOrFail($id);
$page = $page->forJsonDisplay();
$commentTree = (new CommentTree($page));
$commentTree->loadVisibleHtml();
$page->setAttribute('comments', [
'active' => $commentTree->getActive(),
'archived' => $commentTree->getArchived(),
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Controllers;
use BookStack\Activity\Models\View;
use BookStack\Activity\Tools\CommentTree;
use BookStack\Activity\Tools\UserEntityWatchOptions;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Queries\EntityQueries;
use ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Controllers;
use BookStack\Activity\ActivityType;
use BookStack\Entities\Models\PageRevision;
use BookStack\Entities\Queries\PageQueries;
use BookStack\Entities\Repos\PageRepo;
use BookStack\Entities\Repos\RevisionRepo;
use BookStack\Entities\Tools\PageContent;
use Boo... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>r
{
public function __construct(
protected PageRepo $pageRepo,
protected PageQueries $pageQueries,
) {
}
/**
* Fetch a list of templates from the system.
*/
public function list(Request $request)
{
$page = $request->input('page', 1);
$sear... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>Count = $deletionRepo->destroy(intval($deletionId));
return response()->json(['delete_count' => $deleteCount]);
}
/**
* Load some related details for the deletion listing.
*/
protected function listFormatter(Deletion $deletion): void
{
$deletable = $deletion->de... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>cessNotification(trans('settings.recycle_bin_restore_notification', ['count' => $restoreCount]));
return redirect($this->recycleBinBaseUrl);
}
/**
* Show the page to confirm a Permanent deletion of the element attached to the deletion of the given id.
*/
public function sho... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>public function __construct(
protected string $type,
) {
}
public function __toString()
{
$existsRule = (new Exists('entities', 'id'))
->where('type', $this->type);
return $existsRule->__toString();
}
}
<|fim_prefix|><?php
namespace BookStack\Entit... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ic Bookshelf $bookshelf;
public Book $book;
public Chapter $chapter;
public Page $page;
public PageRevision $pageRevision;
public function __construct()
{
$this->bookshelf = new Bookshelf();
$this->book = new Book();
$this->chapter = new Chapter();
... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>e(): EntityDefaultTemplate
{
return new EntityDefaultTemplate($this);
}
public function cover(): BelongsTo
{
return $this->belongsTo(Image::class, 'image_id');
}
public function coverInfo(): EntityCover
{
return new EntityCover($this);
}
/**
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class BookChild.
*
* @property int $book_id
* @property int $priority
* @property string $book_slug
* @property Book $book
*/
abstract class BookC<|fim_suffix|>ity
{
/**
* Get ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\EntityCover;
use BookStack\Uploads\Image;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property strin... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>efaultTemplate(): EntityDefaultTemplate
{
return new EntityDefaultTemplate($this);
}
}
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\EntityDefaultTemplate;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Rela... | fim | BookStackApp/BookStack | php |
<?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\EntityHtmlDescription;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* @mixin Entity
*/
trait ContainerTrait
{
public function descriptionInfo(): EntityHtmlDescription
{
return new EntityHtmlDescription($this);
}
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Illuminate\Database\Eloquent\Relations\MorphMany;
/**
* A model that<|fim_suffix|>erface DeletableInterface
{
public function deletions(): MorphMany;
}
<|fim_middle|> can be deleted in a manner that deletions
* are tracked to be part of the recycle b... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>) {$deletable->name}";
}
return "Deletion ({$this->id})";
}
/**
* Get a URL for this specific deletion.
*/
public function getUrl(string $path = 'restore'): string
{
return url("/settings/recycle-bin/{$this->id}/" . ltrim($path, '/'));
}
}
<|fim_pref... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Activity\Models\Activity;
use BookStack\Activity\Models\Comment;
use BookStack\Activity\Models\Favouritable;
use BookStack\Activity\Models\Favourite;
use BookStack\Activity\Models\Loggable;
use BookStack\Activity\Models\Tag;
use BookStack\Activity... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $entity_id
* @property string $entity_type
* @property string $description
* @property string $description_html
* @property ?int $default_templ... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $page_id
*/
class EntityPageData extends Model
{
public <|fim_suffix|>;
protected $primaryKey = 'page_id';
public $incrementing = false;
public static array $fields = [
'... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>nt::withoutGlobalScope($scope);
}
/**
* Override the default forceDelete method to add type filter onto the query
* since it specifically ignores scopes by default.
*/
public function forceDelete()
{
return $this->query->where('type', '=', $this->model->getMorphClas... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Query\JoinClause;
class EntityScope implements Scope
{
/**
* Apply the scope to a given Eloquent query bu... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>ons(): HasMany
{
return $this->hasMany(JointPermission::class, 'entity_id')
->whereColumn('entity_type', '=', 'entities.type');
}
/**
* Get the Tags that have been assigned to entities.
*/
public function tags(): HasMany
{
return $this->hasMany(Ta... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>longsTo<Image, covariant Entity>
*/
public function cover(): BelongsTo;
}
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\EntityCover;
use BookStack\Uploads\Image;<|fim_middle|>
use Illuminate\Database\Eloquent\Relations\BelongsTo;
interface HasCoverInterf... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>public function defaultTemplate(): EntityDefaultTemplate;
}
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\EntityDefaultTemplate;
interface HasDefaultTempla<|fim_middle|>teInterface
{
<|endoftext|> | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Mod<|fim_suffix|> descriptionInfo(): EntityHtmlDescription;
}
<|fim_middle|>els;
use BookStack\Entities\Tools\EntityHtmlDescription;
interface HasDescriptionInterface
{
public function<|endoftext|> | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use BookStack\Entities\Tools\PageContent;
use BookStack\Permissions\PermissionApplicator;
use BookStack\Uploads\Attachment;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFact... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>nction getPreviousRevision(): ?PageRevision
{
$id = static::newQuery()->where('page_id', '=', $this->page_id)
->where('id', '<', $this->id)
->max('id');
if ($id) {
return static::query()->find($id);
}
return null;
}
/**
... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Models;
use Book<|fim_suffix|>
* @property string $slug
* @property ?string $parent_slug
*/
class SlugHistory extends Model
{
use HasFactory;
protected $table = 'slug_history';
public function jointPermissions(): HasMany
{
return $this->has... | fim | BookStackApp/BookStack | php |
<|fim_suffix|>y('last_viewed_at', 'desc');
}
public function popularForList(): Builder
{
return $this->visibleForList()
->scopes('withViewCount')
->having('view_count', '>', 0)
->orderBy('view_count', 'desc');
}
}
<|fim_prefix|><?php
namespace BookStack\Enti... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Queries;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Exceptions\NotFoundException;
use Illuminate\Database\Eloquent\Builder;
/**
* @implements ProvidesEntityQueries<Bookshelf>
*/
class BookshelfQueries implements ProvidesEntityQueries
{
protected stat... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Queries;
use BookStack\Entities\Models\Chapter;
use BookStack\Exceptions\NotFoundException;
use Illuminate\Database\Eloquent\Builder;
/**
* @implements ProvidesEntityQueries<Chapter>
*/
class ChapterQueries implements ProvidesEntityQueries
{
protected static arr... | fim | BookStackApp/BookStack | php |
<|fim_prefix|><?php
namespace BookStack\Entities\Queries;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\EntityTable;
use BookStack\Entities\Tools\SlugHistory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\JoinClause... | fim | BookStackApp/BookStack | php |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.