Installation & Setup
Introduction
You can install the package via composer:
composer require javaabu/paperless
Package Installation
To install the package, you can run the following command:
php artisan paperless:install
This command will:
- Publish the package configuration file.
- Publish the package migrations.
- Install seeders.
- Create entity types enum in
app/Paperless/Enums
directory. - Add routes to your
routes/admin.php
file. - Add api routes to your
routes/api.php
file. - Add menu items to your
app/Menus/AdminSidebar.php
file.
You should implement Javaabu\Paperless\Interfaces\Applicant
interface on any model that acts as an applicant, such as User
or PublicUser
model.
You should also implement Javaabu\StatusEvents\Interfaces\TrackingSubject
interface on the User
model.
To enable document uploading, you must have an api route that accepts file uploads. After setting up the route, you can update the paperless.php
configuration file to point to the route.
'routes' => [
'document_store' => 'api.documents.store'
],
Notice
You should add your own Media
model that extends SpatieMedia
model to your project. This is because the package assumes you have a relation with documentType on the Media
model.
public function documentType(): BelongsTo
{
return $this->belongsTo(config('paperless.models.document_type'));
}
Additionally, don't forget to point to your Media
model in the media-library.php
configuration file.
'media_model' => \App\Models\Media::class,
You may store your Media Model wherever you may please. Just make sure to update the configuration file to point to the correct model.
Seeding Data
First you need to seed the entity types. You may update the EntityTypes enum created during the installation process to add/update the entity types you want to seed. Then you can run the following command to seed the entity types.
php artisan db:seed --class=EntityTypesSeeder
Then you need to seed the model permissions
php artisan db:seed --class=PaperlessModelPermissionsSeeder
Optional: You will need to give your user the seeded permissions to access the package models. Normally you would need to run the following command to seed the permissions for the user.
php artisan db:seed --class=RolesSeeder