Bagisto is a Laravel-based e-commerce platform. These guidelines are specifically curated for developing with Bagisto and its package-based architecture.
This application is a Bagisto e-commerce platform built on Laravel 12. You must be familiar with both Laravel and Bagisto's modular package architecture.
- PHP: 8.3+
- Laravel: v12
- Vue.js: For admin panel interactivity
- Tailwind CSS: For styling
- Laravel Octane: v2
- Laravel Sanctum: v4
- Laravel Socialite: v5
- Laravel Boost: v2
- Laravel MCP: v0
- Laravel Pint: v1
- Pest: v3
- PHPUnit: v11
Bagisto uses a modular package structure in packages/Webkul/:
| Package | Purpose |
|---|---|
| Admin | Admin panel functionality |
| Shop | Customer storefront |
| Core | Common utilities and helpers |
| Product | Product management |
| Category | Category management |
| Checkout | Cart and checkout process |
| Payment | Payment methods (CashOnDelivery, MoneyTransfer) |
| Paypal | PayPal integration |
| Shipping | Shipping methods |
| Sales | Order management |
| Customer | Customer management |
| Attribute | Product attributes |
| Inventory | Stock management |
| CartRule | Cart promotions |
| CatalogRule | Catalog promotions |
| DataGrid | Admin data tables |
| Tax | Tax calculation |
| CMS | Content management |
| Theme | Theme management |
This project has domain-specific skills available. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.
-
bagisto-coding-standards— Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice". -
bagisto-package-development— Use when creating or changing a Bagisto package — service providers, migrations, models, contracts, proxies, repositories, routes, controllers, Blade views, localization, admin menus, ACL or system configuration. Trigger phrases include "new package", "service provider", "migration", "model", "repository", "controller", "route", "ACL", "admin menu", "system config", "concord". -
bagisto-shipping-method-development— Use when creating or changing a Bagisto shipping method — a carrier class, shipping rates, the carriers config, or integrating a courier such as FedEx, UPS or DHL. Trigger phrases include "shipping", "shipping method", "carrier", "delivery", "shipping rate", "FedEx", "UPS", "DHL", "free shipping", "flat rate". -
bagisto-payment-method-development— Use when creating or changing a Bagisto payment method — a payment class, the payment methods config, the checkout redirect and callback flow, or integrating a gateway such as Stripe or PayPal. Trigger phrases include "payment", "payment method", "payment gateway", "Stripe", "PayPal", "Razorpay", "checkout payment", "redirect", "webhook". -
bagisto-product-type-development— Use when creating or changing a Bagisto product type — the product_types config, an AbstractType subclass, or type-specific cart, pricing and inventory behaviour. Trigger phrases include "product type", "AbstractType", "configurable", "bundle", "grouped", "downloadable", "virtual product", "subscription product", "prepareForCart". -
bagisto-shop-theme-development— Use when creating or changing a Bagisto storefront theme — a theme package, shop layouts, Blade component overrides, or the Vite asset pipeline for the customer-facing side. Trigger phrases include "shop theme", "storefront theme", "shop layout", "theme package", "vite", "tailwind", "publish views", "custom layout". -
bagisto-shop-advance-theme-development— Use when building a storefront feature against the advanced shop theme workflow — the non-negotiable rules and the end-to-end procedure for delivering one. Trigger phrases include "shop advance theme", "advanced theme", "storefront feature", "theme workflow", "definition of done". -
bagisto-admin-theme-development— Use when creating or changing a Bagisto admin theme — a theme package, admin layouts, Blade component overrides, or the Vite asset pipeline for the admin panel. Trigger phrases include "admin theme", "admin layout", "admin panel styling", "theme package", "vite", "tailwind", "publish views", "custom layout". -
bagisto-pest-testing— Use when writing or changing a Bagisto Pest test — feature or unit tests, assertions, datasets, mocking, architecture tests, or registering a new package's suite. Trigger phrases include "pest", "test", "unit test", "feature test", "assertion", "dataset", "mock", "testsuite", "TDD", "coverage". -
bagisto-data-transfer— Use when adding or changing a Bagisto import — an Importer class, a file source, the importers registry, the queued import pipeline, or a stuck or failing import job. Trigger phrases include "import", "importer", "data transfer", "CSV", "XLSX", "XML", "bulk upload", "import batch", "queued import", "validate rows". -
bagisto-theme-sections— Use when working on the Bagisto Appearance area — theme sections, the section editor and its storefront preview, draft and publish behaviour, section media, or the theme gallery. Trigger phrases include "section", "theme section", "appearance", "preview", "draft", "publish", "unsaved changes", "storefront layout", "theme gallery", "customize theme". -
bagisto-attribute-development— Use when working with Bagisto's EAV attribute system — adding or changing an attribute, attribute family or group, reading or writing a product attribute value, or debugging a value that reads back empty or from the wrong locale or channel. Trigger phrases include "attribute", "EAV", "attribute family", "attribute group", "attribute option", "custom attribute", "value_per_locale", "value_per_channel", "product_flat", "swatch". -
bagisto-datagrid-development— Use when building or changing a Bagisto admin listing page — a DataGrid class with columns, search, filters, sorting, row actions, mass actions or export, and the controller and Blade view that render it. Trigger phrases include "datagrid", "admin listing", "add a column", "mass action", "prepareQueryBuilder", "listing page", "grid filter", "export grid". -
bagisto-playwright-testing— Use when writing, changing or debugging a Bagisto end-to-end test — Playwright specs, page objects, ACL role coverage, fixtures, or a failing E2E run in CI. Trigger phrases include "playwright", "e2e", "end to end", "spec.ts", "page object", "browser test", "flaky test", "shard". -
bagisto-code-review— Use when reviewing Bagisto code changes or a pull request for correctness, convention compliance or quality, or when asked whether a change is ready to merge. Trigger phrases include "review", "code review", "PR review", "is this correct", "conventions", "violations", "code quality", "ready to merge". -
bagisto-git-workflow— Use when branching, committing, writing a CHANGELOG entry or opening a pull request against a Bagisto repository. Trigger phrases include "branch", "commit", "commit message", "PR", "pull request", "changelog", "merge", "conventional commits", "release notes". -
bagisto-change-verification— Use when a Bagisto change is about to be called done, or when asked to run the verification gates — code style, tests, end-to-end tests and translation completeness. Trigger phrases include "verify", "is this done", "run the gates", "pint", "pest", "playwright", "translations check", "ready to commit". -
bagisto-documentation— Use when writing or updating any Bagisto documentation site — the developer documentation, the merchant user guide, or any other Bagisto docs repository — covering page content, code samples, screenshots, the sidebar, image naming, and moving or deleting pages. Trigger phrases include "docs", "documentation", "user guide", "developer documentation", "dev docs", "merchant documentation", "marketplace docs", "document this", "update the docs", "add a doc page", "screenshot", "ImagePopup", "redirect a doc page". -
bagisto-api-develop— Use when working inside the bagisto-api package — installing or removing it, adding or changing a REST or GraphQL endpoint or resource, building an admin menu's API, or fixing package behaviour. Install and removal happen only on explicit request, never automatically. Trigger phrases include "ApiResource", "Provider", "Processor", "DTO", "resolver", "install the bagisto-api package", "remove the package", "add an endpoint", "extend an endpoint". -
bagisto-api-shop— Use when building a storefront app or UI on the Bagisto Shop API — a customer-facing storefront, catalog, cart, checkout, customer account, wishlist, compare, reviews, or any page or component of a shop on the API, whether web, mobile or custom. Ask the client's platform and stack first, and treat the api-docs as the source of truth for exact shapes. Trigger phrases include "products", "cart", "checkout", "coupons", "customer login", "customer account", "wishlist", "storefront on the API". -
bagisto-api-admin— Use when building an admin app or UI on the Bagisto Admin API — a back-office dashboard, an order, catalog, customer, marketing, CMS or settings management screen, an admin mobile app, the Create-Order flow, or any admin panel page on the API. Ask the client's platform and stack first, and treat the api-docs as the source of truth for exact shapes. Trigger phrases include "admin orders", "admin products", "customers", "cart rules", "CMS", "settings", "reporting", "admin panel on the API".
Every Bagisto package follows a standardized structure:
packages/Webkul/{PackageName}/
├── src/
│ ├── Config/
│ │ ├── admin-menu.php
│ │ └── system.php
│ ├── Database/
│ │ ├── Migrations/
│ │ ├── Seeders/
│ │ └── Factories/
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── Admin/
│ │ │ └── Shop/
│ │ ├── Middleware/
│ │ └── Requests/
│ ├── Models/
│ │ └── {Package}Proxy.php
│ ├── Repositories/
│ │ └── {Package}Repository.php
│ ├── Resources/
│ │ ├── views/
│ │ ├── lang/
│ │ └── manifest.php
│ └── Providers/
│ └── {Package}ServiceProvider.php
└── composer.json
Bagisto uses the Prettus L5 Repository pattern. Always use repositories for data access:
// Correct way - inject the repository and let the container resolve it.
public function __construct(
protected ProductRepository $productRepository,
) {}
$products = $this->productRepository->all();
// Outside a constructor, resolve it from the container.
$products = app(ProductRepository::class)->all();
// Avoid reaching for the model directly.
$products = Product::all(); // Less preferredService providers must:
- Load routes from
Routes/admin-routes.phpandRoutes/shop-routes.php - Load migrations automatically
- Load translations from
Resources/lang - Load views from
Resources/views - Merge package configuration using
$this->mergeConfigFrom()
- Always follow existing code conventions used in this application.
- Use descriptive names for variables and methods. For example,
isRegisteredForDiscounts, notdiscount(). - Check for existing components to reuse before writing new one.
- Use PHPDoc blocks with proper punctuation for all classes and methods.
- Follow the package structure when creating new packages.
- Use repositories for database operations.
- Do not create verification scripts or tinker when tests cover that functionality and prove they work.
- Unit and feature tests are more important than manual verification.
- Stick to existing directory structure; don't create new base folders without approval.
- Do not change the application's dependencies without approval.
- Custom packages should be placed in
packages/Webkul/.
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run
npm run build,npm run dev, orcomposer run dev. Ask them.
- You must only create documentation files if explicitly requested by the user.
- Be concise in your explanations - focus on what's important rather than explaining obvious details.
=== boost rules ===
Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
- Use the
list-artisan-commandstool when you need to call an Artisan command to double-check the available parameters.
- Whenever you share a project URL with the user, you should use the
get-absolute-urltool to ensure you're using the correct scheme, domain/IP, and port.
- You should use the
tinkertool when you need to execute PHP to debug code or query Eloquent models directly. - Use the
database-querytool when you only need to read from the database. - Use the
database-schematool to inspect table structure before writing migrations or models.
- You can read browser logs, errors, and exceptions using the
browser-logstool from Boost. - Only recent browser logs will be useful - ignore old logs.
- Boost comes with a powerful
search-docstool you should use before trying other approaches when working with Laravel or Laravel ecosystem packages. - This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation for your circumstance.
- Search the documentation before making code changes to ensure we are taking the correct approach.
- Use multiple, broad, simple, topic-based queries at once. For example:
['rate limiting', 'routing rate limiting', 'routing']. - Do not add package names to queries; package information is already shared.
- Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'.
- Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit".
- Quoted Phrases (Exact Position) - query="infinite scroll" - words must be adjacent and in that order.
- Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit".
- Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms.
=== php rules ===
- Always use curly braces for control structures, even for single-line bodies.
- Use PHP 8 constructor property promotion in
__construct().public function __construct(public GitHub $github) { }
- Do not allow empty
__construct()methods with zero parameters unless the constructor is private.
- Always use explicit return type declarations for methods and functions.
- Use appropriate PHP type hints for method parameters.
protected function isAccessible(User $user, ?string $path = null): bool
{
...
}- Typically, keys in an Enum should be TitleCase. For example:
FavoritePerson,BestLake,Monthly.
- Prefer PHPDoc blocks over inline comments. Never use comments within the code itself unless the logic is exceptionally complex.
- Add useful array shape type definitions when appropriate.
- Always use proper punctuation at the end of descriptions.
=== tests rules ===
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
- Run the minimum number of tests needed to ensure code quality and speed. Use
php artisan test --compactwith a specific filename or filter.
=== laravel/core rules ===
- Use
php artisan make:commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using thelist-artisan-commandstool. - If you're creating a generic PHP class, use
php artisan make:class. - Pass
--no-interactionto all Artisan commands to ensure they work without user input.
- Always use proper Eloquent relationship methods with return type hints.
- Use Eloquent models and relationships before suggesting raw database queries.
- Use Repository pattern for Bagisto packages.
- Avoid
DB::; preferModel::query(). Generate code that leverages Laravel's ORM capabilities. - Generate code that prevents N+1 query problems by using eager loading.
- Use Laravel's query builder for very complex database operations.
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using
list-artisan-commandsto check the available options tophp artisan make:model.
- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.
- Always create Form Request classes for validation rather than inline validation in controllers.
- Check sibling Form Requests to see if the application uses array or string based validation rules.
- Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
- When generating links to other pages, prefer named routes and the
route()function.
- Use queued jobs for time-consuming operations with the
ShouldQueueinterface.
- Use environment variables only in configuration files - never use the
env()function directly outside of config files. - Always use
config('app.name'), notenv('APP_NAME').
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
- Faker: Use methods such as
$this->faker->word()orfake()->randomDigit(). - When creating tests, make use of
php artisan make:test [options] {name}to create a feature test, and pass--unitto create a unit test. Most tests should be feature tests.
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run
npm run buildor ask the user to runnpm run devorcomposer run dev.
=== laravel/v12 rules ===
- CRITICAL: ALWAYS use
search-docstool for version-specific Laravel documentation and updated code examples. - Since Laravel 11, Laravel has a new streamlined file structure which this project uses.
- In Laravel 12, middleware are no longer registered in
app/Http/Kernel.php. - Middleware are configured declaratively in
bootstrap/app.phpusingApplication::configure()->withMiddleware(). bootstrap/app.phpis the file to register middleware, exceptions, and routing files.bootstrap/providers.phpcontains application specific service providers.- The
app/Console/Kernel.phpfile no longer exists; usebootstrap/app.phporroutes/console.phpfor console configuration. - Console commands in
app/Console/Commands/are automatically available and do not require manual registration.
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
- Laravel 12 allows limiting eagerly loaded records natively, without external packages:
$query->latest()->limit(10);.
- Casts can and likely should be set in a
casts()method on a model rather than the$castsproperty. Follow existing conventions from other models.
=== boost/core rules ===
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
- Use the
list-artisan-commandstool when you need to call an Artisan command to double-check the available parameters.
- Whenever you share a project URL with the user, you should use the
get-absolute-urltool to ensure you're using the correct scheme, domain/IP, and port.
- You should use the
tinkertool when you need to execute PHP to debug code or query Eloquent models directly. - Use the
database-querytool when you only need to read from the database. - Use the
database-schematool to inspect table structure before writing migrations or models.
- You can read browser logs, errors, and exceptions using the
browser-logstool from Boost. - Only recent browser logs will be useful - ignore old logs.
- Use
search-docstool before making code changes to ensure we are taking the correct approach. - Use multiple, broad, simple, topic-based queries at once.
=== pint/core rules ===
- You must run
vendor/bin/pint --dirty --format agentbefore finalizing changes to ensure your code matches the project's expected style. - Do not run
vendor/bin/pint --test --format agent, simply runvendor/bin/pint --format agentto fix any formatting issues.
=== pest/core rules ===
- This project uses Pest for testing. Create tests:
php artisan make:test --pest {name}. - Run tests:
php artisan test --compactor filter:php artisan test --compact --filter=testName. - Do NOT delete tests without approval.
- CRITICAL: ALWAYS use
search-docstool for version-specific Pest documentation and updated code examples. - IMPORTANT: Activate
bagisto-pest-testingevery time you're working with a Pest or testing-related task. - IMPORTANT: Activate
bagisto-playwright-testingfor anything undertests/e2e-pw/, andbagisto-change-verificationbefore calling any change done.
=== bagisto-payment-method-development rules ===
- CRITICAL: ALWAYS use the bagisto-payment-method-development skill when working with payment methods in Bagisto.
- Payment methods in Bagisto are located in
packages/Webkul/Payment/src/Payment/andpackages/Webkul/Paypal/src/Payment/. - All payment methods extend
Webkul\Payment\Payment\Paymentabstract class. - Payment configuration is defined in
Config/payment-methods.phpfiles. - System configuration for admin panel is defined in
Config/system.phpfiles. - Service providers must merge payment method configuration using
$this->mergeConfigFrom(). - Always follow the existing code patterns and PHPDoc conventions when creating payment methods.
- For testing payment methods, refer to
packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php.
=== bagisto-shipping-method-development rules ===
- CRITICAL: ALWAYS use the bagisto-shipping-method-development skill when working with shipping methods in Bagisto.
- Shipping methods in Bagisto are located in
packages/Webkul/Shipping/src/Carriers/. - All shipping methods extend
Webkul\Shipping\Carriers\AbstractShippingabstract class. - Shipping carrier configuration is defined in
Config/carriers.phpfiles. - System configuration for admin panel is defined in
Config/system.phpfiles. - Service providers must merge carrier configuration using
$this->mergeConfigFrom(). - Always follow the existing code patterns and PHPDoc conventions when creating shipping methods.
- Use
core()->convertPrice()for multi-currency support when setting prices. - Check
$item->getTypeInstance()->isStockable()for per-item shipping calculations.
=== bagisto-coding-standards rules ===
- CRITICAL: ALWAYS use the bagisto-coding-standards skill when writing or changing any Bagisto PHP or Blade. It owns code style, comments and docblocks, Laravel idiom, data access, Blade, security and localization;
vendor/bin/pintowns everything mechanical. - Every method and property carries a docblock, whatever its visibility. Class members run constants → properties → constructor → public → protected → private.
- No comments inside a method body, array literal, route group or markup — in PHP, Blade, JS or Vue alike. A non-obvious reason goes in the docblock or the commit message.
- A condition with more than one clause goes multiline, the boolean operator leading each line.
- All database access goes through a repository. The one sanctioned exception is a DataGrid's
prepareQueryBuilder(). - Events are dot-delimited strings (
catalog.product.update.after), never event classes, and fire inbefore/afterpairs. env()is called only insideconfig/; read admin settings withcore()->getConfigData().- Authorize on the server, scope every storefront query to the authenticated customer, and escape with
e()anything interpolated into markup — an attribute is the dangerous position.
- CRITICAL: the same skill covers every
.blade.phpfile. - Binding:
attr="text"is a literal,:attr="expr"is a Blade/PHP expression,::attr="expr"escapes to a literal:attrfor Vue. Getting:vs::wrong is the most common source of bugs. - Reuse the globally registered
x-admin::/x-shop::components and layouts; prefix only your own new components with your package namespace. - Vue-backed components:
<v-name>wrapper +<script type="text/x-template" id="v-name-template">+app.component("v-name", ...), all inside@pushOnce('scripts')…@endPushOnce. Emit runtime values as@{{ … }}. - Formatting: 4 spaces; more than one attribute means one per line with the closing
>on its own line; a single attribute stays inline; no blank lines between a tag's attributes; one blank line between sibling blocks. - Align the
=>in Blade@props/arrays. Do NOT align them in real.phpfiles — Pint single-spaces those. - Comments follow the layer they sit in:
{{-- --}}for Blade/PHP notes,<!-- -->for markup section dividers, and/** … */JSDoc blocks inside<script>and<style>— never//or bare/* */there. - Comment casing: a sentence is capitalized and punctuated; a bare title/label is Title Case with no trailing period.
- Never hardcode UI strings — use
@lang('<ns>::app…'), and add new keys to every locale. - Gate admin actions with
@if (bouncer()->hasPermission('resource.action')). - Bracket meaningful content with
{!! view_render_event('bagisto.<area>.<path>.before') !!}/.after.
=== bagisto-package-development rules ===
- CRITICAL: ALWAYS use the bagisto-package-development skill when creating packages in Bagisto.
- Use the Bagisto Package Generator (
composer require bagisto/bagisto-package-generator) for quick setup. - Package structure must follow the standardized layout in
packages/Webkul/. - Service providers must be registered in
bootstrap/providers.php. - Always run
composer dump-autoloadafter adding new packages. - Break a condition with more than one clause (
&&/||) across lines, operator leading each line; keep single-clause conditions inline. Pint does not enforce this — see the skill's PHP Code Style section. - Reference files:
core.md(structure, service providers),data-layer.md(models, migrations, repositories),ui.md(routes, controllers, views),features.md(localization, menus, ACL, system config),code-style.md,data-access.md.
- Use
$this->loadMigrationsFrom(),$this->loadRoutesFrom(),$this->loadViewsFrom(),$this->loadTranslationsFrom()in service provider boot() method. - Use
$this->mergeConfigFrom()in service provider register() method for config merging. - Register models in ModuleServiceProvider using Concord for proxy resolution.
- Use migrations in
src/Database/Migrations/for database schema. - Always create Contract, Model, and Proxy for each data entity (three-component model system).
- Use Prettus L5 Repository pattern for data access (extends
Webkul\Core\Eloquent\Repository). - Repository model() method must return the contract class path, not the model class.
- Use package prefix for table names (e.g.,
rma_requestsinstead ofreturn_requests). - Register models in
config/concord.phpvia ModuleServiceProvider.
- Routes must be in
src/Routes/admin-routes.phpandsrc/Routes/shop-routes.php. - Admin routes use middleware
['web', 'admin']with prefix fromconfig('app.admin_url'). - Shop routes use middleware
['web', 'locale', 'theme', 'currency']. - Controllers must extend package base Controller which extends
Illuminate\Routing\Controller. - Use dependency injection for repositories in controllers.
- Use
<x-admin::layouts>and<x-shop::layouts>for Blade views. - Use
<x-admin::datagrid>component for admin tables. - Views must be loaded with namespace prefix (e.g.,
rma::admin.return-requests.index).
- Translation files go in
src/Resources/lang/{locale}/and use namespacerma::— the rule is owned by thebagisto-coding-standardsskill (localization.md). - DataGrid classes extend
Webkul\DataGrid\DataGridand are placed insrc/DataGrids/Admin/— see thebagisto-datagrid-developmentskill. - Admin menu is configured in
src/Config/admin-menu.phpand merged tomenu.admin. - ACL is configured in
src/Config/acl.phpand merged toacl. - System configuration is in
src/Config/system.phpand merged tocore. - Use
core()->getConfigData('key.path')to retrieve configuration values. - Use
bouncer()->hasPermission('key')to check ACL permissions in controllers and views.
=== bagisto-product-type-development rules ===
- CRITICAL: ALWAYS use the bagisto-product-type-development skill when working with product types in Bagisto.
- Product types extend
Webkul\Product\Type\AbstractTypebase class. - Product type configuration is defined in
Config/product-types.phpfiles. - Reference files:
configuration.md(config structure),abstract-type.md(AbstractType methods),building-a-type.md(a complete implementation). - Product types must be registered in service provider using
$this->mergeConfigFrom(). - Key methods to override:
isSaleable(),isStockable(),showQuantityBox(),haveSufficientQuantity(),prepareForCart(),getTypeValidationRules(). - Use
$additionalViewsfor custom admin interface sections. - Use
$skipAttributesto hide irrelevant attributes for product type.
=== api-platform-development rules ===
- CRITICAL: use the
bagisto-api-developskill when installing / removing / extending thebagisto-apipackage; usebagisto-api-shoporbagisto-api-adminwhen building an app or UI on the API. - Two surfaces: Storefront —
/api/shop/*(REST) +/api/graphql, authed by theX-STOREFRONT-KEYheader (plus a customer or guest-cart Bearer token for cart/account calls). Admin —/api/admin/*(REST) +/api/admin/graphql, authed by a pre-issued admin Integration Bearer token. The admin API mirrors the admin panel menu-for-menu. - The api-docs (
https://api-docs.bagisto.comand its/llms.txtindex) are the source of truth for exact request/response shapes — open the endpoint page; never invent a payload from memory. - GraphQL
idis selectable only on fetchable (noun) resources (product, customer, order). Action/result mutations (cart writes, place-order, cancel, comment) return result fields (cartId,orderId,success,message) — neverid. GraphQL inputs are camelCase. - Admin collections return a
{ data, meta }envelope; storefront paginated collections exposeX-Total-*headers; page size is?per_page=N(+?page=N). - Extending the package: REST + GraphQL share the same Provider/Processor — any change to one must keep the other working, so run the resource's GraphQL test before the REST test. Mirror the admin panel, not a superset. No auto-commit — the user commits.