first commit
This commit is contained in:
47
app/Models/Company.php
Normal file
47
app/Models/Company.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Company extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'email',
|
||||
'name_english',
|
||||
'name_chinese',
|
||||
'registered_office_address_english',
|
||||
'registered_office_address_chinese',
|
||||
'br_number',
|
||||
'xero_api_key',
|
||||
];
|
||||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
if (strtolower(app()->getLocale()) == 'zh_hk') {
|
||||
return $this->name_chinese;
|
||||
}
|
||||
return $this->name_english;
|
||||
}
|
||||
|
||||
public function getRegisteredOfficeAddressAttribute()
|
||||
{
|
||||
if (strtolower(app()->getLocale()) == 'zh_hk') {
|
||||
return $this->registered_office_address_chinese;
|
||||
}
|
||||
return $this->registered_office_address_english;
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user