30 lines
814 B
PHP
Executable File
30 lines
814 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
|
|
class NetworkOps extends Model
|
|
{
|
|
protected $guarded = array('id');
|
|
public $table = "network_operators";
|
|
|
|
public function account_manager_info(){
|
|
return $this->hasOne('App\Models\StaffMember', 'id', 'account_manager_id');
|
|
}
|
|
/*
|
|
public function setBuyingRateAttribute($value)
|
|
{
|
|
$cleanValue = filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
|
|
$this->attributes['buying_rate'] = $cleanValue;
|
|
}
|
|
*/
|
|
protected function buyingRate(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
set: fn (string $value) => filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)
|
|
);
|
|
}
|
|
}
|