Appearance
Wovosoft\BkbOffice\Models\OfficeType
Title | Description |
---|---|
uses table | office_types |
Purpose | This table is used to hold the records of office types |
A short discussion
There are seven types of offices of Bangladesh Krishi Bank. These are listed below:
- Divisional Offices (GM/DO) =>
do
- Chief Regional / Regional Office (CRM/RM) =>
crm_rm
- Branches =>
br
- Divisional Audit Offices =>
dao
- Regional Audit Offices =>
rao
- Corporate Branches =>
cb
- Departments of Head Office =>
ho
Why do we need this model?
The answer of this question is good to know. Because, when we are using enum Wovosoft\BkbOffices\Enums\OfficeTypes
then why do we need a model for same types?
The answer, is The records of OfficeType model has same identical type
values of the enum Wovosoft\BkbOffices\Enums\OfficeTypes
. In all other cases whenever we need office type the enum should be used. But when we want offices of a certain type in ORM style we will use The OfficeType model.
use \Wovosoft\BkbOffices\Models\OfficeType;
use \Wovosoft\BkbOffices\Enums\OfficeTypes;
$ot=OfficeType::whereType(OfficeTypes::RegionalAuditOffice)->first();
$ot->offices->toArray();
Also, using a separate table can let us holds extra info for a type, which is not possible by enums.
Checking type
There are custom attributes to check the type of Office Type
is_branch
is_corporate_branch
is_div_office
is_dao_office
is_rao_office
is_crm_rm_office
is_head_office