Companies

Codacy BadgeStyleCILicenseTotal DownloadsLatest Stable Version

Company management dependency for Laravel Enso.

Screenshot

Screenshot

click on the photo to view a large size screenshot

Features

  • provides a common functionality for managing companies within the Enso ecosystem
  • integrates with the People package
  • can be reused and integrated with other modules which might deal with companies (e.g. suppliers ) or even other entities, such as people (e.g. clients)
  • a CompanyFactory is included by default in the package
  • the companies server-side select functionality is also included by default

Under the Hood

  • the model comes with a mandatary relationship to a person. Of course, the mandatary is optional
  • once the company has activity in the system (through any other model relationship), it cannot be deleted
  • the proper way to delete a company is to first delete any other models it is linked to
  • a placeholder types enum in included in the package that is meant to be extended as/if required
  • all Company attributes are fillable
  • the uid Person attribute is meant as generic holder for a person's unique identifier which varies from situation to situation (e.g. SSN)
  • note that the onDeleteDocumentsManager configuration option will affect what happens to the linked documents when you attempt to delete a company.

Installation Steps

This package is already included in Laravel Enso, so no further steps are necessary.

Configuration

The config/enso/companies.php configuration file, lets you customize the following:

  • formTemplate, - string, is the project relative path to the companies form template, useful for overriding the original
  • tableTemplate, - string, is the project relative path to the companies table template, useful for overriding the original
  • contactFormTemplate, - string, is the project relative path to the contact person form template, useful for overriding the origin

Extending the companies

In your project you may have the need to alter and or extend the companies structure by changing table columns. To achieve this, you'd need to:

  • add migration(s) to your local project, making the necessary changes

  • create a new template for the companies form, and declare it in the config (formTemplate)

  • create a new template for the contact form, and declare it in the config (contactFormTemplate)

  • create a new template for the companies table, and declare it in the config (tableTemplate)

  • create a new company request validation, ensuring it implements the ValidatesCompanyRequest marker interface.

  • create a new contact request validation, ensuring it implements the ValidatesContactRequest marker interface.

  • bind your local implementations to the interfaces in your local AppServiceProvider

    $this->app->bind(
        ValidatesCompanyRequest::class, MyValidateCompanyRequest::class
    );
    

Publishes

  • php artisan vendor:publish --tag=companies-config - configuration file
  • php artisan vendor:publish --tag=companies-assets - the VueJS components
  • php artisan vendor:publish --tag=companies-factory - the factory for the Company model
  • php artisan vendor:publish --tag=enso-config - a common alias for when wanting to update the configurations, once a newer version is released, usually used with the --force flag
  • php artisan vendor:publish --tag=enso-assets - a common alias for when wanting to update the VueJS components, once a newer version is released, usually used with the --force flag
  • php artisan vendor:publish --tag=enso-factories - a common alias for when wanting to update the factories, once a newer version is released, usually used with the --force flag

Notes

The Laravel Enso package comes with this package included.

Depends on:

Last Updated: 11/13/2018, 5:49:27 AM