tomatophp/tomato-branches-module
Tomato Branches is a module for the TomatoPHP ecosystem that adds branch and location management to your Laravel app, letting you organize records and users by branch, typically through a Filament admin panel.
Architecture fit
tomatophp/tomato-admin, Filament v3, and the nwidart/laravel-modules loader. Fit is therefore binary: if we are on the TomatoPHP admin stack, it slots in as a first-class admin surface; if we are on vanilla Laravel, it is effectively unsupported.Branch entity (name, address, active flag), user↔branch association, Eloquent global scopes/helpers to filter records by branch, publishable migrations/seeders/config, and Filament resources for CRUD plus branch switching.Integration feasibility
composer require, php artisan migrate, confirm with module:list, publish config/lang, seed two or three branches, attach a user, then apply the branch scope to our own models.branch_id to our tables via our own add_branch_id_to_* migrations, and deciding branch resolution semantics (session → user default → first active branch) in a small CurrentBranch service so queued jobs and console commands can override explicitly.belongsTo (one branch per user) vs belongsToMany (pivot table), and whether branch doubles as the Spatie permission team_id. Both are cheap now and expensive to retrofit later.Technical risk
Class not found on form components) is a silent-version-mismatch symptom, not an obvious error.config/tomato.php / modules_statuses.json, and cached config makes it look broken. This is operational noise, not architectural risk, but it will consume support time.Key questions
Stack fit
tomatophp/tomato-admin, Filament v3, and nwidart/laravel-modules. Confirm this in writing before committing — installing into a bare Laravel app is explicitly not the supported path.PanelProvider or split panels by module, we must register the plugin/resource explicitly rather than relying on discovery.Migration path
branch_id to domain tables; our own trait/global scope (BelongsToBranch) enforces filtering; the package's Branch model is consumed, not modified.extends the module's resource, or its modifyFormSchema() / modifyTableColumns() hooks) so composer update does not erase our work.Compatibility
filament/filament and the module together in composer.json; treat them as a coupled pair across upgrades. TomatoPHP v4 targets Filament v3; older 3.x module lines target Filament v2.^1.0. v1.0.1 is a patch with no documented schema, route, or resource changes — a routine composer update should require no data migration or config republish.php artisan about, php artisan module:list, check the panel's plugin/resource list, php artisan route:list | grep branch, and config:clear && cache:clear.Sequencing
CurrentBranch service, trait/global scope, BranchSeeder in the app (not the package) — merged before any feature consumes branch.Branch model in-house — the schema is simple and the CRUD is not the expensive part.Maintenance
Support
Scaling
branch_id, and cross-branch reporting will require explicit scope-removal queries rather than expecting the ORM to do it.Failure modes
Class not found.branch_id, silently hiding legacy records — the worst outcome, because it looks like data loss.composer update overwrites a vendor edit or a published file that was edited in place.Ramp-up
Branch model. If any of those is missing, do not proceed — the package accelerates a flat branch model, but it is not a foundation to build a tenancy story on.How can I help you explore Laravel packages today?