laravel-proposals maintained by itmosoft
ITMOSOFT Laravel Proposals
Proposal creation, submission, negotiation, counteroffers, and acceptance workflows for Laravel 12 and 13.
Features
- Polymorphic sender and recipient models.
- Proposal reference, title, description, currency, totals, expiry, and metadata.
- Proposal line items with quantity, unit, unit price, tax rate, and totals.
- Draft, submitted, accepted, rejected, and countered states.
- Submit, accept, reject, and expiry checks.
- Counteroffers create a separate proposal, reverse the parties, preserve copied line items, and link to the parent proposal.
HasProposalsconcern for sender/recipient relationships.
Requirements
- PHP 8.3+
- Laravel 12 or 13
- SQLite extension for the included test suite
Installation
composer require itmosoft/laravel-proposals
php artisan vendor:publish --tag=proposals-config
php artisan migrate
Basic usage
use Illuminate\Support\Str;
use ITMOSOFT\Proposals\Models\Proposal;
use ITMOSOFT\Proposals\Models\ProposalItem;
$proposal = Proposal::create([
'reference' => (string) Str::uuid(),
'sender_type' => User::class,
'sender_id' => $seller->id,
'recipient_type' => User::class,
'recipient_id' => $buyer->id,
'title' => 'Website development',
'currency' => 'USD',
'status' => 'draft',
]);
ProposalItem::create([
'proposal_id' => $proposal->id,
'name' => 'Implementation',
'quantity' => 1,
'unit_price' => 2500,
'line_subtotal' => 2500,
'line_total' => 2500,
]);
$proposal->submit();
Decisions and counteroffers
$proposal->accept('Approved by buyer');
// or
$proposal->reject('Budget not approved');
// or create a separate counter-proposal:
$counter = $proposal->counter([
'title' => 'Revised commercial offer',
]);
A counteroffer is a new draft proposal with sender and recipient reversed. It copies the current line items and links to the original through parent_id. The original proposal moves to countered. Submit the counter-proposal separately.
Add relationships to your model
use ITMOSOFT\Proposals\Concerns\HasProposals;
class User extends Authenticatable
{
use HasProposals;
}
This provides sentProposals() and receivedProposals().
Important design boundaries
This package provides proposal records and a basic lifecycle. It does not implement authorization, approval chains, e-signatures, immutable legal audit logs, notifications, document rendering, payment collection, contract generation, quote conversion, or automatic tax/total calculation. The application must validate party permissions, calculate and persist line totals, enforce currency rules, and snapshot accepted commercial terms as required.
Counteroffers are preserved as separate proposal records, but copied line items represent the original values at the time of countering. Further changes to either proposal do not synchronize automatically.
Testing
composer install
composer test
License
MIT. See LICENSE.