simplecms/company

公司信息附带单独账号,适用企业类型

1.0.4 2024-08-01 13:23 UTC

This package is auto-updated.

Last update: 2024-09-01 13:43:54 UTC


README

📦 The collection breaks down the account module of the organization company, and can achieve various basic information components of multiple enterprises/agents through attachment extensions.

English | 简体中文

Latest Stable Version Latest Unstable Version Code Coverage Total Downloads License

Requirements

Installation

composer require simplecms/company

Usage

Model Usage

The model inherits CompanyAbstract to add downward associations to Company. The naming of downward associations is named in the plural form of camel based on the file name of the Model. use CompanyTrait to add upward BelongsTo associations to the model.

use \SimpleCMS\Company\Abstracts\CompanyAbstract;
use \SimpleCMS\Company\Traits\CompanyTrait;
class Product extends CompanyAbstract
{
    use CompanyTrait;

    //If companyRelations is not set, the default plural form of Product's camel is used, corresponding key is company_id
    public static function companyRelations(){
        return [
            'products' => 'company_id', //Bind a hasMany relationship 'products' to Company, corresponding key is company_id
            'inventories' => 'supplier_id' // Bind a hasMany relationship 'inventories' to Company, corresponding key is supplier_id 
        ];
    }
}

Facades

Account login is completed through the CompanyAuthenticatable facade, and logging will be automatically written after login.

use SimpleCMS\Company\Facades\CompanyAuthenticatable;
CompanyAuthenticatable::apiLogin(string $account, string $password, array $messages = []): array //API interface login
CompanyAuthenticatable::guardLogin(string $guard, string $account, string $password, array $messages = []): bool|RedirectResponse; //Traditional AuthGuard login
CompanyAuthenticatable::getAccount(CompanyAccount $account): array //Get basic account information

Logging Events

Logging operations can be automatically handled by adding the SimpleCMS\Company\Http\Middleware\CompanyLogMiddleware middleware.

Models

use SimpleCMS\Company\Models\Company; //Company information
use SimpleCMS\Company\Models\CompanyAccount; //Login account
use SimpleCMS\Company\Models\CompanyApply; //Apply for entry
use SimpleCMS\Company\Models\CompanyLog; //Request log
use SimpleCMS\Company\Models\CompanyProfile; //Company profile
use SimpleCMS\Company\Models\CompanySafe; //Account security information

License

MIT