Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace BookStack\Entities\Queries; use BookStack\Entities\Models\PageRevision; ..
Decoded Output download
<?php
namespace BookStack\Entities\Queries;
use BookStack\Entities\Models\PageRevision;
use Illuminate\Database\Eloquent\Builder;
class PageRevisionQueries
{
public function start(): Builder
{
return PageRevision::query();
}
public function findLatestVersionBySlugs(string $bookSlug, string $pageSlug): ?PageRevision
{
return PageRevision::query()
->whereHas('page', function (Builder $query) {
$query->scopes('visible');
})
->where('slug', '=', $pageSlug)
->where('type', '=', 'version')
->where('book_slug', '=', $bookSlug)
->orderBy('created_at', 'desc')
->first();
}
public function findLatestCurrentUserDraftsForPageId(int $pageId): ?PageRevision
{
/** @var ?PageRevision $revision */
$revision = $this->latestCurrentUserDraftsForPageId($pageId)->first();
return $revision;
}
public function latestCurrentUserDraftsForPageId(int $pageId): Builder
{
return $this->start()
->where('created_by', '=', user()->id)
->where('type', 'update_draft')
->where('page_id', '=', $pageId)
->orderBy('created_at', 'desc');
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace BookStack\Entities\Queries;
use BookStack\Entities\Models\PageRevision;
use Illuminate\Database\Eloquent\Builder;
class PageRevisionQueries
{
public function start(): Builder
{
return PageRevision::query();
}
public function findLatestVersionBySlugs(string $bookSlug, string $pageSlug): ?PageRevision
{
return PageRevision::query()
->whereHas('page', function (Builder $query) {
$query->scopes('visible');
})
->where('slug', '=', $pageSlug)
->where('type', '=', 'version')
->where('book_slug', '=', $bookSlug)
->orderBy('created_at', 'desc')
->first();
}
public function findLatestCurrentUserDraftsForPageId(int $pageId): ?PageRevision
{
/** @var ?PageRevision $revision */
$revision = $this->latestCurrentUserDraftsForPageId($pageId)->first();
return $revision;
}
public function latestCurrentUserDraftsForPageId(int $pageId): Builder
{
return $this->start()
->where('created_by', '=', user()->id)
->where('type', 'update_draft')
->where('page_id', '=', $pageId)
->orderBy('created_at', 'desc');
}
}
Function Calls
None |
Stats
MD5 | 4767bd47a2284dd0b56320fb73ca088d |
Eval Count | 0 |
Decode Time | 79 ms |