Skip to content

Service Generator ‚Äč

The Service Generator Command, will create a new Service Class for the provided Module, with a basic boilerplate code. If you want to create a new Profile Service, for the Customer Module, you can run the following command:

bash
php artisan modular:make-service Customer Profile

Or if you are using Laravel Sail, run:

bash
sail artisan modular:make-service Customer Profile

A new Profile.php Service Class will be created at modules/Customer/Services/Profile.php.

The generated Service Class will have the following content:

php
<?php

namespace Modules\Customer\Services;

class Profile
{
    public function __invoke()
    {

    }
}