Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lerichardv/patolab-platform/llms.txt

Use this file to discover all available pages before exploring further.

System settings are global, lab-wide values that control platform behaviour across all users and locations. They are stored in the settings table as key-value pairs (the Setting model), which makes them easy to extend without schema changes. The settings panel is accessible to any user who holds the settings.view permission, but only users with settings.edit can save changes.

Accessing the settings panel

Navigate to /settings/system in your browser. The page is rendered by SettingController@index and returns all settings as a flat key→value map to the React front-end.
GET  /settings/system   →  view the settings panel   (requires settings.view)
PUT  /settings/system   →  save updated values        (requires settings.edit)

Configured settings

The following settings are seeded by SettingsSeeder and managed through the system settings form.

Age-based discounts

PatoLab supports automatic price discounts for elderly patients at two age tiers. Both values are percentages and are validated as numeric between 0 and 100.
third_age_discount
integer
default:"30"
Percentage discount applied to specimens for patients in the tercera edad (third age / senior) tier. Default is 30 (30 % off the specimen price).The SettingController validates this field as:
'third_age_discount' => 'required|numeric|min:0|max:100'
fourth_age_discount
integer
default:"40"
Percentage discount applied to specimens for patients in the cuarta edad (fourth age / advanced senior) tier. Default is 40 (40 % off the specimen price).
'fourth_age_discount' => 'required|numeric|min:0|max:100'

Internal role configuration

pathologist_role_id
integer
default:"2"
The database ID of the role that corresponds to a Patólogo user. PatoLab uses this setting internally to identify which users are pathologists when determining specimen assignment eligibility and commission generation.This value is set automatically by RolesSeeder. If you recreate the roles table or change the pathologist role’s ID, update this setting to match.
This field is not editable through the system settings UI form — it is managed programmatically by the seeder. Changing it manually requires direct database access or a custom Artisan command.

Setting model

// app/Models/Setting.php
protected $fillable = [
    'setting_key',
    'setting_value',
    'description',
];
Settings are stored as strings regardless of their logical type. The SettingController casts values appropriately before saving:
Setting::where('setting_key', $key)->update([
    'setting_value' => (string) $value,
]);
To read a setting anywhere in the application:
$discount = (int) Setting::where('setting_key', 'third_age_discount')
    ->value('setting_value');

Specimen configuration

The following resources feed into specimen creation and are managed from separate configuration pages. All require the relevant *.* permissions as listed in Roles & Permissions.

Specimen types (/specimen-types)

Specimen types classify what kind of biological material a specimen is (e.g., biopsy, cytology, histology). Each type can have one or more examinations attached, and every active specimen type is eligible for its own sequence rule. Permissions: specimen_types.view, .create, .edit, .delete

Specimen type examinations (/specimen-type-examinations)

Examinations are the specific tests performed on a specimen of a given type. A specimen is linked to exactly one examination at creation time. Permissions: specimen_type_examinations.view, .create, .edit, .delete

Specimen categories (/specimen-categories)

Categories provide an additional classification layer above specimen type (e.g., surgical pathology, cytopathology). Used for grouping in reports and dashboards. Permissions: specimen_categories.view, .create, .edit, .delete

Specimen type templates (/specimen-type-templates and /my-specimen-type-templates)

Report templates pre-fill the collaborative TipTap editor when a pathologist opens the report editor for a specimen. Two template scopes exist:
  • /specimen-type-templates — Lab-wide shared templates, managed by administrators. Requires specimen_type_templates.* permissions.
  • /my-specimen-type-templates — Personal templates per pathologist. Requires my_specimen_type_templates.view / .manage permissions.
Encourage pathologists to build their own template library under /my-specimen-type-templates. Personal templates are private to the owning user and can include boilerplate macro/microscopy language, standard diagnoses, and formatted sections — dramatically reducing report authoring time for routine specimen types.

Storage locations (/storages)

Physical storage locations within the lab (refrigerators, freezer units, paraffin block cabinets, etc.) are registered here. Specimens can be linked to a storage location after processing. Storages belong to a branch location.
ActionPermission
Viewstorages.view
Createstorages.create
Editstorages.edit
Deletestorages.delete

Product catalog (/products)

Products are the billable line items attached to specimens and invoices (reagents, staining kits, special processing fees, etc.). Each product can be assigned a price via the Price List system. The PriceList model uses a polymorphic source relationship, meaning a price entry can belong to either a Product or a SpecimenType:
// PriceList fields
'pricing_source'  // morphable type ('App\Models\Product' or 'App\Models\SpecimenType')
'source_id'       // ID of the related model
'amount'          // decimal(8,2) — the price
ActionPermission
Viewproducts.view
Createproducts.create
Editproducts.edit
Deleteproducts.delete

Inventory (/inventories)

The inventory module tracks stock levels for each product per storage location.
RouteMethodDescriptionPermission
/inventoriesGETView current stock levelsinventory.view
/inventoriesPOSTAdd a product to the inventory cataloginventory.add
/inventories/abastecerPOSTRestock an existing inventory item (increase quantity)inventory.manage
/inventory-movementsGETView the full movement/audit historyinventory.movements.view
The abastecer (restock) endpoint increments the quantity of an existing inventory entry and records a movement row for auditability. For work-order based consumption tracking — where technicians use inventory items during processing — see the Work Orders documentation.

Referrers and referrer types

Referrers are the doctors, clinics, or hospitals that send specimens to your lab. They are associated with each specimen at registration time and affect commission calculations.
  • /referrers — CRUD for individual referrer records
  • /referrer-types — CRUD for referrer type classifications (e.g., general practitioner, specialist, clinic)

Branch locations (/locations)

Branch locations represent physical lab sites. Sequences, CAI ranges, storages, and users are all scoped per location. At least one active location must exist before creating specimens.
ActionPermission
Viewlocations.view
Createlocations.create
Editlocations.edit
Deletelocations.delete

Rentals (/rentals)

The rentals module manages equipment or space rental agreements billed through the platform. Rentals support creation, editing, and a dedicated pay action (POST /rentals/{rental}/pay).
ActionPermission
Viewrentals.view
Createrentals.create
Editrentals.edit
Deleterentals.delete

Seeding all defaults

To re-apply all factory settings to a fresh installation:
php artisan migrate:fresh --seed
To seed only the system settings without wiping the database:
php artisan db:seed --class=SettingsSeeder
SettingsSeeder uses Setting::create() rather than updateOrCreate(). Running it on a database that already has settings rows will insert duplicates. Use direct SQL or a custom Artisan command to update existing settings values on an already-seeded installation.

Build docs developers (and LLMs) love