Search by

itmosoft / laravel-service-listings

adeelrao007

Service provider profiles and service listings for Laravel applications, with polymorphic ownership, categories, pricing models, and publication workflows.

Package info

github.com/ITMOSOFT/laravel-service-listings

pkg:composer/itmosoft/laravel-service-listings

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-17 12:39 UTC

This package is auto-updated.

Last update: 2026-11-17 12:40:24 UTC


README

Reusable service-provider profiles and service listings for Laravel 12 and 13 applications.

Features

  • Polymorphic service-provider ownership (users, companies, vendors, or custom models).
  • Provider profile details, contact information, status, and verification flag.
  • Hierarchical service categories.
  • Provider-owned service listings with summary, description, category, and metadata.
  • Pricing models: quote, fixed, hourly, daily, starting_at, or application-defined values.
  • Publication lifecycle: draft, pending, published, and archived.
  • Optional availability date range and featured flag.
  • Eloquent relationships and a HasServiceListings trait.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13
  • SQLite extension for the included test suite

Installation

composer require itmosoft/laravel-service-listings
php artisan vendor:publish --tag=service-listings-config
php artisan migrate

Migrations are loaded automatically. Publishing the config is optional.

Basic usage

use ITMOSOFT\ServiceListings\Models\ServiceProvider;
use ITMOSOFT\ServiceListings\Models\ServiceCategory;
use ITMOSOFT\ServiceListings\Models\ServiceListing;

$provider = ServiceProvider::create([
    'owner_type' => User::class,
    'owner_id' => $user->id,
    'display_name' => 'Acme Services',
    'slug' => 'acme-services',
    'email' => 'hello@example.com',
]);

$category = ServiceCategory::create([
    'name' => 'Home Services',
    'slug' => 'home-services',
]);

$listing = ServiceListing::create([
    'provider_type' => ServiceProvider::class,
    'provider_id' => $provider->id,
    'category_id' => $category->id,
    'title' => 'Deep Home Cleaning',
    'slug' => 'deep-home-cleaning',
    'pricing_model' => 'fixed',
    'price_amount' => 120.00,
    'currency' => 'USD',
]);

$listing->publish();

The provider morph relation on a listing points to the model stored in provider_type / provider_id. In the example above, that model is ServiceProvider; provider profiles themselves are polymorphically owned by the user/company model.

Add the trait to an owner model

use ITMOSOFT\ServiceListings\Concerns\HasServiceListings;

class User extends Authenticatable
{
    use HasServiceListings;
}

serviceProviderProfile() returns the owner's provider profile relation. serviceListings() returns listings directly owned by the model through the listing's provider morph. If listings should belong to a ServiceProvider profile, use $provider->listings().

Lifecycle

  • publish() publishes only draft or pending listings and stamps published_at.
  • unpublish() returns a published listing to draft.
  • archive() moves a listing to archived.
  • isCurrentlyAvailable() checks publication state and optional date bounds.
  • Providers can be activated or suspended using activate() and suspend().

Important design boundaries

This package stores service listings and provider profiles. It does not implement booking calendars, appointment reservations, dispatch, service fulfillment, payments, invoicing, reviews, messaging, identity verification workflows, or search indexing. The is_verified flag is application-managed and is not a substitute for the separate seller-verification workflow.

The package intentionally does not enforce a fixed list of pricing models or currencies. Validate those values in your application. Add authorization policies, moderation rules, and tenant/store scoping in the host application.

Testing

composer install
composer test

License

MIT. See LICENSE.