simplecms / company
公司信息附带单独账号,适用企业类型
Requires
- php: >=8.2
- laravel/framework: >=11.0
- laravel/sanctum: >=4.0
- simplecms/framework: >=1.0
This package is auto-updated.
Last update: 2025-03-01 00:42:11 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 | 简体中文
Requirements
- PHP >= 8.2
- MySql >= 8.0
- Laravel/Framework >= 11.0
- SimpleCMS/Framework >= 1.0
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