NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

The package resolves every model through config — model, placement_model, category_model and event_model. Extend the packaged class, keep its table and register it:

namespace App\Models;

use RoundlyConsulting\Advertisements\Models\Advertisement;

class Listing extends Advertisement
{
    protected $table = 'advertisements';   // keep the package table

    public function isFeatured(): bool
    {
        return (bool) $this->meta?->get('featured');
    }
}
// config/advertisements.php
'model' => App\Models\Listing::class,
'placement_model' => RoundlyConsulting\Advertisements\Models\Placement::class,
'category_model' => RoundlyConsulting\Advertisements\Models\Category::class,
'event_model' => RoundlyConsulting\Advertisements\Models\AdvertisementEvent::class,
  • The packaged models aren’t final for exactly this. Extend them — the scopes, casts, relations, slugs and creative buckets come along.
  • Set $table when your class name differs from the package’s (Listing would otherwise look for listings).
  • A config value that isn’t the packaged model or a subclass of it — not an Eloquent model at all, or an unrelated one — throws InvalidConfigurationException naming the key; it is never silently replaced by the packaged model.
  • Relations name their pivot table and foreign keys explicitly, so a subclass still reads advertisement_placement and advertisement_id.
  • Everything the package creates or queries — the facade, actions, resolvers, scopes and the tracking job — goes through the configured classes. Type-hint your subclass in routes to bind it.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.