48 lines
888 B
PHP
48 lines
888 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Account extends Model
|
|
{
|
|
protected $table = 'ab_account';
|
|
public $timestamps = FALSE;
|
|
|
|
protected $appends = [
|
|
'active_display',
|
|
];
|
|
protected $visible = [
|
|
'id',
|
|
'company',
|
|
'active_display',
|
|
];
|
|
|
|
/**
|
|
* Return the country the user belongs to
|
|
*/
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class);
|
|
}
|
|
|
|
public function language()
|
|
{
|
|
return $this->belongsTo(Language::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(\App\User::class);
|
|
}
|
|
|
|
public function getCompanyAttribute($value)
|
|
{
|
|
return $value ? $value : $this->user->SurFirstName;
|
|
}
|
|
|
|
public function getActiveDisplayAttribute($value)
|
|
{
|
|
return sprintf('<span class="btn-sm btn-block btn-%s text-center">%s</span>',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive');
|
|
}
|
|
} |