PHP code example of simplecms / company

1. Go to this page and download the library: Download simplecms/company library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

simplecms / company example snippets


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 
        ];
    }
}

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

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