Skip to content
Smart Lead Tech
Home
Services
Our work
Saudi Arabia
About us
Blog
Contact us
🇸🇦العربيةContact now
Smart Lead Tech

Smart software solutions

Follow us

Company

  • About us
  • Our work
  • Our services
  • Saudi Arabia
  • Restaurant POS
  • Contact us
  • Book a call

Quick links

  • Blogs
  • Pricing
  • Refund policy
  • Privacy policy
  • Terms and conditions
  • Data deletion

Contact us

  • Egypt — Head Office

    Office 6, Bldg 23, Makkah Al-Mukarramah St., Omraneya, Giza 3540203, Egypt
  • Saudi Arabia — Branch

    Bldg 2646, Secondary 123, Street 7697, Ishbiliyah Dist., Jubail 35416, Kingdom of Saudi Arabia
  • Email address

    help@smartleadtech.com
  • Phone number 🇪🇬

    +20 102 201 4671
  • Phone number 🇸🇦

    +966 53 044 7112

© 2026 Smart Lead Tech. All rights reserved.

  • Smart Lead Tech Information Technology LLC·Commercial Register ⁦61239⁩·Tax ID ⁦774-391-316⁩

  • Smart Lead Tech Software Establishment·CR ⁦7054902585⁩·VAT

Clean repositories and services in Laravel 11 — pragmatic SOLID

Everything here comes from shipping dozens of real-customer APIs. The goal is not "SOLID for its own sake"; it is two things: testable code and clear layers that never mix.The layer cake we default toRoute: endpoint name…

12/14/2024 — 13 min read

Pragmatic SOLID in Laravel 11

Everything here comes from shipping dozens of real-customer APIs. The goal is not "SOLID for its own sake"; it is two things: testable code and clear layers that never mix.

The layer cake we default to

  1. Route: endpoint name + middleware.
  2. FormRequest: validation only — no translation strings, no business logic.
  3. Controller: try/catch, hands input to the Service, wraps the result in a Resource via a trait.
  4. Service: business logic lives here. It is the only place that touches the Model.
  5. Resource: final JSON shape — nothing more.
Golden rule: the controller knows nothing about Eloquent; the service knows nothing about HTTP.

A consistent ResponsesTrait across every API

Every response is wrapped in the same envelope: { success, msg, data, meta? }. The frontend (Next.js) depends on this exact contract — any change is a breaking change.

When do we introduce a Repository?

We do not invent repositories for fun. We add one when:

  • the same query shape appears in 3+ places;
  • we need an interface to fake in tests;
  • we want a unified cache layer without polluting the service.

Events & domain events

Services fire events rather than calling each other. Example: ProjectPublished triggers an observer that flushes the cache and fires the revalidate webhook to Next.js.

Testing in practice

We aim to test every service without touching the database: swap the repository with a fake in the container and call the service directly. Pest makes this a joy.

Anti-patterns we avoid

  • Putting business logic inside Eloquent model events.
  • Sprinkling facades throughout services — DI is clearer.
  • Letting controllers touch models directly.

Share

Projects related to this article

  • Real EstateLaravel

    Real Estates Matcher — AI-Powered Property Matching

    A smart real-estate platform that matches demand and supply using AI and data analytics.

    Show more
    Real Estates Matcher — smart demand-supply matching
  • LogisticsLaravel

    Massafat — Shipping & Logistics Operations Suite

    A complete shipping operations suite for orders, shipments and payments — with direct JNT integration.

    Show more
    Massafat — shipping operations suite with JNT integration
  • AI SystemsPython

    Darb — AI Traffic-Incident Management System

    A smart system that manages and processes traffic incidents using ML, computer vision, and tight insurance integrations.

    Show more
    Darb — AI-driven traffic-incident management

Related Blogs

  • Flutter-built POS application

    Flutter for POS systems: offline-first done right

    POS apps do not run in perfect conditions. The internet drops, power cycles, and the branch still must sell. This note captures the pattern we use on TtaKkaa Cashier to keep operations smooth regardless of connectivity.T…

    11/05/2024 — 8 min read

  • Diagram of a language model connected to POS and inventory systems through MCP servers

    MCP for the CTO: letting AI safely “touch” your POS, inventory and CRM

    For years the problem was the same: the model is smart, but isolated. It knows everything about the world and nothing about your inventory. Model Context Protocol (MCP) is the open protocol that ended that isolation in a…

    08/05/2026 — 9 min read

  • Scalable NestJS architecture

    Scalable NestJS architecture — from module to monorepo

    Our large NestJS projects start as "one app with modules". Today anything with more than ten modules lives inside a monorepo. This note explains when we make each leap and what the team gains from it.Stage 1: Single app …

    10/18/2024 — 10 min read