1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Fleshed out entity provided and optimized imports

This commit is contained in:
Dan Brown 2018-09-25 16:58:03 +01:00
parent 919660678b
commit 257a5a23ec
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
49 changed files with 144 additions and 133 deletions

View File

@ -1,6 +1,5 @@
<?php namespace BookStack\Actions;
use BookStack\Actions\Activity;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Entities\Entity;
use Session;

View File

@ -1,6 +1,5 @@
<?php namespace BookStack\Actions;
use BookStack\Actions\Comment;
use BookStack\Entities\Entity;
/**

View File

@ -1,7 +1,7 @@
<?php namespace BookStack\Actions;
use BookStack\Entities\Entity;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Entities\Entity;
/**
* Class TagRepo

View File

@ -1,11 +1,11 @@
<?php namespace BookStack\Auth\Access;
use BookStack\Notifications\ConfirmEmail;
use BookStack\Auth\User;
use BookStack\Auth\UserRepo;
use Carbon\Carbon;
use BookStack\Exceptions\ConfirmationEmailException;
use BookStack\Exceptions\UserRegistrationException;
use BookStack\Auth\User;
use BookStack\Notifications\ConfirmEmail;
use Carbon\Carbon;
use Illuminate\Database\Connection as Database;
class EmailConfirmationService

View File

@ -1,11 +1,10 @@
<?php namespace BookStack\Auth\Access;
use BookStack\Auth\Access;
use BookStack\Exceptions\LdapException;
use BookStack\Auth\UserRepo;
use BookStack\Auth\Role;
use BookStack\Auth\User;
use BookStack\Auth\Access\Ldap;
use BookStack\Auth\UserRepo;
use BookStack\Exceptions\LdapException;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Builder;

View File

@ -1,11 +1,11 @@
<?php namespace BookStack\Auth\Access;
use BookStack\Exceptions\SocialSignInAccountNotUsed;
use Laravel\Socialite\Contracts\Factory as Socialite;
use BookStack\Exceptions\SocialDriverNotConfigured;
use BookStack\Exceptions\UserRegistrationException;
use BookStack\Auth\UserRepo;
use BookStack\Auth\SocialAccount;
use BookStack\Auth\UserRepo;
use BookStack\Exceptions\SocialDriverNotConfigured;
use BookStack\Exceptions\SocialSignInAccountNotUsed;
use BookStack\Exceptions\UserRegistrationException;
use Laravel\Socialite\Contracts\Factory as Socialite;
use Laravel\Socialite\Contracts\User as SocialUser;
class SocialAuthService

View File

@ -1,8 +1,8 @@
<?php namespace BookStack\Auth\Permissions;
use BookStack\Auth\Role;
use BookStack\Entities\Entity;
use BookStack\Model;
use BookStack\Auth\Role;
class JointPermission extends Model
{

View File

@ -1,16 +1,13 @@
<?php namespace BookStack\Auth\Permissions;
use BookStack\Auth\Permissions;
use BookStack\Auth\Role;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Auth\Permissions\EntityPermission;
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Ownable;
use BookStack\Entities\Page;
use BookStack\Auth\Role;
use BookStack\Auth\User;
use BookStack\Ownable;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder as QueryBuilder;

View File

@ -1,11 +1,8 @@
<?php namespace BookStack\Auth\Permissions;
use BookStack\Auth\Permissions;
use BookStack\Exceptions\PermissionsException;
use BookStack\Auth\Permissions\RolePermission;
use BookStack\Auth\Role;
use BookStack\Auth\Permissions\PermissionService;
use Setting;
use BookStack\Exceptions\PermissionsException;
class PermissionsRepo
{

View File

@ -2,7 +2,6 @@
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Model;
use BookStack\Auth\Permissions\RolePermission;
class Role extends Model
{

View File

@ -1,6 +1,5 @@
<?php namespace BookStack\Auth;
use BookStack\Auth\User;
use BookStack\Model;
class SocialAccount extends Model

View File

@ -1,10 +1,8 @@
<?php namespace BookStack\Auth;
use BookStack\Uploads\Image;
use BookStack\Model;
use BookStack\Notifications\ResetPassword;
use BookStack\Auth\Role;
use BookStack\Auth\SocialAccount;
use BookStack\Uploads\Image;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;

View File

@ -4,8 +4,6 @@ use Activity;
use BookStack\Entities\EntityRepo;
use BookStack\Exceptions\NotFoundException;
use BookStack\Uploads\Image;
use BookStack\Auth\Role;
use BookStack\Auth\User;
use Exception;
use Images;

View File

@ -1,7 +1,6 @@
<?php namespace BookStack\Entities;
use BookStack\Uploads\Image;
use BookStack\Entities\Page;
class Book extends Entity
{

View File

@ -1,9 +1,5 @@
<?php namespace BookStack\Entities;
use BookStack\Entities\Book;
use BookStack\Entities\Entity;
use BookStack\Entities\Page;
class Chapter extends Entity
{
public $searchFactor = 1.3;

View File

@ -2,11 +2,11 @@
use BookStack\Actions\Activity;
use BookStack\Actions\Comment;
use BookStack\Actions\Tag;
use BookStack\Actions\View;
use BookStack\Auth\Permissions\EntityPermission;
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Ownable;
use BookStack\Actions\Tag;
use BookStack\Actions\View;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Entity extends Ownable

View File

@ -1,7 +1,78 @@
<?php namespace BookStack\Entities;
/**
* Class EntityProvider
*
* Provides access to the core entity models.
* Wrapped up in this provider since they are often used together
* so this is a neater alternative to injecting all in individually.
*
* @package BookStack\Entities
*/
class EntityProvider
{
// TODO -
/**
* @var Bookshelf
*/
protected $bookshelf;
/**
* @var Book
*/
protected $book;
/**
* @var Chapter
*/
protected $chapter;
/**
* @var Page
*/
protected $page;
/**
* @var PageRevision
*/
protected $pageRevision;
/**
* EntityProvider constructor.
* @param Bookshelf $bookshelf
* @param Book $book
* @param Chapter $chapter
* @param Page $page
* @param PageRevision $pageRevision
*/
public function __construct(
Bookshelf $bookshelf,
Book $book,
Chapter $chapter,
Page $page,
PageRevision $pageRevision
) {
$this->bookshelf = $bookshelf;
$this->book = $book;
$this->chapter = $chapter;
$this->page = $page;
$this->pageRevision = $pageRevision;
}
/**
* Fetch all core entity types as an associated array
* with their basic names as the keys.
* @return Entity[]
*/
public function all()
{
return [
'bookshelf' => $this->bookshelf,
'book' => $this->book,
'chapter' => $this->chapter,
'page' => $this->page,
];
}
}

View File

@ -1,18 +1,11 @@
<?php namespace BookStack\Entities;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Actions\TagRepo;
use BookStack\Actions\ViewService;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Exceptions\NotFoundException;
use BookStack\Exceptions\NotifyException;
use BookStack\Entities\Page;
use BookStack\Entities\PageRevision;
use BookStack\Actions\TagRepo;
use BookStack\Uploads\AttachmentService;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Entities\SearchService;
use BookStack\Actions\ViewService;
use Carbon\Carbon;
use DOMDocument;
use DOMXPath;

View File

@ -1,9 +1,5 @@
<?php namespace BookStack\Entities;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\EntityRepo;
use BookStack\Uploads\ImageService;
class ExportService
@ -14,7 +10,8 @@ class ExportService
/**
* ExportService constructor.
* @param $entityRepo
* @param EntityRepo $entityRepo
* @param ImageService $imageService
*/
public function __construct(EntityRepo $entityRepo, ImageService $imageService)
{

View File

@ -1,10 +1,6 @@
<?php namespace BookStack\Entities;
use BookStack\Uploads\Attachment;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Entities\PageRevision;
class Page extends Entity
{

View File

@ -1,8 +1,7 @@
<?php namespace BookStack\Entities;
use BookStack\Entities\Page;
use BookStack\Model;
use BookStack\Auth\User;
use BookStack\Model;
class PageRevision extends Model
{

View File

@ -1,11 +1,5 @@
<?php namespace BookStack\Entities;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\SearchTerm;
use BookStack\Auth\Permissions\PermissionService;
use Illuminate\Database\Connection;
use Illuminate\Database\Query\Builder;

View File

@ -3,12 +3,12 @@
namespace BookStack\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Validation\ValidationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Handler extends ExceptionHandler

View File

@ -1,9 +1,9 @@
<?php namespace BookStack\Http\Controllers;
use BookStack\Exceptions\FileUploadException;
use BookStack\Uploads\Attachment;
use BookStack\Exceptions\NotFoundException;
use BookStack\Entities\EntityRepo;
use BookStack\Exceptions\FileUploadException;
use BookStack\Exceptions\NotFoundException;
use BookStack\Uploads\Attachment;
use BookStack\Uploads\AttachmentService;
use Illuminate\Http\Request;

View File

@ -2,11 +2,11 @@
namespace BookStack\Http\Controllers\Auth;
use BookStack\Exceptions\AuthException;
use BookStack\Http\Controllers\Controller;
use BookStack\Auth\UserRepo;
use BookStack\Auth\Access\LdapService;
use BookStack\Auth\Access\SocialAuthService;
use BookStack\Auth\UserRepo;
use BookStack\Exceptions\AuthException;
use BookStack\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

View File

@ -2,21 +2,19 @@
namespace BookStack\Http\Controllers\Auth;
use BookStack\Auth\SocialAccount;
use BookStack\Auth\User;
use BookStack\Auth\UserRepo;
use BookStack\Exceptions\SocialSignInAccountNotUsed;
use BookStack\Exceptions\SocialSignInException;
use BookStack\Exceptions\UserRegistrationException;
use BookStack\Auth\UserRepo;
use BookStack\Auth\Access\EmailConfirmationService;
use BookStack\Auth\Access\SocialAuthService;
use BookStack\Auth\SocialAccount;
use BookStack\Auth\User;
use BookStack\Http\Controllers\Controller;
use Exception;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Validator;
use BookStack\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
use Laravel\Socialite\Contracts\User as SocialUser;
use Validator;
class RegisterController extends Controller
{

View File

@ -1,9 +1,9 @@
<?php namespace BookStack\Http\Controllers;
use Activity;
use BookStack\Auth\UserRepo;
use BookStack\Entities\Book;
use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

View File

@ -1,10 +1,9 @@
<?php namespace BookStack\Http\Controllers;
use Activity;
use BookStack\Entities\Book;
use BookStack\Auth\UserRepo;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

View File

@ -1,8 +1,8 @@
<?php namespace BookStack\Http\Controllers;
use Activity;
use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
use BookStack\Entities\EntityRepo;
use BookStack\Entities\ExportService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

View File

@ -2,13 +2,13 @@
namespace BookStack\Http\Controllers;
use BookStack\Auth\User;
use BookStack\Ownable;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use BookStack\Auth\User;
abstract class Controller extends BaseController
{

View File

@ -2,7 +2,6 @@
use Activity;
use BookStack\Entities\EntityRepo;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Views;

View File

@ -1,13 +1,12 @@
<?php namespace BookStack\Http\Controllers;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Exceptions\NotFoundException;
use BookStack\Entities\EntityRepo;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Repos\PageRepo;
use BookStack\Uploads\Image;
use BookStack\Uploads\ImageRepo;
use Illuminate\Filesystem\Filesystem as File;
use Illuminate\Http\Request;
use BookStack\Uploads\Image;
use BookStack\Repos\PageRepo;
class ImageController extends Controller
{

View File

@ -1,14 +1,14 @@
<?php namespace BookStack\Http\Controllers;
use Activity;
use BookStack\Exceptions\NotFoundException;
use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
use BookStack\Entities\EntityRepo;
use BookStack\Entities\ExportService;
use BookStack\Exceptions\NotFoundException;
use GatherContent\Htmldiff\Htmldiff;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Views;
use GatherContent\Htmldiff\Htmldiff;
class PageController extends Controller
{

View File

@ -1,7 +1,7 @@
<?php namespace BookStack\Http\Controllers;
use BookStack\Exceptions\PermissionsException;
use BookStack\Auth\Permissions\PermissionsRepo;
use BookStack\Exceptions\PermissionsException;
use Illuminate\Http\Request;
class PermissionController extends Controller

View File

@ -1,8 +1,8 @@
<?php namespace BookStack\Http\Controllers;
use BookStack\Actions\ViewService;
use BookStack\Entities\EntityRepo;
use BookStack\Entities\SearchService;
use BookStack\Actions\ViewService;
use Illuminate\Http\Request;
class SearchController extends Controller

View File

@ -1,11 +1,10 @@
<?php namespace BookStack\Http\Controllers;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use BookStack\Auth\UserRepo;
use BookStack\Auth\Access\SocialAuthService;
use BookStack\Auth\User;
use BookStack\Auth\UserRepo;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class UserController extends Controller
{

View File

@ -3,8 +3,8 @@
namespace BookStack\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{

View File

@ -3,9 +3,9 @@
namespace BookStack\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ConfirmEmail extends Notification implements ShouldQueue
{

View File

@ -2,8 +2,8 @@
namespace BookStack\Notifications;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ResetPassword extends Notification
{

View File

@ -5,8 +5,8 @@ use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Settings\SettingService;
use BookStack\Settings\Setting;
use BookStack\Settings\SettingService;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Schema;

View File

@ -3,7 +3,6 @@
namespace BookStack\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{

View File

@ -3,17 +3,17 @@
namespace BookStack\Providers;
use BookStack\Actions\Activity;
use BookStack\Actions\ActivityService;
use BookStack\Actions\View;
use BookStack\Actions\ViewService;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Settings\Setting;
use BookStack\Settings\SettingService;
use BookStack\Uploads\Image;
use BookStack\Uploads\ImageService;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Actions\ViewService;
use BookStack\Settings\Setting;
use BookStack\Actions\View;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Support\ServiceProvider;
use BookStack\Actions\ActivityService;
use BookStack\Settings\SettingService;
use Intervention\Image\ImageManager;
class CustomFacadeProvider extends ServiceProvider

View File

@ -2,7 +2,6 @@
namespace BookStack\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use SocialiteProviders\Manager\SocialiteWasCalled;

View File

@ -2,9 +2,7 @@
namespace BookStack\Providers;
use BookStack\Auth\Role;
use BookStack\Auth\Access\LdapService;
use BookStack\Auth\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\UserProvider;

View File

@ -2,7 +2,6 @@
namespace BookStack\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Route;

View File

@ -1,7 +1,5 @@
<?php namespace BookStack\Settings;
use BookStack\Settings\Setting;
use BookStack\Auth\User;
use Illuminate\Contracts\Cache\Repository as Cache;
/**

View File

@ -1,8 +1,6 @@
<?php namespace BookStack\Uploads;
use BookStack\Exceptions\FileUploadException;
use BookStack\Uploads\Attachment;
use BookStack\Uploads\UploadService;
use Exception;
use Symfony\Component\HttpFoundation\File\UploadedFile;

View File

@ -1,9 +1,7 @@
<?php namespace BookStack\Uploads;
use BookStack\Uploads\Image;
use BookStack\Entities\Page;
use BookStack\Uploads\ImageService;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Entities\Page;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class ImageRepo

View File

@ -1,15 +1,13 @@
<?php namespace BookStack\Uploads;
use BookStack\Exceptions\ImageUploadException;
use BookStack\Uploads\Image;
use BookStack\Auth\User;
use BookStack\Uploads\UploadService;
use BookStack\Exceptions\ImageUploadException;
use DB;
use Exception;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Filesystem\Factory as FileSystem;
use Intervention\Image\Exception\NotSupportedException;
use Intervention\Image\ImageManager;
use Illuminate\Contracts\Filesystem\Factory as FileSystem;
use Illuminate\Contracts\Cache\Repository as Cache;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class ImageService extends UploadService